Subscribe to a Live or Recorded Stream


The script in Listing E.4 subscribes to, or receives, a live or prerecorded video (FLV) stream that is available within the application instance's streams folder.

Listing E.4 Flash ActionScript for Subscribing to or Receiving a Video Stream
 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 Subscription             startStreamSubscribe();       } }; startStreamSubscribe = function () {       // that exists on the Flash Stage.       // attach a NetStream to the variable, sub_ns       sub_ns = new NetStream(nc);       // attach the Subscription source to a Video Object on the stage       my_video.attachVideo(sub_ns);       // Start the stream, "serverStream", (-2) if the live source is not available,       // look for a recored stream of the same name.  (-1)Play until the stream is over       sub_ns.play("serverStream", -2, -1); }; nc.connect("rtmp://localhost/myApplication/myInstance", "Tracey 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