1
您好,請有人可以幫助我這個...播放外部FLV視頻
我想打一個外部FLV視頻("../sync/video/video.flv")
,但如果視頻丟失或當有(StreamNotFound)
錯誤 我想自動播放另一個flv視頻。
case "NetStream.Play.StreamNotFound":
ns.play("../sync/filler/video2.flv");
,但它不工作....
這裏是全碼:
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;
}
非常感謝!完美地工作 – carlc1