IWMPNetwork::receivedPackets property

The receivedPackets property gets the number of packets received.

Syntax



public System.Int32 receivedPackets {get; set;}

Property value

A System.Int32 that is the number of packets received.

Remarks

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

Examples

The following example uses receivedPackets to display the number of packets received. The information is displayed 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 packets may be arriving.
    switch (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();
            break;

        // If WMPPlayState is Playing or Buffering then set the timer interval and start the timer.
        default:
            timer.Interval = 1000;
            timer.Start();
            break;
    }
}

private void UpdateReceivedPackets(object sender, EventArgs e)
{
    receivedPacketsLabel.Text = ("Packets received: " + player.network.receivedPackets.ToString());
}


Requirements

Version

Windows Media Player 9 Series or later

Namespace

WMPLib

Assembly

Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPNetwork Interface (VB and C#)

 

 

Show: