hi all
Im trying to build my own video player which allows the use of normal video and ones from a streaming server.
[AS]
private var videoURL:String = “filename.f4v”;
private function setupConnection():void
{
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onErrorConnect);
connection.connect(“rtmp://url to my streaming server”);
}
private function netStatusHandler(event:NetStatusEvent):void
{
trace("event.info.code "+event.info.code);
switch (event.info.code) {
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.Start":
onPlayVideoHandler();
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: " + videoURL);
break;
default :
//trace("default");
}
}
private function onErrorConnect(event:AsyncErrorEvent):void
{
trace("onErrorConnect: " + event);
}
private function securityErrorHandler(event:SecurityErrorEvent):void
{
trace("securityErrorHandler: " + event);
}
private function connectStream():void
{
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.bufferTime= 10;
var metaListener:Object = new Object();
metaListener.onMetaData = theMeta;
stream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(stream);
video.deblocking= 3;
stream.play(videoURL);
addChild(video);
}[/AS]
the NetConnection traces im getting are :
event.info.code NetStream.Play.Reset
event.info.code NetStream.Play.Start
event.info.code NetStream.Play.Stop
event.info.code NetStream.Buffer.Flush
but no video ever gets added/played…any idea why? what am i doing wrong?
I know the video works as we’ve tested it in our jwplayer.
many thanks
daidaidaiai