actionscript - Connecting/Streaming to Flash Media Server from SWF -
i have access flash media server on cdn. want allow people connect server. currenty, need additional software connect fms. nicer if connect server browser.
so assume need create swf file , connect file fms (with actionscript).
the end result demo of jquery webcam plugin, swf file establish connection fms , stream video fms. http://www.xarg.org/project/jquery-webcam-plugin/
i need show dialog accept webcam connection , connect , stream video server.
take @ chapter 4 of fms dev guide.
in outline need following:
- create netconnection fms
- create netstream using connection
- attach camera , microphone stream (this automatically trigger webcam dialog)
- publish stream
you need add various listeners pick on events such checking have connected fms before creating netstream , starting recording, etc.
sample code:
var nc:netconnection = new netconnection(); nc.connect("rtmp://myservername/nameoffmsapplication/");
var ns:netstream = new netstream(nc);
camera = camera.getcamera(); mic = microphone.getmicrophone();
ns.attachaudio(camera); ns.attachaudio(mic);
ns.publish("thename ofthisvideois", "record");
nb stop publishing stream : ns.publish(false);
one of key things managing each stage listeners sure connected etc before proceed onto next step. luck!
Comments
Post a Comment