PDA

View Full Version : Play a rtmp stream from Flash Media Server


allanbj
01-14-2009, 08:32 PM
I want to make a small simple flash file that automatically begins playing a live stream from Flash Media Server. I have the following code, but it plays a prerecorded FLV file on the server. But I want to play a stream instead...

var vid:Video = new Video(50, 38);
addChild(vid);

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);
vid.attachNetStream(ns);

var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
ns.client = listener;

ns.play("externalVideo.flv");

I figured out I needed to change this line:

nc.connect("rtmp://mystreamserver.com/live/livestream.flv");


- but what else do I need to do?

Also, I do not want the sound to be heard. How would I do that?