SmoothStreamingMediaElement.EndPosition Property

Gets or sets the end position.

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

Syntax

'Declaration

Public Property EndPosition As TimeSpan
    Get
    Set
'Usage

Dim instance As SmoothStreamingMediaElement
Dim value As TimeSpan

value = instance.EndPosition

instance.EndPosition = value
public TimeSpan EndPosition { get; set; }
public:
property TimeSpan EndPosition {
    TimeSpan get ();
    void set (TimeSpan value);
}
member EndPosition : TimeSpan with get, set
function get EndPosition () : TimeSpan
function set EndPosition (value : TimeSpan)

Property Value

Type: System.TimeSpan
The end position.

Remarks

For more information, see Events.

Examples

The following example shows a delegate that calculates a new position value from the slider input and the EndPosition property. It reassigns the Position property so that the media stream will resume playing at a new position.

    private void SeekBar_ValueChanged(object sender,
                             RoutedPropertyChangedEventArgs<double> e)
    {
        // Calculate proportion of slider length at current position.
        sliderProportion =  ((Slider)sender).Value/((Slider)sender).Maximum;
        // Get media length in seconds.
        sliderLengthSeconds = SmoothPlayer.EndPosition.TotalSeconds;
        // Calculate position in seconds.
        conversion = sliderProportion * sliderLengthSeconds;
        // Convert seconds to a TimeSpan object.
        tsPositionFromSlider = TimeSpan.FromSeconds(conversion);
        // Assign new position by TimeSpan.
        SmoothPlayer.Position = tsPositionFromSlider;
    }

Version Information

Silverlight

Supported in: 5

Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

See Also

Reference

SmoothStreamingMediaElement Class

Microsoft.Web.Media.SmoothStreaming Namespace