MediaElement.SetSource Method (MediaStreamSource)

May 11, 2014

This sets the source of a MediaElement to a subclass of MediaStreamSource.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

'Declaration
Public Sub SetSource ( _
	mediaStreamSource As MediaStreamSource _
)

Parameters

mediaStreamSource
Type: System.Windows.Media.MediaStreamSource
A subclass of MediaStreamSource.

ExceptionCondition
ArgumentNullException

The mediaStreamSource is null.

InvalidOperationException

The specified mediaStreamSource is invalid, or does not exist.

After calling this method, MediaElement.Source returns null. If this is called and MediaElement.Source is set, the last operation wins.

If a MediaElement is removed from the UI tree while is has an opened MediaStreamSource, subsequent calls to SetSource may be ignored. To ensure featureSetSource calls will work, set the Source property to Nothing before detaching the MediaElement from the UI tree,.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft