Media.markerCount

[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]

markerCount 属性检索媒体项中的标记数。

语法

玩家currentMediamarkerCount

可能的值

此属性是只读 Number () 指定文件中的标记数。

备注

如果文件没有标记,或者媒体项与 Player 不同,则此属性返回零。currentMedia

标记编号从 1 开始。

若要检索此属性的值,需要对库的读取访问权限。 有关详细信息,请参阅 库访问

示例

以下 JScript 示例使用 媒体markerCount ,用于检索当前媒体项中的标记数。 然后,该值用作循环结构的上限,循环访问标记列表以检索每个标记名称。 名为 MNAMES 的 HTML TEXTAREA 元素显示当前媒体项中的标记的名称。 创建的 Player 对象 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 marker name to the text area.
   MNAMES.value += Player.currentMedia.getMarkerName(i);
   MNAMES.value += "\n";
}

要求

要求
版本
Windows 媒体播放器版本 7.0 或更高版本。
DLL
Wmp.dll

另请参阅

媒体对象

Player.currentMedia

Settings.mediaAccessRights

Settings.requestMediaAccessRights