gpt4 book ai didi

c# - C#检测音乐文件何时停止在WMPLib中播放

转载 作者:行者123 更新时间:2023-12-03 00:42:11 24 4
gpt4 key购买 nike

我需要知道音乐文件何时停止播放才能播放我制作的播放列表字符串数组中的下一首歌曲。

我使用WMPLib,这是我的代码来播放歌曲:

https://gyazo.com/993d8ea2dff20316f6c98ff88ab57394
+ under a button event I use
PlayFile(@playlist [0]);`

我也意识到我有内存泄漏,所以如果有人碰巧也知道修复每首很棒的歌曲的代码。

最佳答案

一种解决方案是立即为Windows Media Player提供整个播放列表,因此您不必担心。请引用How to add multiple files to a playlist。另一方面,您已经订阅了PlayStateChange事件。 https://msdn.microsoft.com/en-us/library/windows/desktop/dd562460%28v=vs.85%29.aspx描述了所有可能的状态,我敢肯定,这些PlayStateChanges就是适合您的状态。也许MediaEnded

关于c# - C#检测音乐文件何时停止在WMPLib中播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32446807/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com