ScheduleClip Method (ClipInformation, TimeSpan, Boolean, Object)

Schedules playing of a media clip.

Namespace:  Microsoft.Web.Media.SmoothStreaming
Assembly:  Microsoft.Web.Media.SmoothStreaming (in Microsoft.Web.Media.SmoothStreaming.dll)

public ClipContext ScheduleClip(
	ClipInformation clipInfo,
	TimeSpan startTime,
	bool pauseTimeline,
	Object userData


Type: Microsoft.Web.Media.SmoothStreaming..::..ClipInformation
A ClipInformation object.
Type: System..::..TimeSpan
The start time.
Type: System..::..Boolean
true to pause the timeline when starting a clip; false to specify that the timeline continues while the clip plays. During on-demand video playback, it is typical to pause; live video sources typically continue the video without pausing.
Type: System..::..Object
An object that can contain any data required by the application, usually including the SmoothStreamingMediaElement object that will play the clip.

The object passed in the userData parameter is saved as the Data member of the ClipContext used by the ScheduleClip(ClipInformation, Boolean, Object) method. The application can pass anything it requires in this parameter. The SmoothStreamingMediaElement object is usually included in userData. Later the data can be cast to type SmoothStreamingMediaElement (for example, (SmoothStreamingMediaElement)clipContext.Data) in order to retrieve the Smooth Player that generated the ClipContext instance. If the application requires more information, it can create a class to contain all the information and then pass that type using the userData parameter.

For more information, see IIS Smooth Streaming Client 1.5 and Scheduling Media Clips (IIS Smooth Streaming).


IIS Smooth Streaming clips scheduled by using ScheduleClip methods require manifests that start at timestamp zero.

Clips can be scheduled to run before or during playback of the media identified by the SmoothStreamingSourceProperty property of the SmoothStreamingMediaElement object. The following example shows how to schedule a media clip to run at the beginning of the playback. This scenario is known as pre-roll scheduling. The startTime parameter is a TimeSpan object set to zero.

    void SmoothPlayer_ManifestReady(object sender, EventArgs e)
        if (!PremiumAccount)
            if (InsertClipCheckbox.IsChecked == true)
                SmoothPlayer.ScheduleClip(clips[1], new TimeSpan(0), false, SmoothPlayer );


Supported in: 4