homepage Welcome to WebmasterWorld Guest from 54.205.168.88
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Streaming a sequence of video files
frikus




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

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

$stream = new SWFVideoStream();
$item = $movie->add($stream);
$item->setname("video1");
$movie->add(new SWFAction($strAction));
$movie->nextFrame();

 

rocknbil




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved