Partager via


MediaStreamSource.ReportGetSampleProgress Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Developers call this method in response to GetSampleAsync to inform the MediaElement that it will not return a sample right now, because the MediaStreamSource needs to refill its buffers, and to allow the MediaElement to transition to the Buffering state.

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

Syntax

'Declaration
Protected Sub ReportGetSampleProgress ( _
    bufferingProgress As Double _
)
protected void ReportGetSampleProgress(
    double bufferingProgress
)

Parameters

  • bufferingProgress
    Type: System.Double
    A value between 0 and 1 indicating what percentage of the buffer is filled.

Remarks

This method should only be called if the MediaStreamSource is below the desired buffering level. This method can be called multiple times between GetSampleAsync and ReportGetSampleCompleted; doing so updates the BufferingProgress property on the MediaElement. When buffering is completed, developers must call ReportGetSampleCompleted with the next sample.

For more information, see the “Buffering Management” section in Implementing MediaStream Sources.

StateTransitions: Calling this method allows the MediaElement to transition to the Buffering state, if it is in the Playing state, and will pause rendering. The behavior of the MediaElement is not defined if there are no outstanding GetSampleAsync requests when this method is called.

Platform Notes

Silverlight for the desktop

 Silverlight desktop may transition to Buffering from the Paused state as well. Developers should also report 100% progress prior to exiting buffering.

Silverlight for Windows Phone Silverlight for Windows Phone

 On Windows Phone, the transition to Buffering may not occur immediately if the media pipeline has a sufficient quantity of samples still available to it. Developers do not need to report 100% progress prior to exiting buffering, as completing a sample does this automatically.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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