end

banner art

Previous Next

end

The end attribute specifies the time at which a media element stops playing, relative to the start of its parent time container.

Syntax

end ::= end-value-list
  end-value-list ::= end-value (";" end-value-list)?
  end-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+; any positive number
  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 stop streaming a media item. For more information, see wallclock Value.

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

You can specify a list of event values that identify multiple rules for ending a media element. That is, you can use a list to indicate that the element must stop playing if one of several events is raised. 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" 
        end="end1;end2;end3" />
  </excl>
</smil>

You can use the end element to constrain the active duration of a media element, and you can use the dur element to control simple duration. The simple duration is the basic length of the element. The simple duration combined with the effect of any repeats defines the active duration.

If you specify both a dur and an end attribute, and the value assigned to dur is greater than that assigned to end, the end attribute is used. If the dur attribute is not specified, and the simple duration is less than the value assigned to end, the stream stops when its duration is finished.

However, the end attribute functions like a dur attribute 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. This is illustrated by the following example.

<?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 following 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>
  • Note   The SMIL 2.0 repeat, access key, media marker, and wall clock values are not supported. Negative offsets are not supported.

Example Code

In the following example, the video Clip_1.wmv is played for 10 seconds. If the simple duration of the clip is less than 10 seconds, the clip ends when its duration ends.

<?wsx version="1.0"?>
<smil>
    <media src="c:\wmpub\wmroot\Clip_1.wmv" end="10s" />
</smil>

In the next example, Clip_1.wmv ends after 10 seconds or at the end of the media element with which "eventSync" is associated, whichever comes first. You can send synchronization events by using the syncEvent attribute. This attribute is applicable only to a broadcast publishing point. When an element with this attribute becomes active, the server sends the associated event to all of the client wrapper playlist objects.

<?wsx version="1.0"?>
<smil>
    <media src="c:\wmpub\wmroot\Clip_1.wmv" dur="2s" repeatDur="10s"
        end="eventSync.end" />
</smil>

In the following example, the active duration of Clip1.wmv ends after 10 seconds. The active duration identified by the end attribute takes precedence over the simple duration of 20 seconds identified by the dur attribute.

<?wsx version="1.0"?>
<smil>
    <media src="c:\wmpub\wmroot\Clip_1.wmv" dur="20s" end="10s" />
</smil>
  • Note   For more information about the SMIL 2.0 Specification, W3C Recommendation, see the W3C Web site.

Web addresses can change, so you might be unable to connect to the Web site or sites mentioned here.

See Also

Previous Next