我正在尝试使用他们的Javascript API从soundcloud流式播放曲目,但在询问流式网址时我一直收到404:
SC.oEmbed(track_url, { auto_play: false }).then(function(oEmbed) {
var iframeContainer = document.getElementById('soundcloud-preview-iframe-<?php echo $track->id; ?>')
iframeContainer.innerHTML = oEmbed.html;
var iframe = iframeContainer.getElementsByTagName("iframe")[0];
widget<?php echo $track->id; ?> = SC.Widget(iframe);
widget<?php echo $track->id; ?>.bind(SC.Widget.Events.READY, function() {
jQuery(".soundcloud-preview-control-<?php echo $track->id; ?>").addClass("soundcloud-preview-control-play").html('<!-- -->');
});
widget<?php echo $track->id; ?>.bind(SC.Widget.Events.PLAY_PROGRESS, function() {
widget<?php echo $track->id; ?>.getPosition(function(positionSC) {
if( (secondsLimit*1000)<Math.floor(positionSC) ) {
widget<?php echo $track->id; ?>.pause();
curSongId = '';
jQuery(".soundcloud-preview-control-<?php echo $track->id; ?>").removeClass("soundcloud-preview-control-stop").addClass("soundcloud-preview-control-play");
}
});
});
});
我在oEmbed.html json对象的此调用中收到与控制台相关的多个404错误: https://soundcloud.com/oembed.json?auto_play=false&url=xxx
我想知道为什么使用他们的JS API不起作用。