I'm trying to stream a sequence of small FLV files using PHP and MING library. The SWF file is generated by PHP dynamically on the server, so the video playlist can be updated. I'm new to ActionScript and don't know how to make video2.flv play after video1.flv plays to the end in the following example. When I run the resulting SWF file video2 starts to play right away. Is there any way to fix it?
$movie = new SWFMovie(7); $movie->setDimension(320,240); $movie->setBackground(0,0,0); $movie->setRate(8);
$strAction = " stop(); netConn = new NetConnection(); netConn.connect(null); vStream = new NetStream(netConn); video1.attachVideo(vStream); vStream.setBufferTime(5); vStream.play('http://localhost/video1.flv'); vStream.play('http://localhost/video2.flv');";
It's doing that because as you execute the code, it's immediately replacing vStream with video 2 in your code. It doesn't "know" the first video has ended. You need to put the entire chunk of code in a function, then have an onEnterFrame that listens for the completion of the first video before adding the second one. Sorry to be so vague but I haven't used this particular approach so have never coded it out. :-)
If this is your actual code, you also have an error here vStream.play('http://localhost/video2.flv');"; <----