I have some FLV video files to be reproduced sequentially by a Flash video player. Suppose v1.flv and v2.flv. I want the player to start playing v2.flv once v1.flv has reached the end. According to this forum, the onPlayStatus does not fire in progressive FLVs. What can be done? A snippet of what I am trying below:
public class MyClass extends Sprite {
private var nc : NetConnection;
private var ns : NetStream;
private var vid : Video;
private var vidURL : String = "v1.flv";
public function MyClass() {
var nsClient:Object = {};
nsClient.onPlayStatus = client_onPlayStatus;
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
nc.connect(null);
ns = new NetStream(nc);
ns.play(vidURL);
ns.client = nsClient;
vid = new Video();
vid.attachNetStream(ns);
addChild(vid);
}
private function netStatusHandler(event : NetStatusEvent) : void {
trace(event.info.code);
switch(event.info.code) {
case "NetConnection.Connect.Success":
trace("Loaded stream: " + vidURL);
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: " + vidURL);
break;
default:
}
}
private function client_onPlayStatus(event:Object) : void {
trace("status=" + event.info.code);
}
}
The only text that shows up in the trace output is:
NetConnection.Connect.Success
Loaded stream: /path/to/v1.flv
Any help will be appreciated!
I ended using part of charlie-boy’s suggestion adapting
MediaStream.asto check every 100ms if thetimeproperty of theNetStreamis the same (it’s stuck in the end… or maybe just stuck but my specific situation will make that unlikely).I added three properties to
MediaStream:and changed the
compareTimefunction like this:The worst case scenario is a 100ms “stuck frame” before loading the next clip. Not so bad for my specific need.
Thanks all for the input.