共用方式為


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

Syntax

strRetVal = Media.getMarkerName(
  markerNum
)

Parameters

markerNum [in]

Number (long) specifying a marker index.

Return value

This method returns a String.

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.getMarkerName to fill an HTML TEXTAREA element named MNAMES with the names of the markers in the current media item. 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.
if (mcount > 0){

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

   // Print the marker name to the text area.
   MNAMES.value += Player.currentMedia.getMarkerName(i);
   MNAMES.value += "\n";
}

Requirements

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

See also

Media Object

Media.getMarkerTime

Media.markerCount

Settings.mediaAccessRights

Settings.requestMediaAccessRights