displaying timecode
Hi,
I'm trying to display timecode for the title currently playing.
I guess this can be implemented with the short period timer polling Player.Playlist.currentTitle.elapsedTime
and modifying Document.someInputTag.state.value accordingly.
But this looks like too complex solution. Are there more simple alternative approaches?
I have not found any among the samples.
P.S. I'm a newbie, so please excuse me if my questions are stupid.
[456 byte] By [
byly] at [2008-1-10]
I may be wrong, but the advanced features code sample, from the hdi jumpstart toolkit. Displays the current timecode of the title running. But never checked if its the video itself or what you are looking for. You may want to take a look at it.
http://www.microsoft.com/downloads/details.aspx?FamilyId=F8ADA3F5-0EC6-4392-84AB-CB4860DB30ED&displaylang=en
Hey Byly,
I dont know any other solution than the one you described. I do this as part of my debug/building enviornment on a 1 second inteval.
Also if you look at Universal Studios titles, the tivo-esque widget when you fastforward/rewind is polling and displating in the same way.
regards,
_scott
Using a timer is probably the most straight forward approach. If you are using timers, I highly encourage you to take a look at this post: http://blogs.msdn.com/ptorr/archive/2007/08/29/using-timers-effectively-in-hdi.aspx
If you want to avoid timers, you could trigger the update by an event sent from a markup cue. Something like...
<timing clock="page">
<defs>
<g id="doTimeCheck">
<event name="checkTime"/>
<set style:width="201px"/>
</g>
</defs>
<par>
<cue select="id('elapsedTime')" begin="id('elapsedTime')[style:width()='200px']" dur="1s" use="doTimeCheck"/>
</par>
</timing>
<body>
<div style
osition="absolute" style:x="50px" style:y="50px" style:width="201px" style:height="100px">
<input mode="display" id="elapsedTime" style:font="font.ttf" style:fontSize="40px" style:width="200px" style:color="yellow" state:value="" />
</div>
</body>
and then listen for the event in the script:
addEventListener(
"checkTime"
, handleTimeCheck, false
); function handleTimeCheck( evt )
{
var time = Player.playlist.currentTitle.elapsedTime;
evt.target.state.setProperty("value", time.substring(0,8));
}
Thank you, Amy and Scott, I will move fast forward

with one of the two approaches described.