Represents a media source that delivers media samples directly to the media pipeline.
The MediaStreamSource class has these types of members:
The MediaStreamSource class has these constructors.
|MediaStreamSource(IMediaStreamDescriptor)||Creates an instance of MediaStreamSource from the specified IMediaStreamDescriptor.|
|MediaStreamSource(IMediaStreamDescriptor, IMediaStreamDescriptor)||Creates an instance of MediaStreamSource from two IMediaStreamDescriptor objects.|
The MediaStreamSource class has these events.
|Closed||Occurs when the MediaStreamSource is shutting down.|
|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.|
|SampleRequested||Occurs when the MediaStreamSource request a MediaStreamSample for a specified stream.|
|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||Occurs when the MediaStreamSource will stop requesting MediaStreamSample objects for a certain stream and will start requesting MediaStreamSample objects from a different stream instead.|
The MediaStreamSource class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
|AddProtectionKey||Adds a Digital Rights Management (DRM) protection key which is used by the MediaProtectionManager to encrypt and decrypt the specified stream.|
|AddStreamDescriptor||Adds a new stream descriptor to the MediaStreamSource.|
|NotifyError||Notifies the MediaStreamSource that an error has occurred which is preventing the application from continuing to deliver data to the MediaStreamSource.|
|SetBufferedRange||Sets the range of data that the application is currently buffering.|
The MediaStreamSource class has these properties.
|Read/write||Gets or sets the amount of data that is buffered by the MediaStreamSource.|
|Read/write||Gets or sets whether or not the application supports changing its position in the media time-line.|
|Read/write||Gets or sets the duration of the media time-line.|
|Read/write||Gets or sets the Digital Rights Management (DRM)MediaProtectionManager used to protect the media.|
|Read-only||Gets the music properties which are used for musicrelated metadata.|
|Read/write||Gets or sets the thumbnail which is a reference to a stream for a video thumbnail image or music album art.|
|Read-only||Gets the video properties which are used for video related metadata.|
See the MediaStreamSource Sample for an example of using Media Stream Source in a Windows Store app.
MediaStreamSource is a new generic media source for Windows Store 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 Silverlight API 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.|
The MediaStreamSource uses this event to notify the app that it is ready to start processing media data.
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 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.
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 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.
The MediaStreamSource uses this event to notify the app that it has shut down.
Represents a request from the MediaStreamSource that it has closed.
|MediaElement.SetMediaStreamSource||Sets the source of the MediaElement to a MediaStreamSource.|
Minimum supported client
|Windows 8.1 [Windows Store apps, desktop apps]|
Minimum supported server
|Windows Server 2012 R2 [Windows Store apps, desktop apps]|
Minimum supported phone
|Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]|