.NET Framework Class Library for Silverlight
MediaStreamSource..::.ReportGetSampleCompleted Method

Developers call this method to give the MediaElement a media sample to be rendered.

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

Visual Basic (Declaration)
Protected Sub ReportGetSampleCompleted ( _
    mediaStreamSample As MediaStreamSample _
)
Visual Basic (Usage)
Dim mediaStreamSample As MediaStreamSample

Me.ReportGetSampleCompleted(mediaStreamSample)
C#
protected void ReportGetSampleCompleted(
    MediaStreamSample mediaStreamSample
)

Parameters

mediaStreamSample
Type: System.Windows.Media..::.MediaStreamSample
The description of the media stream that this sample came from. Passing in nullNothingnullptra null reference (Nothing in Visual Basic) indicates that a stream has ended.
Remarks

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 buffering took place before this method was called (by making calls to ReportGetSampleProgress), then the call to this method will transition the BufferingProgress value to 100%.

Calling ReportGetSampleCompleted( null ) will signal to the MediaElement that a stream has ended. After signaling a stream has ended, the MediaElement will start the transition into the Paused or Stopped state.

State Transitions: If buffering took place before this method was called, then the call to this method will cause the MediaElement to transition from the Buffering state to the Playing state. If null was passed in, the MediaElement will start the transition to its final state, either Paused or Stopped.

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Tags :


Community Content

Mark Kestenbaum
Passing null to this method results in NullReferenceException
Everything's working well, but when I reach the end of my data and I want to end it. According to the documentation, I must call this method with a null parameter.

This causes a NullReferenceException to be thrown. What am I doing wrong?

Update: I just realized the problem. If you want to indicate that the stream is ended, you don't pass a null parameter to this method. You pass a MediaStreamSample with a null stream parameter.

The documentation needs to be corrected to reflect this.

Page view tracker