Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MediaStreamSource.ReportGetSampleCompleted Method

July 28, 2014

Developers call this method in response to GetSampleAsync to give the MediaElement the next media sample to be rendered, or to report the end of a stream.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

protected void ReportGetSampleCompleted(
	MediaStreamSample mediaStreamSample
)

Parameters

mediaStreamSample
Type: System.Windows.Media.MediaStreamSample
The description of the media stream that this sample came from. Passing a MediaStreamSample object with a null Stream property indicates that the stream has ended.

ExceptionCondition
ArgumentException

The MediaStreamSource is not setup for protected playback and the DRMAlgorithmID on the sample is set, then an exception is thrown for all cases except when the DRMAlgorithmID is equal to "Unprotected".

ArgumentException

The MediaStreamSample is not setup for protected playback and the DRMKeyIdentifier on the sample is set, then an exception is thrown for all cases except when the Guid is equal to Guid.Empty.

ArgumentException

The value of the DRMKeyIdentifier attribute in the input MediaStreamSample parameter is set to Guid.Empty.

Or the following conditions are true:

This method should be called after a request to GetSampleAsync unless ErrorOccurred was called instead. ReportGetSampleProgress could be called before this to indicate that a sample is not ready yet but this method must eventually be called.

If the MediaStreamSample contains a valid Stream object, Windows Phone will seek the stream’s pointer to the specified offset. When this method returns, the specified count of bytes will have been read, and the current position of the stream will have advanced past those bytes.

To report the end of a stream, construct a MediaStreamSample object with a null stream and pass it into ReportGetSampleCompleted. Reporting the end of a stream lets the MediaElement know that no additional samples for that stream will be available. Once the MediaElement has rendered all possible samples for all streams, it automatically transition into the Paused or Stopped state and raise a MediaEnded event.

State Transitions: Calling ReportGetSampleCompleted on any stream indicates buffering is complete for the media and retracts permissions to be in the Buffering state. If the MediaElement is in the Buffering state, the call to this method will cause it to transition back to the Playing state.

When ReportGetSampleCompleted returns, the underlying video codec no longer holds any ownership to the memory pointed to by the MediaStreamSample which was passed in. Depending on your implementation, that memory may now be considered ready for recycling or disposal at any point after the call has been made.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft