Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 72601

Re: play a flv video, and if the video is missing or when i have error play another one in another location

$
0
0

var vid: Video = new Video();

var ns: NetStream

var nc: NetConnection = new NetConnection();

 

var customClient:Object = this;

customClient.onMetaData = metaDataHandler;

 

nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusF);

nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorF);

nc.connect(null);

 

function netStatusF(e:NetStatusEvent):void {

switch (e.info.code) {

case "NetConnection.Connect.Success":

connectF();

break;

case "NetStream.Play.StreamNotFound":

connectF('video2.flv');  // but i would probably loop through an array of possible videos.

break;

}

}

 

function connectF(videoS:String='video1.flv'):void {

ns = new NetStream(nc);

ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusF);

ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

ns.addEventListener(IOErrorEvent.IO_ERROR, ioErrorF);

ns.client = customClient;

ns.play(videoS);

vid.attachNetStream(ns);

addChild(vid);

}


Viewing all articles
Browse latest Browse all 72601

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>