在 C# 中如何判断播放列表是否是音乐播放列表?
到目前为止,我已经附加了我的代码,我的问题是所有播放列表都为其类型返回“auto”或“wpl”。 (这全部使用 WMPLib 参考)
mediaplayer = new WindowsMediaPlayer();
// Init. Playlists
IWMPPlaylistCollection plcollection = mediaplayer.playlistCollection;
plarray = plcollection.getAll();
int i = 0, count = plarray.count;
string[] t = new string[count];
// Here is where I want to sort out non-music playlists
// And add them to the ListBox
for (i = 0; i < count - 1; i++)
t[i] = plarray.Item(i).getItemInfo("PlaylistType");
for (i = 0; i < count; i++ )
PlaylistBox.Items.Add("" + plarray.Item(i).name);
不相关,但如果您知道如何将播放列表附加为数据而不是字符串,那也会很有帮助:)
I've attached my code so far, my problem is all the playlists return "auto" or "wpl" for their type. (This is all using a WMPLib reference)
mediaplayer = new WindowsMediaPlayer();
// Init. Playlists
IWMPPlaylistCollection plcollection = mediaplayer.playlistCollection;
plarray = plcollection.getAll();
int i = 0, count = plarray.count;
string[] t = new string[count];
// Here is where I want to sort out non-music playlists
// And add them to the ListBox
for (i = 0; i < count - 1; i++)
t[i] = plarray.Item(i).getItemInfo("PlaylistType");
for (i = 0; i < count; i++ )
PlaylistBox.Items.Add("" + plarray.Item(i).name);
Unrelated, but if you know how to attach the playlists as data instead of strings that would be helpful too :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您可以迭代播放列表项目,如果项目的“MediaType”属性等于“音频”,则认为此列表包含音频文件。像这样:
这是你如何使用它:
希望这有帮助,问候
I guess you can iterate through playlist items and if item's "MediaType" attribute equals "audio" deem this list as the one containing audio files. Smth like this:
here's how you can use it:
hope this helps, regards