Skip to main content
Known Participant
July 22, 2012
Question

Netstream FLV

  • July 22, 2012
  • 2 replies
  • 671 views

I am trying to figure out how to use netstream to play an FLV.  Does anyone know of any examples or samples of how to do this?

I am playing the FLV from a different server that does not have an direct internet access.  I access it by IP address. rmtp://xxx.xxx.xxx.xxx/VOD/myFLV.  Please help?

This topic has been closed for replies.

2 replies

Known Participant
July 24, 2012

Ok I have some code but all I get is a blank screen when I test this so I am wondering if I have an erorr.  Does anyone see a problem with this?  Thanks.

// AS3

var customClient:Object = new Object();

customClient.onCuePoint = cuePointHandler;

customClient.onMetaData = metaDataHandler;

var myVideo:Video = new Video();

addChild(myVideo);

var nc:NetConnection = new NetConnection();

nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.client = customClient;

myVideo.attachNetStream(ns);

ns.play("rmtp://xxx.xxx.xxx.xxx/folder/Arrival.flv");

ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus);

function ns_onPlayStatus(event:NetStatusEvent):void

{

          trace("Movie Playing");

}

function cuePointHandler(infoObject:Object):void

{

          trace("cuePoint");

}

function metaDataHandler(infoObject:Object):void

{

          trace("metaData");

          myVideo.width = 480;// Resize video instance.

          myVideo.height = 360;

          myVideo.x = (stage.stageWidth - myVideo.width) / 2;// Center video instance on Stage.

          myVideo.y = (stage.stageHeight - myVideo.height) / 2;

}

Ned Murphy
Legend
July 23, 2012

Try searching Google using terms like "AS3 NetStream flv tutorial".  You should get at least a few result that will be helpful.