我正在尝试让 SoundCloud HTML5 播放器小部件自动启动并寻找特定的曲目和位置,但无论我尝试什么它都不起作用。
我正在使用下面的 API 代码:
<iframe width="100%" height="450" scrolling="no" id="soundcloud-player" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F3058825&color=00be53&auto_play=false&show_artwork=true"></iframe>
<script type="text/javascript" src="http://w.soundcloud.com/player/api.js"></script>
<script type="text/javascript">
(function(){
var widgetIframe = document.getElementById('soundcloud-player'),
widget = SC.Widget(widgetIframe);
widget.bind(SC.Widget.Events.READY, function() {
widget.play();
widget.seekTo('5000');
});
widget.bind(SC.Widget.Events.PLAY, function() {
// get information about currently playing sound
widget.getCurrentSound(function(currentSound) {
console.log('sound ' + currentSound.title + 'began to play');
});
}); }());
我基本上想要完成的是让玩家在用户在网站上的页面之间切换时自动寻找相同的位置。我计划从 cookie 中读取位置和轨迹,然后使用上述方法。任何帮助将不胜感激!