mardi 22 septembre 2015

play a external flv video

hello please somoene can help me with this ...

I want to play a external flv video ("../sync/video/video.flv"), but in case the video is missing or when there is a error (StreamNotFound) I want to play automaticaly another video flv

case "NetStream.Play.StreamNotFound": ns.play("../sync/filler/video2.flv");

but it doesn't work ....

here is the full code :

var vid:Video;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);

var customClient:Object = new Object();
customClient.onMetaData = metaDataHandler;
ns.client = customClient;
ns.play("../sync/video/video.flv");

vid = new Video();
vid.attachNetStream(ns);
addChild(vid);

function netStatusF(e:NetStatusEvent):void {
switch (e.info.code) {
case "NetStream.Play.StreamNotFound":
ns.play("../sync/filler/video2.flv");
break;
}
}

function metaDataHandler(infoObject:Object):void {
vid.width = infoObject.width;
vid.height = infoObject.height;
}

Aucun commentaire:

Enregistrer un commentaire