SetSource Method (MediaStreamSource)
Collapse the table of content
Expand the table of content

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.

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

Public Sub SetSource ( _
	mediaStreamSource As MediaStreamSource _


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


The mediaStreamSource is null.


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

© 2016 Microsoft