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取得值。ItemIWMPPlaylistCollectionnewPlaylist 屬性。 若要使用檔案名載入 播放清單 專案,請設定 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
組件
AxInterop.WMPLib.dll (AxInterop.WMPLib.dll.dll)

另請參閱

AxWindowsMediaPlayer 物件 (VB 和 C#)

AxWindowsMediaPlayer.newPlaylist (VB 和 C#)

AxWindowsMediaPlayer.settings (VB 和 C#)

IWMPPlaylist 介面 (VB 和 C#)

IWMPPlaylistArray.Item (VB 和 C#)

IWMPPlaylistCollection.newPlaylist (VB 和 C#)

IWMPSettings.autoStart (VB 和 C#)