作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个由各个 Soundcloud 轨道的帖子组成的 WordPress 网站,当上一首轨道播放完毕时,我需要播放下一首轨道(在下一篇文章中),因为我的主页是用最新帖子制作的。
我尝试了很多js函数,但仍然无法使其工作。
这是我的网站:invisibleradio
最佳答案
我为面临同样问题的人找到了解决方案:
<script type='text/javascript'>
var next_widget ;
var iframes =[];
var its_the_last = false;
(function() {
iframes = document.querySelectorAll('iframe');
//iframe.src = 'http://w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/43315398&auto_play=true';
for (var i = 0; i < iframes.length; i++) {
//var widget_+i = SC.Widget(iframes[i]);
window['widget_'+i] = SC.Widget(iframes[i]);
var widget = SC.Widget(iframes[i]);
widget.bind(SC.Widget.Events.PLAY, function(eventData) {
//var j = this.name;
// next_widget = window['widget_'+i];
var widget_i = this;
for (var i = 0; i < iframes.length; i++) {
if(SC.Widget(iframes[i]) === widget_i){
if (i+1 >= iframes.length) {
its_the_last = true;
}else{
next_widget = SC.Widget(iframes[i+1]);
}
}else{
console.log('error');
}
};
});
widget.bind(SC.Widget.Events.FINISH, function(eventData) {
if (its_the_last == false) {
next_widget.play();
}
});
};
}());
</script>
关于javascript - 使用 Soundcloud 和 wordpress iram 播放下一首歌曲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29582577/
我是 Android 编程的新手,我正在尝试制作一个简单的媒体播放器应用程序,该应用程序可以从用户的 SD 卡中提取歌曲并使用户能够播放歌曲。我面临的问题是,当一首歌正在播放时,如果用户点击其他歌曲,
使用 AVAudioPlayer 我们可以使用这种方法循环播放多首歌曲: - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player suc
这是一道系统设计题。 假设我们有一个服务可以在听到歌曲时通知我们。让我们设计一个新服务,它能够返回过去 24 小时内听得最多的前 K 首歌曲。假设我们有大约 10 亿首歌曲和大约 2 亿用户。 将您的
由于我是 Flash CS6 actionscript 3 的新手,有人可以具体地举一个详细的例子,向我解释一下如何向我的播放器添加 2 首歌曲,并且仍然使用当前的播放和暂停按钮来控制它们吗? 非常感
我是一名优秀的程序员,十分优秀!