MediaSource Class
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
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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.
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 |
Adaptive |
Gets the AdaptiveMediaSource associated with the MediaSource. |
Custom |
Gets a set of properties that can be used to associate app-specific data with a MediaSource. |
Download |
Retrieves the DownloadOperation with which the MediaSource is associated |
Duration |
Gets the duration of the content in the MediaSource. |
External |
A collection of external timed metadata tracks associated with the MediaSource. |
External |
A collection of external timed text sources associated with the MediaSource. |
Is |
Gets a value indicating whether the media source is currently open. |
Media |
Gets the MediaStreamSource associated with the MediaSource. |
Mse |
Gets the MseStreamSource associated with the MediaSource. |
State |
Gets the current state of the MediaSource. |
Uri |
Gets the URI associated with the MediaSource. |
Open |
Occurs when a MediaSource open operation completes. |
State |
Occurs when the current state of the MediaSource changes. |
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |