Export (0) Print
Expand All

MediaElement.SetSource Method (Stream)

Sets the Source property using the supplied stream.

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

public void SetSource(
	Stream stream
)

Parameters

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

ExceptionCondition
ArgumentNullException

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. For details on this technique, see Downloading Content on Demand.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 Passing a generic stream to SetSource(System.IO.Stream) is not supported in Silverlight for Windows Phone. However, the IsolatedStorageFileStream class, which derives from Stream, is suppoted on Silverlight for Windows Phone.

For additional information on using this method, see Media in Silverlight for Windows Phone.

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.

Community Additions

Show:
© 2015 Microsoft