Clearing QT video when it's done

Klaus Major k_major at os.surf2000.de
Fri Nov 8 11:34:01 EST 2002


Hi Lance,

> Hello,
>
> I’m new to RR, I’m not a programmer though I used to do a bit of 
> SuperCard and HC. Thank you in advance for your help.  I’m using the 
> Runtime Starter kit (till I decide) on a Mac G4 os 9.1.
>
> I’m running Quicktime video clips in a player using the “Set the 
> filename of player 1 to MyClipName, followed by a “Start player 1” 
> command. (my thanks to the examples posted on the website).
>
> When the clip is finished playing, I’d like the last frame to 
> disappear. As it stands, the last frame persists.  I’ve tried several 
> variations using the “Done” function hoping to either hide the player 
> or go to another card at the end of the video.  I can’t get the Done 
> function to work.  It seems to continue waiting even though the video 
> is long over.  Only Cmd-period gets the script to stop.
>
> I’ve tried:
> If the movie is done..
> If Movie() = done...
> Wait until the movie is done...
> Etc.
>
> Can you recommend a way to clear the screen at the end of the clip?

There may be 2 ways to solve your problem... (maybe more ?)

Using a player to display movies always leaves the last frame on the 
screen.

So you can:

1. NOT use a player ;-)

Just script:

on mouseup ##or whatever
   player videoclip "path_to_your/movie.mov" at x,y
   ## replace x,y with your desired location on the card
end mouseup

This will play your movie and clear the last frame if the movie is done.

Disadvantage is that you don't have much control over your movie.


2. use the "send...in" command to clear the filename of your player

Put this in the card-script:

on clearframe
   set the filename of player 1 to empty
end clearframe

Then you can script your button like:

on xxx
    set the filename of player 1 to yyy
    start player 1
    put the duration of player 1 into totaltime
    put the timescale of player 1 into per_second
    send "clearframe" to this cd in (totaltime/per_second) secs
end xxx

This will deliver the message "clearframe" to the card in exactly
the time that your movie will last.

Movies have their own timescale and the duration is measured in
this special timescale. But you can query that and act accordingly.

Disadvantage of this method: If someone stops the movie before it
is over and starts it again it might stop unexspectedly...

But if you do not show the controller or give the user the possibility
to stop/start the movie this will do.

> Many thanks, I have more questions but for now take things one step at 
> a time.
> (except for; When is vers 2.0 expected?)

It should be delivered at the end of november... ;-)

> Lance Jacobs
> SilverDollar at nyc.rr.com
> NYC

Hope this helps.


Regards


Klaus Major
k_major at os.surf2000.de



More information about the use-livecode mailing list