begin

banner art

Previous Next

begin

The begin attribute specifies the time at which an element becomes active, relative to the start of its parent time container.

Syntax

  begin ::= begin-value-list
  begin-value-list ::= begin-value (";" begin-value-list)?
  begin-value ::= (offset-value | syncbase-value | syncToPrev-value 
                                | event-value | "indefinite")
  offset-value ::= ("+")? Clock-value
  syncbase-value ::= (Id-value "." ("begin" | "end"))("+" Clock-value)?
  Eventsync-value ::= (eventsync-name "." ("begin" | "end"))("+" Clock-value)?
  syncToPrev-value ::= ("prev.begin" | "prev.end") ("+" Clock-value)?
  event-value ::= (event-ref) ("+" Clock-value)?
  Clock-value ::= (Full-clock-value | Partial-clock-value | Timecount-value)
  Full-clock-value ::= Hours ":" Minutes ":" Seconds ("." Fraction)?
  Partial-clock-value ::= Minutes ":" Seconds ("." Fraction)?
  Timecount-value ::= Timecount ("." Fraction)? (Metric)?
  Metric ::= "h" | "min" | "s" |"ms"
  Hours ::= DIGIT
  Minutes ::= 2DIGIT; any range from 00 to 59
  Seconds ::= 2DIGIT: range from 00 to 59
  Fraction ::= DIGIT+
  Timecount ::= DIGIT+
  2DIGIT ::= DIGIT DIGIT
  DIGIT ::= (0-9)

Remarks

All of the values except "indefinite" require that you identify a clock value. For more information, see Attribute Time Formats.

You can also set wallclock values to specify a time and date to start streaming a media item. For more information, see wallclock Value.

The WMS SMIL Playlist Parser plug-in enforces case sensitivity on the begin attribute.

You can assign a semicolon-delimited list of event values to identify multiple times at which the content is played. The event values must correspond to event notices raised by the IWMSPlaylist::FireEvent method. This is illustrated by the following example.

<?wsx version="1.0"?>
<smil>
  <excl >
    <media id="clip_1" src="c:\wmpub\wmroot\Clip_1.wmv" 
        begin="ad1;ad2;ad3" />
  </excl>
</smil>

Also, the end attribute does not work as expected if you have more than one media element in an excl time container. For example, assume that the duration of the first media element in the following playlist is at least 40 seconds. Element m1 should start at the twentieth second and play for 20 more seconds. Instead it plays for 40 seconds. That is, the end attribute acts like a dur attribute.

<?wsx version="1.0"?>
<smil>
  <excl >
    <media id="m1" src="clip1.wmv" begin="20" end="40" />
    <media id="m2" src="clip2.wmv" begin="0"  end="20" />
  </excl>
</smil>

You can work around this by setting the begin attribute on the first media element equal to the end time on the second, and set the end attribute to the desired duration as illustrated in the next example.

<?wsx version="1.0"?>
<smil>
  <excl >
    <media id="m1" src="clip1.wmv" begin="m2.end" end="20" />
    <media id="m2" src="clip2.wmv" begin="0"  end="20" />
  </excl>
</smil>

Example Code

The following example illustrates a playlist that contains an excl time container and four media elements. The elements in the playlist are played in the following order.

  1. Clip_1.wmv starts playing immediately after the time container is created and runs for 30 seconds.
  2. Clip_2.wmv starts playing 5 seconds after Clip_1.wmv ends and runs for only 10 seconds, because Clip_4.wmv interrupts it.
  3. Clip_4.wmv starts 10 seconds after Clip_2.wmv starts and runs for 30 seconds.
  4. Clip_3.wmv begins 2 minutes after the time container starts and plays for 30 seconds. There is a gap of 45 seconds between the end of Clip_4 and the beginning of Clip_3.
<?wsx version="1.0"?>
<smil>
  <excl >
    <media id="c_1" src="c:\wmpub\wmroot\Clip_1.wmv" 
        begin="0s" dur="30s" />
    <media id="c_2" src="c:\wmpub\wmroot\Clip_2.wmv" 
        begin="prev.end+5s" dur="40s" />
    <media id="c_3" src="c:\wmpub\wmroot\Clip_3.wmv" 
        begin="2min" dur = "30s" />
    <media id="c_4" src="c:\wmpub\wmroot\Clip_4.wmv" 
        begin="c_2.begin+10s" dur = "30s" />
  </excl>
</smil>

See Also

Previous Next