In W3C TTML dfxp standard, a div
element can contain begin
, end
and duration
attributes.
How to interpret the value of these timing attributes?
Example:
<div begin="00:00:22.0 end ="00:00:30.0">
<p begin="0s" end="1s">Hi,</p>
<p begin="3s" end="5s">Hello</p>
<p begin="5s" end="10s">there?</p>
</div>
When to present p
elements?
Any pointers to TTML spec/implementation would be helpful.
The latest TTML spec is at http://www.w3.org/TR/ttml1/ Many of the timing semantics come from SMIL 2.1.
There are two parts to your answer: first, how do you compute the times for any particular content element; second, how do you relate those times to some other timeline for playback.
Computing time values
The computation of times depends on several things. First, can we assume that you are working in a timeBase and markerMode that allow for time calculations? This applies in all but one scenario, so if you have
timeBase="media"
ortimeBase="clock"
then you can. Also if you havetimeBase="smpte"
andmarkerMode="continuous"
. The exception is if you are insmpte discontinuous
.Second, you need to know the value of the
timeContainer
attribute on the parent element. By default it ispar
which means that times are computed relative to the parent element's time. If it isseq
then times are computed relative to their siblings, or to the parent for the first child.In your example, let's assume the default of a par timeContainer with a continuous markerMode. Then the computed time of each p is its time added to the begin time of the parent div and clipped by the parent div's end time, giving:
Relating times to playback
The best part of the spec to look at here is probably Appendix N. The interpretation of your computed time values depends on the value of
ttp:timeBase
:clock
means they relate to some real clock somewhere, e.g. a UTC or GPS clock.media
means they relate to the time in some other media like a video file. Time 0 relates to the beginning of the media generally, and if you need to map to frame values then you need to know the frame rate etc.smpte
means they relate to time code in some other media. If you have adiscontinuous
ttp:markerMode
then all times are just event markers: in that case when you see the time code value in the media, you begin or end the content element as needed.Other stuff
I haven't mentioned evaluating the time expressions themselves - there are several syntaxes available including ticks at a tickrate, frames at a framerate, hours minutes and fractions of minutes etc.
Local times are also allowed.
In seq timeContainers siblings cannot overlap in time; in seq timeContainers they can.
It's not required to put times on both the div and the p in the example given. Also you can put times on body and span if you like.