Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MediaElement.SetSource Method (MediaStreamSource)

Silverlight

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,.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft