我正在与soundcloud custom player合作,试图让它播放下一首歌,即使它是在另一首歌中。我对js并不是很熟悉,但我相信我找到了代码,我只是不知道该怎么做!
JS
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();
},
HTML
<div class="post">
<a href="http://soundcloud.com/matas/hobnotropic" class="sc-player special">Track 1</a>
<a href="http://soundcloud.com/matas/hobnotropic" class="sc-player special">Track 2</a>
</div>
<div class="post">
<a href="https://soundcloud.com/matas/on-the-bridge" class="sc-player">Track 3</a>
</div>
JAVASCRIPT生成的HTML
<div class="sc-player special">
<ol class="sc-artwork-list">
<li class="active">
<img src="https://i1.sndcdn.com/artworks-000000103093-941e7e-t300x300.jpg">
</li>
</ol>
<div class="sc-info">
<h3><a href="http://soundcloud.com/matas/hobnotropic">Hobnotropic</a></h3>
<h4>by<a href="http://soundcloud.com/matas">matas</a></h4>
<p>Kinda of an experiment in search for my own sound. I've produced this track from 2 loops I've made using Hobnox Audiotool ( http://www.hobnox.com/audiotool.1046.en.html ). Imported into Ableton LIve! and tweaked some FX afterwards.</p>
<a class="sc-info-close" href="#">X</a>
</div>
<div class="sc-controls">
<a class="sc-play" href="#play">Play</a>
<a class="sc-pause hidden" href="#pause">Pause</a>
</div>
<ol class="sc-trackslist">
<li class="active">
<a href="http://soundcloud.com/matas/hobnotropic">Hobnotropic</a>
<span class="sc-track-duration">8.09</span>
</li>
</ol>
</div>
音轨1自动进入音轨2,但我希望它能够进入音轨3.帮助! ;)