我想做一些类似于我在 SoundClouds HTML5 Widget API PLayground 页面上看到的事情,他们有控制播放器的外部按钮: http ://w.soundcloud.com/player/api_playground.html
最终我将隐藏播放器小部件本身并将这些按钮用作音乐控制器。
任何建议或提示都会很棒,我在这里发布:http: //jsfiddle.net/alexsethalex/qcKed/1/
我想做一些类似于我在 SoundClouds HTML5 Widget API PLayground 页面上看到的事情,他们有控制播放器的外部按钮: http ://w.soundcloud.com/player/api_playground.html
最终我将隐藏播放器小部件本身并将这些按钮用作音乐控制器。
任何建议或提示都会很棒,我在这里发布:http: //jsfiddle.net/alexsethalex/qcKed/1/
您是否查看了Widget API 文档?
这是一个超级简单的例子:
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://w.soundcloud.com/player/api.js"></script>
<script>
$(document).ready(function() {
var widget = SC.Widget(document.getElementById('soundcloud_widget'));
widget.bind(SC.Widget.Events.READY, function() {
console.log('Ready...');
});
$('button').click(function() {
widget.toggle();
});
});
</script>
</head>
<body>
<iframe id="soundcloud_widget"
src="http://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/39804767&show_artwork=false&liking=false&sharing=false&auto_play=true"
width="420"
height="120"
frameborder="no"></iframe>
<button>Play / Pause</button>
</body>
</html>