Freigeben über


Media.getMarkerTime 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 getMarkerTime method retrieves the time of the marker at the specified index.

Syntax

retVal = Media.getMarkerTime(
  markerNum
)

Parameters

markerNum [in]

Number (long) specifying the marker index.

Return value

This method returns a Number (double) specifying the location of the marker in seconds from the beginning of the clip.

Remarks

This method returns NULL if the specified marker does not exist.

Some digital media items do not contain markers. Use markerCount to find out how many markers are in the current clip.

Marker index numbers start at 1.

To use this method, read access to the library is required. For more information, see Library Access.

Examples

The following JScript example uses Media.getMarkerTime to fill an HTML TEXTAREA element named MTIMES with the location of each marker. The Player object was created with ID = "Player".

// Get the number of markers in the current media item.
var mcount = Player.currentMedia.markerCount;

// Verify that at least one marker exists in the current media item.
if (mcount > 0){

// Loop through the marker list.
for (var i = 1;i < mcount + 1; i++){

   // Print the message to the text area.
   MTIMES.value += "Marker number " + i + " occurs at ";
   MTIMES.value += Player.currentMedia.getMarkerTime(i);
   MTIMES.value += " second(s).";
   MTIMES.value += "\n";
}

Requirements

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

See also

Media Object

Media.getMarkerName

Media.markerCount

Settings.mediaAccessRights

Settings.requestMediaAccessRights