Windows Dev Center

MediaElement.SetSource Method (MediaStreamSource)

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

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

public void SetSource(
	MediaStreamSource 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 null before detaching the MediaElement from the UI tree,.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft