共用方式為


Controls.isAvailable

[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 isAvailable property indicates whether a specified type of information is available or a specified action can be performed.

player.controls.isAvailable(
        name
        )

Parameters

name

String containing one of the following values.

String Description
currentItem Determines whether the user can set the currentItem property.
currentMarker Determines whether the user can seek to a specific marker.
currentPosition Determines whether the user can seek to a specific position in the file. Some files do not support seeking.
fastForward Determines whether the file supports fast forwarding and whether that functionality can be invoked. Many file types (or live streams) do not support fastForward.
fastReverse Determines whether the file supports fastReverse and whether that functionality can be invoked. Many file types (or live streams) do not support fastReverse.
next Determines whether the user can seek to the next entry in a playlist.
pause Determines whether the pause method is available.
play Determines whether the play method is available.
previous Determines whether the user can seek to the previous entry in a playlist.
step Determines whether the step method is available during playback.
stop Determines whether the stop method is available.

Return Values

This method returns a Boolean value.

Examples

The following example creates an HTML BUTTON element that seeks to the starting position of the current media item. The JScript code uses isAvailable to verify that the file supports the seek operation. The Player object was created with ID = "Player".

<INPUT TYPE = "BUTTON"  ID = "START"  NAME = "START"  VALUE = "Seek To Zero"

    /* If supported, seek to position zero. */
    onClick = "if (Player.controls.isAvailable('CurrentPosition'))
        Player.controls.currentPosition = 0;
">

Requirements

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

See also

Controls Object