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。 Player物件是以 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 |
|
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應