共用方式為


Controls.currentMarker

[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 currentMarker property specifies or retrieves the current marker number.

player.controls.currentMarker
      

Possible Values

This property is a read/write Number (long) with a default value of zero.

Remarks

Setting currentMarker causes playback to start from the specified marker. Before attempting to set currentMarker, determine whether a file has markers and how many it has by using markerCount. If a file has no markers, setting currentMarker to anything but zero results in an error. Setting currentMarker to a number higher than markerCount also results in an error.

The currentMarker property always returns the current or last marker, which means the actual file position can be either at the current marker or before the next marker. Markers are numbered beginning at 1, so if a file has markers, you can set currentMarker to zero to change the file position to zero.

Until the current media item is set (using Player.URL or Player.currentMedia), currentMarker returns zero.

Examples

The following JScript example uses currentMarker to start video playback from the marker that corresponds to the selectedIndex property of an HTML SELECT element. The Player object was created with ID = "Player".

<SELECT ID = "markers"  NAME = "markers"  LANGUAGE = "JScript"

    /* Seek to the marker number that corresponds to the SELECT element
       selectedIndex value when the list selection changes. */
    onChange = "Player.controls.currentMarker = markers.selectedIndex + 1;
">

    /* Fill the SELECT element with the marker identifiers. */
    <OPTION SELECTED>Sunrise
    <OPTION>Car chase 
    <OPTION>Happy ending
</SELECT>

Requirements

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

See also

Controls Object

Media.markerCount

Player.currentMedia

Player.URL