playing videos in succession

J. Landman Gay jacque at hyperactivesw.com
Fri Dec 5 17:17:24 CST 2003


On 12/5/03 4:21 PM, Kurt Kaufman wrote:

> I'm looking for a script that would allow me to play a number of 
> separate video clips one after the other.  I understand that it involves 
> the player waiting for the playstopped message and then starting the 
> next clip.

You are off by 2 because setting the filename of a player also sends a 
"playstopped" message. You'll need to bracket setting the filename with 
"lock messages/unlock messages" commands to block the extra playstopped 
message that gets sent.

But brace yourself. There is a discussion going on right now on the MC 
list about playing files serially in a player. While the Rev IDE 
receives the "playStopped" message just fine, standalones built for OS X 
do not. It's a bug. If you are only building for Windows there's no 
problem, since the bug is only in OS X.

My work-around involves including a calculation like this:

     -- set the player filename, then:
     put the duration of player "mp" into theDur
     put (theDur/the timeScale of player 1) into theSecs
     start player "mp"
     send "movieStop" to me in theSecs seconds

And then replace your "playStopped" handler with a custom message 
handler, like this:

on movieStop
    global gCurrentMovie, gMovieTally
   --if there is only one clip listed in fld "goodFiles", then stop:
   if the number of lines in fld "goodFiles" = 1 then
     set the hilitedline of fld "goodFiles" to empty
   else  -- line 2 or greater
     get the hilitedline of fld "goodFiles"
     if line it + 1 of fld "goodFiles" = empty then exit movieStop
     set the hilitedline of fld "goodFiles" to it + 1
     put line it of fld "goodFiles" into gCurrentMovie
     set the filename of player "mp" to gCurrentMovie
     set the currentTime of player "mp" to 0
     put the duration of player "mp" into theDur
     put (theDur/the timeScale of player 1) into theSecs
     start player "mp"
     send "movieStop" to me in theSecs seconds
   end if
end movieStop

This is a kludgy workaround until the bug gets fixed.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list