The peers attribute specifies the behavior of a media element within a priorityClass element when its playback is interrupted by another media element in the same priorityClass (called a peer).
You can assign the following values to the peers attribute.
Value | Description |
pause
|
Specifies that the media element pauses when its playback is interrupted by a peer media element. The interrupted media element resumes playback when the peer ends. |
stop
|
Specifies that the media element stops when its playback is interrupted by a peer media element. Playback does not resume. This is the default value for media elements contained within an excl or priorityClass element. |
defer
|
Specifies that an attempt by a media element to interrupt playback of a peer is deferred. Playback begins when the peer element ends. |
never
|
Specifies that an attempt by a media element to interrupt playback of a peer element is denied. The interrupting element does not play. |
Priority is determined by the order in which priorityClass elements are declared in an excl element. The first priorityClass element in an excl element has the highest priority, and the last priorityClass element has the lowest priority.
A media element will be interrupted if the begin attribute value of another media element is set to start while the first is still playing. You can also interrupt a media element by initiating a server event that triggers the start of another element. Server events can be initiated by using a script command that is embedded in a stream from an encoder or by using the server object model. For more information about server events, see the Windows Media Services Software Development Kit (SDK). For more information about stream switching using script commands, see priorityClass element.
You can also cause one element to interrupt another by using
timing values, such as SyncBase values and offsets. In the
following example, the media element named Program lasts 24
minutes, and Ad1, Ad2, and Ad3 are two-minute commercials. Because
its begin attribute time is set to 0s
, Program
starts when the publishing point starts. After Program plays for
seven minutes, Ad1 interrupts. Because the peers attribute
value of the priorityClass element is pause
,
Program pauses until Ad1 ends. At that point, Program begins
playing again from the point at which it was paused. After Program
has played for 15 minutes and 22 minutes, Ad2 and Ad3 play,
respectively. Note the variety of methods for entering a time
value.
<?wsx version='1.0'?>
<smil>
<excl>
<priorityClass peers="pause">
<media id="Program" src="Pgm.wma" begin="0s"/>
<media id="Ad1" src="Comml1.wma" begin="7min"/>
<media id="Ad2" src="Comml2.wma" begin="program.begin+15min"/>
<media id="Ad3" src="Comml3.wma" begin="00:22:00"/>
</priorityClass>
</excl>
</smil>
The peers attribute value of defer
is used
in the following example. When the playlist starts, the
media element named Clip3.wmv begins playing. The remaining
elements are set to begin one and two seconds after Clip3.wmv
begins. However, because the peers attribute value of the
priorityClass element is defer
, Clip2.wmv
cannot play until Clip3.wmv finishes. Likewise, Clip1.wmv must
waits until both elements finish before it can play.
<?wsx version='1.0'?>
<smil>
<excl>
<priorityClass peers="defer">
<media src="Clip1.wmv" begin="2s"/>
<media src="Clip2.wmv" begin="1s"/>
<media src="Clip3.wmv" begin="0s"/>
</priorityClass>
</excl>
</smil>
The peers attribute can be specified for the following playlist element:
Notes