AxWindowsMediaPlayer.currentPlaylist 属性
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
currentPlaylist 属性获取或设置当前 IWMPPlaylist 接口,该接口提供一种简单的方法来组织和操作列表中的媒体项。
语法
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 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈