MediaElement.SetSource Method (MediaStreamSource)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
This sets the source of a MediaElement to a subclass of MediaStreamSource.
Assembly: System.Windows (in System.Windows.dll)
Parameters
- mediaStreamSource
- Type: System.Windows.Media.MediaStreamSource
A subclass of MediaStreamSource.
| Exception | Condition |
|---|---|
| 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,.