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來指定。getByNamePlayer物件是以 ID = 「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 物件

媒體物件

PlaylistCollection.getByName