Partager via


IWMPNetwork::receptionQuality property

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The receptionQuality property gets the percentage of packets not lost in the last 30 seconds.

Syntax

public System.Int32 receptionQuality {get; set;}

Public ReadOnly Property receptionQuality As System.Int32

Property value

A System.Int32 that is the reception quality.

Remarks

The number of packets received, lost, and recovered during streaming is monitored once every second. The receptionQuality property gets the percentage of packets not lost during the last 30 seconds.

Each time playback is stopped and restarted, this property is reset to zero. The value is not reset if playback is paused.

This property gets valid information only during run time when the URL for playback is set by using the AxWindowsMediaPlayer.URL property.

Examples

The following example uses receptionQuality to display the percentage of packets received in a label, in response to the PlayStateChange Event. The example uses a timer with a 1-second interval to update the display. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Add a delegate for the PlayStateChange event.
player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);

// Create an event handler for the PlayStateChange event.
private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
    // Test whether content is playing. 
    if (e.newState == 3)
    {
        // Start the timer. Update the display every 10 seconds.
        timer.Interval = 10000;
        timer.Start();
    }
    else
    {
        // Not playing; stop the timer.
        timer.Stop();
    }
}

private void UpdateReceptionQuality(object sender, EventArgs e)
{
    receptionQualityLabel.Text = ("Packets recovered: " + player.network.receptionQuality.ToString() + "%");
}

' Create an event handler for the PlayStateChange event.
Public Sub player_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles player.PlayStateChange

    ' Test whether packets may be arriving.
    Select Case e.newState

    ' If WMPPlayState is Stopped, Paused, ScanForward, ScanReverse, Waiting, MediaEnded
    ' or Transitioning then stop the timer. 
        Case 1
        Case 2
        Case 4
        Case 5
        Case 7
        Case 8
        Case 9
            timer.Stop()

        ' If WMPPlayState is Playing or Buffering then set the timer interval and start the timer.
        Case Else
            timer.Interval = 1000
            timer.Start()

    End Select

End Sub

Public Sub UpdateReceptionQuality(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick

    receptionQualityLabel.Text = ("Packets recovered: " + player.network.receptionQuality.ToString() + "%")

End Sub

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

AxWindowsMediaPlayer.URL (VB and C#)

IWMPNetwork Interface (VB and C#)