MediaSource MediaSource MediaSource MediaSource MediaSource Class

Definition

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 : sealed class MediaSource : IClosable, IMediaSource2, IMediaSource3, IMediaSource4, IMediaSource5, IMediaPlaybackSource
struct winrt::Windows::Media::Core::MediaSource : IClosable, IMediaSource2, IMediaSource3, IMediaSource4, IMediaSource5, IMediaPlaybackSource
public sealed class MediaSource : IDisposable, IMediaSource2, IMediaSource3, IMediaSource4, IMediaSource5, IMediaPlaybackSource
Public NotInheritable Class MediaSource Implements IDisposable, IMediaSource2, IMediaSource3, IMediaSource4, IMediaSource5, IMediaPlaybackSource
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Using one of the factory methods, you can create an instance of MediaSource from many different media source representations, including:

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.

Properties

AdaptiveMediaSource AdaptiveMediaSource AdaptiveMediaSource AdaptiveMediaSource AdaptiveMediaSource

Gets the AdaptiveMediaSource associated with the MediaSource.

CustomProperties CustomProperties CustomProperties CustomProperties CustomProperties

Gets a set of properties that can be used to associate app-specific data with a MediaSource.

DownloadOperation DownloadOperation DownloadOperation DownloadOperation DownloadOperation

Retrieves the DownloadOperation with which the MediaSource is associated

Duration Duration Duration Duration Duration

Gets the duration of the content in the MediaSource.

ExternalTimedMetadataTracks ExternalTimedMetadataTracks ExternalTimedMetadataTracks ExternalTimedMetadataTracks ExternalTimedMetadataTracks

A collection of external timed metadata tracks associated with the MediaSource.

ExternalTimedTextSources ExternalTimedTextSources ExternalTimedTextSources ExternalTimedTextSources ExternalTimedTextSources

A collection of external timed text sources associated with the MediaSource.

IsOpen IsOpen IsOpen IsOpen IsOpen

Gets a value indicating whether the media source is currently open.

MediaStreamSource MediaStreamSource MediaStreamSource MediaStreamSource MediaStreamSource

Gets the MediaStreamSource associated with the MediaSource.

MseStreamSource MseStreamSource MseStreamSource MseStreamSource MseStreamSource

Gets the MseStreamSource associated with the MediaSource.

State State State State State

Gets the current state of the MediaSource.

Uri Uri Uri Uri Uri

Gets the URI associated with the MediaSource.

Methods

Close() Close() Close() Close() Close()

Closes the MediaSource.

CreateFromAdaptiveMediaSource(AdaptiveMediaSource) CreateFromAdaptiveMediaSource(AdaptiveMediaSource) CreateFromAdaptiveMediaSource(AdaptiveMediaSource) CreateFromAdaptiveMediaSource(AdaptiveMediaSource) CreateFromAdaptiveMediaSource(AdaptiveMediaSource)

Creates an instance of MediaSource from the provided AdaptiveMediaSource.

CreateFromDownloadOperation(DownloadOperation) CreateFromDownloadOperation(DownloadOperation) CreateFromDownloadOperation(DownloadOperation) CreateFromDownloadOperation(DownloadOperation) CreateFromDownloadOperation(DownloadOperation)

Creates an instance of MediaSource from the provided DownloadOperation.

CreateFromIMediaSource(IMediaSource) CreateFromIMediaSource(IMediaSource) CreateFromIMediaSource(IMediaSource) CreateFromIMediaSource(IMediaSource) CreateFromIMediaSource(IMediaSource)

Creates an instance of MediaSource from the provided IMediaSource.

CreateFromMediaBinder(MediaBinder) CreateFromMediaBinder(MediaBinder) CreateFromMediaBinder(MediaBinder) CreateFromMediaBinder(MediaBinder) CreateFromMediaBinder(MediaBinder)

Creates an instance of MediaSource from the provided MediaBinder.

CreateFromMediaFrameSource(MediaFrameSource) CreateFromMediaFrameSource(MediaFrameSource) CreateFromMediaFrameSource(MediaFrameSource) CreateFromMediaFrameSource(MediaFrameSource) CreateFromMediaFrameSource(MediaFrameSource)

Creates an instance of MediaSource from the provided AdaptiveMediaSource.

CreateFromMediaStreamSource(MediaStreamSource) CreateFromMediaStreamSource(MediaStreamSource) CreateFromMediaStreamSource(MediaStreamSource) CreateFromMediaStreamSource(MediaStreamSource) CreateFromMediaStreamSource(MediaStreamSource)

Creates an instance of MediaSource from the provided MediaStreamSource.

CreateFromMseStreamSource(MseStreamSource) CreateFromMseStreamSource(MseStreamSource) CreateFromMseStreamSource(MseStreamSource) CreateFromMseStreamSource(MseStreamSource) CreateFromMseStreamSource(MseStreamSource)

Creates an instance of MediaSource from the provided MseStreamSource.

CreateFromStorageFile(IStorageFile) CreateFromStorageFile(IStorageFile) CreateFromStorageFile(IStorageFile) CreateFromStorageFile(IStorageFile) CreateFromStorageFile(IStorageFile)

Creates an instance of MediaSource from the provided IStorageFile.

CreateFromStream(IRandomAccessStream, String) CreateFromStream(IRandomAccessStream, String) CreateFromStream(IRandomAccessStream, String) CreateFromStream(IRandomAccessStream, String) CreateFromStream(IRandomAccessStream, String)

Creates an instance of MediaSource from the provided IRandomAccessStream.

CreateFromStreamReference(IRandomAccessStreamReference, String) CreateFromStreamReference(IRandomAccessStreamReference, String) CreateFromStreamReference(IRandomAccessStreamReference, String) CreateFromStreamReference(IRandomAccessStreamReference, String) CreateFromStreamReference(IRandomAccessStreamReference, String)

Creates an instance of MediaSource from the provided IRandomAccessStreamReference.

CreateFromUri(Uri) CreateFromUri(Uri) CreateFromUri(Uri) CreateFromUri(Uri) CreateFromUri(Uri)

Creates an instance of MediaSource from the provided Uri.

Dispose() Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

OpenAsync() OpenAsync() OpenAsync() OpenAsync() OpenAsync()

opens the backing data source for the MediaSource and reads the metadata and track information.

Reset() Reset() Reset() Reset() Reset()

Resets the internal state of the MediaSource.

Events

OpenOperationCompleted OpenOperationCompleted OpenOperationCompleted OpenOperationCompleted OpenOperationCompleted

Occurs when a MediaSource open operation completes.

StateChanged StateChanged StateChanged StateChanged StateChanged

Occurs when the current state of the MediaSource changes.

See Also