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

MediaElement.SetSource Method (Stream)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Sets the Source property using the supplied stream.

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

public void SetSource(
	Stream stream


Type: System.IO.Stream
A stream that contains a natively supported media source.


The stream is null.

Use this method rather than setting the Source to a URI for cases where you already have the media available as a stream. For instance, you might have preloaded media by calls to WebClient APIs and have them available as streams already.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2018 Microsoft