Windows Media Player 11 SDK IWMPControls.play (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPControls.play (VB and C#)

The play method begins playback of the current media item, or resumes playback of a paused item.

  

Parameters

This method takes no parameters.

Return Value

This method does not return a value.

Remarks

If this method is called while fast-forwarding or rewinding, the rate of playback (the value of IWMPSettings.rate) is set to 1.0.

Example Code

The following example uses play to play the current media item in response to the Click event of a button. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
Public Sub playButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles playButton.Click

    ' To get all of the available functionality of the player controls, Dim the
    ' value returned by player.Ctlcontrols as a WMPLib.IWMPControls3 interface.
    Dim controls As WMPLib.IWMPControls3 = player.Ctlcontrols

    ' Check first to be sure the operation is valid. 
    If (controls.isAvailable("play")) Then

        controls.play()

    End If

End Sub

FakePre-0c197d37fe004f88a640b7b5fd0f07d6-b748727dd89b474dad6a9769486ba5c4

private void playButton_Click(object o, System.EventArgs args)
{
    // To get all of the available functionality of the player controls, cast the
    // value returned by player.Ctlcontrols to a WMPLib.IWMPControls3 interface. 
    WMPLib.IWMPControls3 controls = (WMPLib.IWMPControls3)player.Ctlcontrols;

    // Check first to be sure the operation is valid. 
    if (controls.get_isAvailable("play"))
    {
        controls.play();
    }
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next