Media Source Stream
Media Source Stream
Media Source Stream
Media Source Stream
Represents a media source that delivers media samples directly to the media pipeline.
public : sealed class MediaStreamSource : IMediaSource, IMediaStreamSource, IMediaStreamSource2, IMediaStreamSource3, IMediaStreamSource4
struct winrt::Windows::Media::Core::MediaStreamSource : IMediaSource, IMediaStreamSource, IMediaStreamSource2, IMediaStreamSource3, IMediaStreamSource4
public sealed class MediaStreamSource : IMediaSource, IMediaStreamSource, IMediaStreamSource2, IMediaStreamSource3, IMediaStreamSource4
Public NotInheritable Class MediaStreamSource Implements IMediaSource, IMediaStreamSource, IMediaStreamSource2, IMediaStreamSource3, IMediaStreamSource4
var mediaStreamSource = new mediaStreamSource(descriptor);
Windows 10 (introduced v10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced v1)
See the MediaStreamSource Sample for an example of using Media Stream Source in a UWP app.
MediaStreamSource is a new generic media source for UWP apps which is introduced in Windows 8.1. MediaStreamSource allows apps to send compressed or uncompressed audio and video samples to the media pipeline for playback, transcoding, and streaming. Media samples can be dynamically generated by the app, or de-multiplexed from a stream or files. This flexibility enables apps to more easily extend platform support for new media formats or solve complex problems, such as adaptive streaming.
The MediaStreamSource API are very similar to the Microsoft SilverlightAPI of the same name.
The MediaStreamSource Sample demonstrates how to use the MediaStreamSource. Here are some of the main MediaStreamSource API. The order outlines the basic flow of how MediaStreamSource functions. You'll notice that the MediaStreamSource sends request objects to the app through event arguments. These request objects enable the app to interact with the MediaStreamSource and pass data back to it.
|MediaStreamSource||Represents a media source that delivers media samples directly to the media pipeline. MediaStreamSource consumes MediaStreamSample objects that are provided by the application.|
|MediaStreamSample||Represents a media sample used by the MediaStreamSource.|
|MediaStreamSource.Starting (event)||The MediaStreamSource uses this event to notify the app that it is ready to start processing media data.|
|MediaStreamSourceStartingRequest||Represents a request from the MediaStreamSource that it is ready to start processing media data. Apps should reply as soon as possible to this request by calling SetActualStartPosition on the request. If an app needs to delay the MediaStreamSource from processing data, it can get an asynchronous deferral from MediaStreamSourceStartingRequest.GetDeferral. When the app is ready for the MediaStreamSource to start, it calls Complete on the deferral object. The starting request is accessed through the MediaStreamSourceStartingEventArgs that are passed to the MediaStreamSource.Starting event handler.|
|MediaStreamSource.SampleRequested (event)||The MediaStreamSource uses this event to notify the app that it is ready for a MediaStreamSample. Apps are required to register a handler for this event.|
|MediaStreamSourceSampleRequest||Represents a request from the MediaStreamSource for a new media sample. Setting the Sample property to the new MediaStreamSample triggers the MediaStreamSource to retrieve the media sample and continue processing the media data. Apps should reply as soon as possible to this request. If an app needs time before sending the MediaStreamSample, it can get an asynchronous deferral from MediaStreamSourceSampleRequest.GetDeferral. When the app is finished with the deferral, it calls Complete on the deferral object. The sample request is accessed through the MediaStreamSourceSampleRequestedEventArgs that are passed to the MediaStreamSource.SampleRequest event handler. The app indicates it has reached the end of the stream by responding to a MediaStreamSourceSampleRequest without providing a MediaStreamSample, or by assigning the MediaStreamSourceSampleRequest.Sample property to null.|
|MediaStreamSource.Closed (event)||The MediaStreamSource uses this event to notify the app that it has shut down.|
|MediaStreamSourceClosedRequest||Represents a request from the MediaStreamSource that it has closed. The close request is accessed through the MediaStreamSourceClosedEventArgs that are passed to the MediaStreamSource.Closed event handler.|
|MediaElement.SetMediaStreamSource||Sets the source of the MediaElement to a MediaStreamSource.|
|BufferTime BufferTime BufferTime BufferTime BufferTime||
Gets or sets the amount of data that is buffered by the MediaStreamSource.
|CanSeek CanSeek CanSeek CanSeek CanSeek||
Gets or sets whether or not the application supports changing its position in the media time-line.
|Duration Duration Duration Duration Duration||
Gets or sets the duration of the media time-line.
|IsLive IsLive IsLive IsLive IsLive||
Gets or sets a value indicating whether the media content being processed is live.
|MaxSupportedPlaybackRate MaxSupportedPlaybackRate MaxSupportedPlaybackRate MaxSupportedPlaybackRate MaxSupportedPlaybackRate||
Gets the maxiumum supported playback rate for the MediaStreamSource.
|MediaProtectionManager MediaProtectionManager MediaProtectionManager MediaProtectionManager MediaProtectionManager||
Gets or sets the Digital Rights Management (DRM)MediaProtectionManager used to protect the media.
|MusicProperties MusicProperties MusicProperties MusicProperties MusicProperties||
Gets the music properties which are used for music-related metadata.
|Thumbnail Thumbnail Thumbnail Thumbnail Thumbnail||
Gets or sets the thumbnail which is a reference to a stream for a video thumbnail image or music album art.
|VideoProperties VideoProperties VideoProperties VideoProperties VideoProperties||
Gets the video properties which are used for video related metadata.
|Closed Closed Closed Closed Closed||
Occurs when the MediaStreamSource is shutting down.
|Paused Paused Paused Paused Paused||
Occurs when the MediaStreamSource is paused and stops requesting MediaStreamSample objects for an unspecified period of time, but is expected to resume requesting MediaStreamSample objects from the current position.
|SampleRendered SampleRendered SampleRendered SampleRendered SampleRendered||
Occurs when a sample from the MediaStreamSource is rendered.
|SampleRequested SampleRequested SampleRequested SampleRequested SampleRequested|
|Starting Starting Starting Starting Starting||
Occurs when the MediaStreamSource is ready to start requesting MediaStreamSample objects. The event can specify a position in the media time-line from which the first MediaStreamSample should be delivered.
|SwitchStreamsRequested SwitchStreamsRequested SwitchStreamsRequested SwitchStreamsRequested SwitchStreamsRequested|