views:

13

answers:

0

Hi,

I'm trying to use the NetConnection class to connect to a live video feed on an external server. I have it set up to start playing my video when the user clicks a Play button, however, this appears in my output every time I click the Play button:

ArgumentError: Error #2126: NetConnection object must be connected. at flash.net::NetStream/ctor() at flash.net::NetStream() at Over/connectLiveStream()[Over::frame2:31]

Any ideas as to why this isn't working? Here is the (I think relevant) code:

 if (playVid.label == "Play") 
 {
  nc = new NetConnection();
      nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
      nc.connect("rtmp://my.rtmp.server:1935/live/");

      nsPlay = new NetStream(nc);
      nsPlay.play("livestream.flv");

 }

Thanks in advance.