Κοινή χρήση μέσω


Controls.currentPosition

[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 currentPosition property specifies or retrieves the current position in the media item in seconds from the beginning.

player.controls.currentPosition
      

Possible Values

This property is a read/write Number (double).

Examples

The following example uses currentPosition to seek to a position provided by the user. An HTML BUTTON element is created to execute the JScript code. An HTML TEXT input element, named setPosition, was created to accept a value, in seconds, from the user. The Player object was created with ID = "Player".

<INPUT TYPE = "BUTTON"  ID = "Set"  NAME = "Set"  VALUE = "Set Position"

    /* Check to be sure the TEXT element contains a valid value. */
    if (!isNaN(setPosition.value) && (setPosition.value != '))

    /* Set the current position when the user clicks the button. */
    onClick = "Player.controls.currentPosition = setPosition.value;
">

Requirements

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

See also

Controls Object