Publish a Camera and Microphone


Listing E.3 publishes your camera and microphone to a NetConnection. The connection script uses the UI components technique from Listings E.1 and E.2.

Listing E.3 Flash ActionScript for Publishing a Camera and Microphone
 nc = new NetConnection(); nc.onStatus = function(info) {       trace("LEVEL: "+info.level+"  CODE: "+info.code);       if (info.code == "NetConnection.Connect.Success") {             // Call a function to setup the NetStream Publish when the server accepts the graphics/ccc.gif connection             startStreamPublish();       } }; startStreamPublish = function () {       // attach the Camera feed to an Embedded Video Object named, "my_video"       // that exists on the Flash Stage.       my_video.attachVideo(Camera.get());       // attach a NetStream to the variable, publish_ns       publish_ns = new NetStream(nc);       // attach the Microphone and Camera to the publish_ns stream       publish_ns.attachAudio(Microphone.get());       publish_ns.attachVideo(Camera.get());       // start publishing the combined camera and microphone feed       publish_ns.publish("myStream"); }; nc.connect("rtmp://myApplication/myInstance", "Tracey Legault-Davis", "Bert"); 

The SSAS ActionScript template in Listing E.2 can be used with this ActionScript.



Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net