Controls.currentItem

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

currentItem 属性指定或检索当前媒体项。

player.controls.currentItem
      

可能的值

此属性是可读/写 的 Media 对象。

备注

此方法仅适用于 Player 中的项。currentPlaylist。 不支持使用对已保存媒体项的引用调用 currentItem

示例

以下 JScript 示例使用 currentItem 将播放器控件当前媒体项设置为 HTML SELECT 元素中的选定值。 当前播放列表首先使用 PlaylistCollection 指定。getByName创建 ID 为“Player”的 Player 对象。

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

    /* Specify the current item when the selected list value changes. */
    onChange = "Player.controls.currentItem = Player.currentPlaylist.item(playItem.value);">

    /* Fill the SELECT element list with three items that match
       the songs in the playlist. */
    <OPTION VALUE = 0 >Laure
    <OPTION VALUE = 1 >Jeanne
    <OPTION VALUE = 2 >House
</SELECT>

要求

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

另请参阅

Controls 对象

Media 对象

PlaylistCollection.getByName