video player time display

Josh Mellicker josh at dvcreators.net
Tue Jul 17 22:10:32 CDT 2007


Here is a suggestion:


Instructions:

1. Rename "myCardName" & "myStackName" with your card and stack names

2. make a field called "runningTimecode"

3. then, just call the handler "updateTC" once


It updates 10 times per second.


handlers:
------------

on updateTC
     put convertTime(round(the currenttime of tPlayer()/the timescale  
of tPlayer())) into fld "runningTimecode"
     if ",updateTC," is not in the pendingmessages then send  
"updateTC" to me in 100 milliseconds
end updateTC

function convertTime
     put the currenttime of tPlayer() into this_time
     put the timescale of tPlayer() into movie_scale
     put this_time div movie_scale into total_seconds
     put (this_time mod movie_scale) into partial_seconds
     put ("." & partial_seconds) * 10 into tenths
     put total_seconds div 3600 into tHours
     put (total_seconds - (tHours * 3600)) div 60 into tMinutes
     put (total_seconds - (tMinutes * 60) - (tHours * 3600)) div 1  
into tSeconds
     set the numberformat to "##"
     if tHours <> 0 then
         return tHours & ":" & tMinutes & ":" & tSeconds & ":" & tenths
     else
         return tHours & ":" & tMinutes & ":" & tSeconds & ":" & tenths
     end IF
end convertTime

function tPlayer
     return "player" && q("Player") && "of cd" && q("myCardName") &&  
"of stack" && q("myStackName")
end tPlayer

function q a
     return quote & a & quote
end q




On Jul 17, 2007, at 11:54 AM, Sieg Lindstrom wrote:

> I'm working for the first time with players. I'd like my stack,  
> which will
> be used to work with video, to include include a running timer  
> display (in
> the format minutes:seconds.tenths of seconds). I know to do the
> currentTime/timeScale calculation and then go from there to display in
> minutes:seconds.tenths format.
>
> What is the most reasonable condition to trap for to perform the  
> calculation
> frequently enough so the display is timely and responsive but  
> doesn't demand
> unnecessarily frequent recalculation of the time?
>
> Thanks in advance. I'm really a novice in this area.
>
> Sieg Lindstrom
> San Francisco
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list