我正在创建一个音乐博客,它将使用soundcloud链接。我有一个使用soundcloud自定义播放器(https://github.com/soundcloud/soundcloud-custom-player)构建的自定义播放器。在wordpress之外它完美地工作并且在一个完成时加载下一个轨道,但是在wordpress上它不会看到下一个轨道。我假设它是因为它在循环中而不是html的一部分?
请耐心等待我是设计师而不是编码员!感谢!!!
目前,sc-player.js中的代码是
onPlay = function(player, id) {
var track = getPlayerData(player).tracks[id || 0];
updateTrackInfo(player, track);
// cache the references to most updated DOM nodes in the progress bar
updates = {
$buffer: $('.sc-buffer', player),
$played: $('.sc-played', player),
position: $('.sc-position', player)[0]
};
updatePlayStatus(player, true);
play(track);
},
onPause = function(player) {
updatePlayStatus(player, false);
audioEngine.pause();
},
onFinish = function() {
var $player = updates.$played.closest('.sc-player'),
$nextItem;
// update the scrubber width
updates.$played.css('width', '0%');
// show the position in the track position counter
updates.position.innerHTML = timecode(0);
// reset the player state
updatePlayStatus($player, false);
// stop the audio
audioEngine.stop();
$player.trigger('onPlayerTrackFinish');
},
onSeek = function(player, relative) {
audioEngine.seek(relative);
$(player).trigger('onPlayerSeek');
},
onSkip = function(player) {
var $player = $(player);
// continue playing through all players
log('track finished get the next one');
$nextItem = $('.sc-trackslist li.active', $player).next('li');
// try to find the next track in other player
if(!$nextItem.length){
$nextItem = $player.nextAll('div.sc-player:first').find('.sc-trackslist li.active');
}
$nextItem.click();
},
感谢!!!!
EDIT !!!!! 当歌曲结束时,我会在日志中看到“完成了下一首曲目”,这样看似有效,它只是没有“下一首!”