Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Streaming a sequence of video files



5:26 am on Mar 24, 2008 (gmt 0)

5+ Year Member

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);

$strAction = "
netConn = new NetConnection();
vStream = new NetStream(netConn);

$stream = new SWFVideoStream();
$item = $movie->add($stream);
$movie->add(new SWFAction($strAction));


3:29 pm on Mar 25, 2008 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

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');"; <----


Featured Threads

Hot Threads This Week

Hot Threads This Month