Partager via


Controls.play method

[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 play method causes the current media item to start playing, or resumes play of a paused item.

Syntax

Controls.play()

Parameters

This method has no parameters.

Return value

This method does not return a value.

Remarks

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

Examples

The following example creates an HTML BUTTON element that uses play to play the current media item. The Player object was created with ID = "Player".

<INPUT TYPE = "BUTTON"  ID = "PLAY"  NAME = "PLAY"  VALUE = "Play"
    onClick = "

        /* Check first to be sure the operation is valid. */
        if (Player.controls.isAvailable('Play'))

            /* Start playback. */
            Player.controls.play();
">

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Controls Object