Partager via


Controls.stop 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 stop method stops playback of the media item.

Syntax

Controls.stop()

Parameters

This method has no parameters.

Return value

This method does not return a value.

Remarks

This method causes Windows Media Player to release any system resources it is using, such as the audio device. The current media item, however, is not released.

When the player is stopped, the track rewinds to the beginning. Calling play will then begin playback of the clip from the beginning. To halt a play operation without changing the current position, use the pause method.

Examples

The following example creates an HTML BUTTON element that uses stop to stop playback. The Player object was created with ID = "Player".

<INPUT TYPE = "BUTTON"  ID = "STOP"  NAME = "STOP"  VALUE = "Stop"
    onClick = "

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

            /* Stop the Player. */
            Player.controls.stop();
">

Requirements

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

See also

Controls Object

Controls.next

Controls.pause

Controls.previous