I'm using the current code that works just fine. When a button is pressed it plays a 1st video, checks for the end of the 1st video then plays a 2nd video. When it reaches the end of the 2nd video it simply loops it again after waiting 5 seconds.
PHP Code:
ns.play(clipNamec1);
ns.onStatus = function(infoObject:Object) {
mystatus = infoObject.code;
if (mystatus == "NetStream.Buffer.Empty") {
ns.onStatus = function(info) {
if (info.code == "NetStream.Play.Stop") {
timeInt = setInterval(timeout, 5000);
ns.seek(0);
ns.pause();
}
};
ns.play(clipNamec1_l);
}
};
function timeout() {
ns.pause();
clearInterval(timeInt);
}
Now, all I want to do is simply delay the playhead of the 1st video 5 seconds before it begins.
My attempt isn't quite working. Not sure if I've got some code in the wrong place but I feel I'm close. Here is how I've modified it, but without success (I've commented what I think the code is doing):
PHP Code:
//tell the 1st video to play
ns.play(clipNamec5);
//tell the 1st video to pause 5 seconds
timeInt = setInterval(timeout1, 5000);
ns.seek(0);
ns.pause();
ns.onStatus = function(infoObject:Object) {
mystatus = infoObject.code;
//check to see if the 1st video is done
if (mystatus == "NetStream.Buffer.Empty") {
//cancel the 1st video's pause
function timeout1() {
ns.pause();
clearInterval(timeInt);
}
ns.onStatus = function(info) {
//check to see if the 2nd video is done
if (info.code == "NetStream.Play.Stop") {
//pause the second video for 5 seconds
timeInt = setInterval(timeout, 5000);
ns.seek(0);
ns.pause();
}
};
//play the 2nd video
ns.play(clipNamec5_l);
}
};
//cancel the 2nd video's pause
function timeout() {
ns.pause();
clearInterval(timeInt);
}
Does somebody see my mistake?