MediaStreamSourceSampleRequest MediaStreamSourceSampleRequest MediaStreamSourceSampleRequest MediaStreamSourceSampleRequest Class


Represents an object to be used by the MediaStreamSource.SampleRequest event to provide information to the application.

public : sealed class MediaStreamSourceSampleRequest : IMediaStreamSourceSampleRequestpublic sealed class MediaStreamSourceSampleRequest : IMediaStreamSourceSampleRequestPublic NotInheritable Class MediaStreamSourceSampleRequest Implements IMediaStreamSourceSampleRequest// You can use this class in JavaScript.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


See the MediaStreamSource Sample for an example of using Media Stream Source in a Windows Store app.


Sample Sample Sample Sample

Sets the MediaStreamSample requested by the MediaStreamSource. Applications deliver a MediaStreamSample to the MediaStreamSource by assigning a value to this property.

public : MediaStreamSample Sample { get; set; }public MediaStreamSample Sample { get; set; }Public ReadWrite Property Sample As MediaStreamSample// You can use this property in JavaScript.
MediaStreamSample MediaStreamSample MediaStreamSample MediaStreamSample

The sample which is delivered to the MediaStreamSource when this property is set. The default value is null.


The initial value of this property is null.

The application should allocate a MediaStreamSample and deliver it to the MediaStreamSource by assigning the MediaStreamSample to this property.

If there are no more MediaStreamSamples to deliver to the stream identified by the StreamDescriptor property because the end of the stream has been reached, then the application should set the Sample property to null.

If the application needs to perform an asynchronous operation to retrieve the MediaStreamSample, it should invoke the GetDeferral method to indicate that the assignment of the Sample property has been deferred.

If a MediaStreamSample is not currently available, for example, because it has not yet been downloaded from a server, the application should call GetDeferral and also call ReportSampleProgress on as the necessary data is being downloaded.

The recommended interval between each invocation of ReportSampleProgress is 500 milliseconds.

StreamDescriptor StreamDescriptor StreamDescriptor StreamDescriptor

Gets the IMediaStreamDescriptor interface of the stream for which a MediaStreamSample is being requested.

public : IMediaStreamDescriptor StreamDescriptor { get; }public IMediaStreamDescriptor StreamDescriptor { get; }Public ReadOnly Property StreamDescriptor As IMediaStreamDescriptor// You can use this property in JavaScript.


The Sample property of the MediaStreamSourceSampleRequest object should be assigned a MediaStreamSample belonging to the stream identified by the StreamDescriptor property.


GetDeferral() GetDeferral() GetDeferral() GetDeferral()

Defers assigning a MediaStreamSample to MediaStreamSourceSampleRequest object.

public : MediaStreamSourceSampleRequestDeferral GetDeferral()public MediaStreamSourceSampleRequestDeferral GetDeferral()Public Function GetDeferral() As MediaStreamSourceSampleRequestDeferral// You can use this method in JavaScript.


You can use a deferral when you want to make an asynchronous call to retrieve the MediaStreamSample. The MediaStreamSource will then wait for you to supply the MediaStreamSample until you mark the deferral as complete.

To create a deferral, call the GetDeferral method to instruct the MediaStreamSource to wait for the MediaStreamSample. After you have assigned the MediaStreamSample to the Sample property of the MediaStreamSourceSampleRequest object, call the MediaStreamSourceSampleRequestDeferral.Complete method to end the deferral.

ReportSampleProgress(UInt32) ReportSampleProgress(UInt32) ReportSampleProgress(UInt32) ReportSampleProgress(UInt32)

Provides a status update to the MediaStreamSource while the application is temporarily unable to deliver a requested MediaStreamSample.

public : void ReportSampleProgress(unsigned int progress)public void ReportSampleProgress(UInt32 progress)Public Function ReportSampleProgress(progress As UInt32) As void// You can use this method in JavaScript.
unsigned int UInt32 UInt32 UInt32

A value between 0 to 100 that indicates the progress towards being able to deliver the requested MediaStreamSample.


The application should invoke this method when it is unable to immediately to deliver the MediaStreamSample, which is accomplished by assigning it to the Sample property. The application should continue to invoke ReportSampleProgress on a regular basis until it is able to deliver the requested MediaStreamSample.

The recommended interval between each invocation of ReportSampleProgress is 500 milliseconds.

See Also