Skip to main content
Participant
June 7, 2012
Question

Insert client side video to an app

  • June 7, 2012
  • 1 reply
  • 669 views

I have to builld an application which has two videos. One video comes from the server side with the support of flash media server.  and second video comes from client side  from a web cam. I was able to include server video to the app but I have no idea how to  include client video to the app, because the client does not have a flash media server or flash media encoder running. Can any one please help me

    This topic has been closed for replies.

    1 reply

    June 7, 2012

    Is the web cam on the same machine that will be running the application? If so, then you can just attach the camera stream to your video display element.

    sawula_7Author
    Participant
    June 7, 2012

    Thanks for the reply Apurva, I forgot to say this is a web application. Client (web cam) connecting to the app through the internet. It is a kind of        a chatting application. differnce is you can see videos of both parties on the app at the same time (client side video and the server  side video). problem is flash media server and live encoder are installed only on the server side. Please help me! 

    June 8, 2012

    So here's what you can do :

    1. From the client publish the web cam stream to your FMS server like so :

    var nc:NetConnection;

    var ns:NetStream;

    var camera:Camera;

    var microphone:Microphone;

    nc = new NetConnection();

    nc.addEventListener(NetStatusEvent.NET_STATUS, onStatus);

    nc.connect("rtmp://<server-ip>/<app>/<app-inst>");                       //connect to an FMS side application

    functiononStatuss(event:NetStatusEvent):void{

         if(info.code=="NetConnection.Connect.Success"){         

              ns = new NetStream(nc);

              ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);   //you can define an event listener for the netstream and handle events like Netstream.Publish etc

              camera = Camera.getCamera();    //Get the client side webcam and microphone

              microphone= Microphone.getMicrophone();

              ns.attachCamera(camera);                         //Attach it to the netstream

              ns.attachAudio(microphone);

              ns.publish("myWebcam","record");              //Publish that stream to FMS application. The streamname is myWebcam

         }

    }

    2. To playback this Wnb cam stream on any client you just need to connect to the same application instance and do a ns.play();

    See here for more information : http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000185.html

    Hope this helps.

    Thanks,

    Apurva