Page 1 of 1
How to work out remaining time on a video
Posted: Fri Dec 20, 2013 9:57 am
by UtahCode197
I'm trying to make a countdown next to a video that will start when the video starts and countdown until the video ends. So far I've got:
Code: Select all
subtract duration of player "My Video" from currenttime of player "My Video"
If this is right then all I need to know is how to get it onto a label text field
Thanks a lot!
Re: How to work out remaining time on a video
Posted: Fri Dec 20, 2013 10:19 am
by Simon
Hi Rory,
Here's what I have:
Code: Select all
on playStarted
whatTime
end playStarted
on whatTime
put (the currentTime of me/the timeScale of me) into tCurrent
put (the duration of me/the timeScale of me) into totalSeconds
put round(totalSeconds - tCurrent) into fld 1
send whatTime to me in 1 second
end whatTime
All that in the script of the video player works.
Simon
Edit: Important edit
Code: Select all
on playStarted
whatTime
end playStarted
on whatTime
put (the currentTime of me/the timeScale of me) into tCurrent
put (the duration of me/the timeScale of me) into totalSeconds
put round(totalSeconds - tCurrent) into fld 1
if fld 1 <= 0 then exit whatTime
send whatTime to me in 1 second
end whatTime
Have to stop that send

Re: How to work out remaining time on a video
Posted: Fri Dec 20, 2013 1:07 pm
by Klaus
Hi Rory,
RoryJMcEwan wrote:Code: Select all
subtract duration of player "My Video" from currenttime of player "My Video"
besides from what Simon said, you really should think this logics over!
If you really don't see what's wrong here, substitute "duration" and "currenttime" with real time values
Best
Klaus