MediaSource Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a media source. Provides a common way to reference media from different sources and exposes a common model for accessing media data regardless of the underlying media format.
public ref class MediaSource sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class MediaSource final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class MediaSource : System.IDisposable
Public NotInheritable Class MediaSource
Implements IDisposable
- Inheritance
- Attributes
- Implements
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Remarks
Using one of the factory methods, you can create an instance of MediaSource from many different media source representations, including:
- AdaptiveMediaSource
- MediaStreamSource
- MseStreamSource
- IStorageFile
- IRandomAccessStream
- IRandomAccessStreamReference
- Uri
After getting a MediaSource instance, create a new MediaPlaybackItem wrapping the media source and pass the MediaPlaybackItem to one of the media playback objects, such as MediaPlayer or MediaElement.
For how-to guidance for using MediaSource to play back media, see Media items, playlists, and tracks.
Version history
Windows version | SDK version | Value added |
---|---|---|
1511 | 10586 | CreateFromMediaBinder |
1511 | 10586 | Reset |
1511 | 10586 | State |
1511 | 10586 | StateChanged |
1703 | 15063 | AdaptiveMediaSource |
1703 | 15063 | MediaStreamSource |
1703 | 15063 | MseStreamSource |
1703 | 15063 | OpenAsync |
1703 | 15063 | Uri |
1709 | 16299 | CreateFromMediaFrameSource |
1803 | 17134 | CreateFromDownloadOperation |
1803 | 17134 | DownloadOperation |
Properties
AdaptiveMediaSource |
Gets the AdaptiveMediaSource associated with the MediaSource. |
CustomProperties |
Gets a set of properties that can be used to associate app-specific data with a MediaSource. |
DownloadOperation |
Retrieves the DownloadOperation with which the MediaSource is associated |
Duration |
Gets the duration of the content in the MediaSource. |
ExternalTimedMetadataTracks |
A collection of external timed metadata tracks associated with the MediaSource. |
ExternalTimedTextSources |
A collection of external timed text sources associated with the MediaSource. |
IsOpen |
Gets a value indicating whether the media source is currently open. |
MediaStreamSource |
Gets the MediaStreamSource associated with the MediaSource. |
MseStreamSource |
Gets the MseStreamSource associated with the MediaSource. |
State |
Gets the current state of the MediaSource. |
Uri |
Gets the URI associated with the MediaSource. |
Methods
Events
OpenOperationCompleted |
Occurs when a MediaSource open operation completes. |
StateChanged |
Occurs when the current state of the MediaSource changes. |