help with timecode
Peter Bogdanoff
bogdanoff at me.com
Sat May 30 14:16:46 EDT 2015
This is what I use for minutes & seconds. You can extend it to include hours & frames.
You’ll want to do the send command at the frame interval (1/30) of a second.
on updateCurrTime
put round(the currentTime of player “thePlayer" 1005 / 600) into theTime
put theTime div 60 into theMin
put theTime mod 60 into theSec
if len(theSec) = 1 then put "0" & theSec into theSec
put theMin & ":" & theSec into field "CurrTime"
send "updateCurrTime" to me in 1 seconds
end updateCurrTime
Peter Bogdanoff
UCLA
On May 30, 2015, at 7:07 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> Be aware I have no clue about drop, no drop etc so I am probably way off
> base here but..
>
> It seems to me that first you need to make sure you're working in seconds,
> so you need to divide the currenttime by the timescale to get the total
> seconds.
> Then its just a matter of math.
>
> Having said that, I may have an easy way to do the conversion. The first
> thing to do would be to grab a padding number when your app starts up like
> so:
>
> put 0 into tSeconds
> convert tSeconds to dateitems
> put (24 - (item -4 of tSeconds)) * 3600 into myAdjustment --the adjustment
> allows for timezone differences
>
> gives an adjustment number of seconds that will be used later.
>
> Then, it should be easy.
>
> put ((the currenttime of player "yourplayer" / the timescale of player
> "yourPlayer" ) + myAdjustment) into tCurrentTime
> convert tCurrentTime to dateitems
>
> At this point the hours of tCurrentTime should be item 4, minutes is 5, and
> seconds is 6.
> When displaying them, look at numberformat in the dictionary.
>
>
> On Sat, May 30, 2015 at 7:38 AM, Tim Selander <selander at tkf.att.ne.jp>
> wrote:
>
>> Dear Listers,
>>
>> I am trying to convert the currenttime of a player showing video into
>> standard video timecode -- hours:minutes:seconds:frames -- in both drop and
>> non-drop timecode. I'm not being too successful at it. As I struggled with
>> it, it occured to me I may be trying to re-invent the wheel.
>>
>> Does anyone of a solution for turning the current time of an LC player
>> into time code that they could share?
>>
>> Thanks,
>>
>> Tim Selander
>> Tokyo, Japan
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list