Share via


AxWindowsMediaPlayer.playState 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 playState property gets an enumeration value indicating the state of the Windows Media Player operation.

This property is read-only.

Syntax

public WMPPlayState playState {get;}

Public ReadOnly Property playState As WMPPlayState

Property value

The WMPLib.WMPPlayState enumeration value.

Remarks

Windows Media Player states are not guaranteed to occur in any particular order. Furthermore, not every state necessarily occurs during a sequence of events. You should not write code that relies upon state order.

Examples

The following example uses the playState property to display the current playing status of the player in a label. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Test whether Windows Media Player is in the playing state. 
if (player.playState == WMPLib.WMPPlayState.wmppsPlaying)
{
    playStateLabel.Text = "Windows Media Player is playing!";
}
else
{
    playStateLabel.Text = "Windows Media Player is NOT playing!";
}

' Test whether Windows Media Player is in the playing state. 
If (player.playState = WMPLib.WMPPlayState.wmppsPlaying) Then

    playStateLabel.Text = "Windows Media Player is playing!"

Else

    playStateLabel.Text = "Windows Media Player is NOT playing!"

End If

Requirements

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

See also

AxWindowsMediaPlayer Object (VB and C#)

AxWindowsMediaPlayer.PlayStateChange Event (VB and C#)

WMPPlayState