A timing attribute and its value define the aspects of an element's behavior that relate to time and sequence. For example, the timing value assigned to a begin attribute defines when an element starts playing; while the timing value assigned to a clipEnd attribute defines when a media element ends. If an attribute has no assigned value, the default value is used.
Timing values are specified as either clock values or as events. In cases where a clock value is used, the value can be shown in the following ways (where h is hours, m is minutes, s is seconds and ms is milliseconds):
For more information about clock value time formats, see Time formats.
Timing values that are specified as events consist of the
id attribute value of the trigger element followed by a
period (.) and the attribute of the trigger element on which the
timing is based. For example, a begin attribute value of
Advert1.begin means that an element is set to begin
playing when the media element Advert1 starts.
The following sections describe the supported timing values and their use.
A SyncBase timing value is a value that is based on the timing of another element or on an event. SyncBase timing values can only be used with excl and media elements.
The default SyncBase value is the start of the parent element. The following is an example of an attribute using a SyncBase value. In this case, the begin attribute is dependant upon the end of the Advert1 media element:
An offset timing value refers to the length of time between a
specific event and the time you want to specify. If no event is
specified, the default event that is used for offset timing values
is the SyncBase timing value. For example, given the SyncBase value
in the previous section, an offset timing value of
+30s is equivalent to a value of
The first element in a playlist is indicated with an offset
All of the following examples are valid offset values that result in a delay of 30 seconds from the SyncBase timing value:
end=30s end=+30s end=00:30 end=+00:30
A SyncEvent timing value defines the timing value in relation to
an event. In playlists, events are defined by the syncEvent
attribute. For example, the wrapper playlist element could start
based on a syncEvent attribute in a broadcast playlist. This
timing value is specified using the syncEvent attribute
value in the broadcast playlist followed by a period (.) and either
end. You can also combine a
SyncEvent timing value with an offset timing value for greater
flexibility. SyncEvent timing values can only be used with
media and excl elements.
In the following example, the begin attribute uses a
combination of SyncEvent and offset timing values to indicate a
time of 10 seconds after the start of the element with a
syncEvent attribute named
A SyncToPrev timing value bases the timing of an element on the beginning or end of the element that immediately preceded it. You can also combine a SyncToPrev timing value with an offset timing value for greater flexibility.
In the following example, the begin attribute indicates a time that corresponds to the end of the previous element:
An Event timing value bases the activation of an element on a server event. Typically, a server event is raised by script commands encoded in a broadcast stream. If a broadcast publishing point receives a FIRE_EVENT script command from a live stream, the server searches the playlist for a media element that has a begin attribute value equal to the value associated with the FIRE_EVENT command. If there is a matching media element, that element interrupts the broadcast.
Events can also be raised by a plug-in or by an application based on the Windows Media Services Software Development Kit (SDK). Events can only be used with excl and media elements.
In this example, if the server receives a script command from the broadcast stream with the type FIRE_EVENT and a value of AdEvent, the server interrupts the broadcast and plays the media element that has a begin attribute that matches the FIRE_EVENT value:
An attribute that has a timing value of
is intentionally not defined.
indefinite can be used
with both the repeatCount and repeatDur attributes to
cause the element to repeat until an event occurs to end the
element. In this example, the repeatCount attribute is
specified with an
indefinite value so that the element
will repeat for as long as the publishing point is active:
A wallclock timing value bases the activation of an element on the date and real-world clock time of the Windows Media server. Wallclock timing values can only be used with begin and end attributes of media elements.
In this example, the server plays the media element on July 16th, 2005, at 7:20 PM Coordinated Universal Time (UTC), plus one hour.
begin="wallclock( 2005-07-16T19:20+01:00 )"
Wallclock timing values provide a useful method for automating broadcasts by scheduling programming. In this example, the program (Prog1.wmv) is interrupted for a 30-minute live news feed (News) at 3:59:50 PM local time, which is followed by a promotional video (Promo1).
<media id="Prog1" src="Prog1.wmv" begin="wallclock ( 2005-07-28T15:30-08:00 )"/> <media id="News" src="http://WMEncoder02:8070" begin="wallclock ( 15:59:50 )" end="wallclock( 16:30:00 )" /> <media id="Promo1" src="ad04.wmv" begin="News.end" />
In this example, two pre-recorded commercials (Ad01 and Ad02) interrupt a live broadcast at 2:32:20 PM local time:
<media id="Prog1" src="http://WMEncoder01:8080" begin="0"/> <media id="Ad01" src="ad01.wmv" begin="wallclock( 14:32:20 )" /> <media id="Ad02" src="ad02.wmv" begin="Ad01.end" />
Wallclock time values can be entered in a number of ways, depending on the amount of time information you want to include. A complete wallclock time value consists of the date, time, and time zone offset from UTC, expressed as follows:
( year-month-dayThours:minutes:seconds.decimal+/-hours:minutes )
For example, a media element with the following wallclock timing value will begin on January 13, 2005 at 6:30:30.5 PM, in the Pacific Standard Time (US and Canada) zone:
begin="wallclock( 2005-01-13T18:30:30.5-08:00 )"
The following examples show how the wallclock timing value is used.
|A media element with the following wallclock timing value will begin on January 13, 2006 at 1:12 PM in the local time zone.|
|A media element with the following wallclock timing value will begin on January 13, 2006 at midnight in the local time zone.|
|A media element with the following wallclock timing value will begin today at 8:00 AM in the local time zone.|
|A media element with the following wallclock timing value will begin today at 6:29:20 PM in the Eastern Standard (US and Canada) time zone.|
When the clock on the server automatically adjusts for daylight saving changes, wallclock values may not follow suit. Thus, your scheduled programming may start at an incorrect time. You can avoid this problem by using UTC to specify the real-world clock time in a wallclock timing value. For example:
begin="wallclock( 18:29:20Z )"
A media element with the following wallclock timing value will begin on January 13, 2006 at midnight UTC:
begin="wallclock( 2006-01-13T00:00Z )"
The wallclock value is set when the playlist is loaded into memory. For broadcast publishing points, this occurs when the publishing point is started; for on-demand publishing points, this occurs when a client begins streaming the playlist. Dynamic changes to the playlist, either programmatically or through the Windows Media Playlist Editor, are ignored until the playlist is loaded into memory again.
If a playlist has remained in memory for more than a day, and the wallclock value does not have a date value assigned to it, the playlist must be loaded into memory again before that wallclock value is acknowledged. For example, if a broadcast publishing point references a playlist with a media element set to begin streaming at 12:30 PM, the publishing point must be restarted before 12:30 PM the following day to honor that wallclock value again.