AxWindowsMediaPlayer.currentPlaylist 屬性
[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 它已被 MediaPlayer 取代。 MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議盡可能重寫使用舊版 API 的現有程式碼,以使用新的 API。]
currentPlaylist 屬性會取得或設定目前的 IWMPPlaylist 介面,讓您輕鬆組織及動作清單中的媒體專案。
Syntax
public IWMPPlaylist currentPlaylist {get; set;}
Public Property currentPlaylist As IWMPPlaylist
屬性值
提供目前播放清單存取權的 WMPLib.IWMPPlaylist 介面。
備註
如果 IWMPSettings.autoStart 屬性 (也透過 AxWindowsMediaPlayer.settings 存取。autoStart) 為 true,每當您設定 currentPlaylist時,就會自動開始播放。
此屬性採用 IWMPPlaylist 介面,其可透過數種方式取得,例如從 IWMPPlaylistArray取得值。Item 或 IWMPPlaylistCollection。newPlaylist 屬性。 若要使用檔案名載入 播放清單 專案,請設定 URL 屬性或使用 AxWindowsMediaPlayer。newPlaylist。
範例
下列範例會擷取程式庫中的第一個播放清單,並使用 currentPlaylist 屬性將擷取的播放清單設定為目前的播放清單,並顯示其名稱。 AxWMPLib.AxWindowsMediaPlayer 物件是由名為 player 的變數表示。
// Get an interface to the first playlist from the library.
WMPLib.IWMPPlaylist firstPlaylist = player.playlistCollection.getAll().Item(0);
// Make the retrieved playlist the current playlist.
player.currentPlaylist = firstPlaylist;
// Display the name of the current playlist.
currentPlaylistLabel.Text = ("Found first playlist. Name = " + player.currentPlaylist.name);
' Get an interface to the first playlist from the library.
Dim firstPlaylist As WMPLib.IWMPPlaylist = player.playlistCollection.getAll().Item(0)
' Make the retrieved playlist the current playlist.
player.currentPlaylist = firstPlaylist
' Display the name of the current playlist.
currentPlaylistLabel.Text = ("Found first playlist. Name = " + player.currentPlaylist.name)
規格需求
需求 | 值 |
---|---|
版本 |
Windows 媒體播放機 9 系列或更新版本 |
命名空間 |
AxWMPLib |
組件 |
|
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應