从ajax加载的soundManager播放先前选择的歌曲
我有一个显示不同音乐专辑的页面,我正在其中初始化一个声音管理器。 单击专辑时,会在 ajax 中加载一个视图,其中包含一些 mp3 链接。 这工作正常并且音乐播放。 (我的脚本基于: http:// www.schillmania.com/projects/soundmanager2/demo/mp3-player-button/basic.html )
当单击另一个专辑时,我会调用
soundManager.stopAll();
以停止任何当前正在播放的曲目。这会停止当前播放的曲目,但是当我单击新打开的“专辑视图”中的曲目时,先前选择的曲目将在新单击的曲目之上播放。
我尝试过使用 soundManager.unload();和 soundManager.destruct();没有成功...
有什么想法吗?
I have a page where different music albums are showed, and I'm initalizing a soundManager in it.
When an album is clicked, a view is loaded in ajax with some mp3 links in it.
This works fine and the music plays. (I've based my script on: http://www.schillmania.com/projects/soundmanager2/demo/mp3-player-button/basic.html )
When another album is clicked, I'm calling
soundManager.stopAll();
to stop any currently playing track. This stops the track currently playing, but when I click on a track in a newly opened "album view", the previously selected track, plays on top of the newly clicked one.
I've tried using soundManager.unload(); and soundManager.destruct(); without success...
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
而不是:
我使用:
问题是,现在当我加载另一个“相册视图”时,配置未正确加载,并且“playNext”或“autoPlay”属性不起作用......
Instead of:
I used:
The problem is that now when I load another "album view", the config isn't loaded properly and the "playNext" or "autoPlay" attributes aren't working...
嗯......这是旧的,但我遇到了这个问题并找到了答案
这里
似乎你只需要调用:
在你的ajax调用成功之后。
Well... this is old, but I had this issue and found the answer
here
Seems you just need to call:
After your ajax call success.