我正在尝试链接音频播放器,以便当一个播放器完成时,下一首歌曲将开始播放。我将有无数的玩家,所以我想知道如何做到这一点。这是非常直接的代码。以下是两首歌曲的示例:
<div class="container">
<!-- DJ Picture -->
<img src="Pictures/Calvinharris.jpg" class="img1" />
<div class="box">
<!-- DJ Name -->
<span class="bigroom">Calvin Harris</span>
<!-- Song Title -->
<h2>We Found Love (Chuckie Mix)</h2>
<!--Song Description(179 characters with spaces)-->
<h4>Beautiful, pounding piano stabs combined with great vocals make this track a phenomenal one. Manages to powerfully fill a massive sound-space without sounding cluttered.</h4>
<!--Song file info-->
<div class="player">
<body><a id="m12" class="audio {skin:'#010101',showVolumLevel:false,showTime:false,ogg:'MP3/Rihanna feat. Calvin Harris - We Found Love (Chuckie Extended Mix).ogg'}" href="MP3/Rihanna feat. Calvin Harris - We Found Love (Chuckie Extended Mix).mp3"></a>
</div>
</div>
</div>
<div class="container">
<!-- DJ Picture -->
<img src="Pictures/dirtyharris.jpg" class="img1" />
<div class="box">
<!-- DJ Name -->
<span class="techno"> ThreeSixty & Dirty Harris</span>
<!-- Song Title -->
<h2>Louka (Funkagenda Re-Edit)</h2>
<!--Song Description(179 characters with spaces)-->
<h4>I had to include this one since it literally took over control of me while driving the other morning. I was bouncing around in my seat like a little kid who desparately needs to use the bathroom. </h4>
<!--Song file info-->
<div class="player">
<body><a id="m11" class="audio {skin:'#010101',showVolumLevel:false,showTime:false,ogg:'MP3/ThreeSixty, Funkagenda - Loudka (Funkagenda Re-Edit).ogg'}" href="MP3/ThreeSixty, Funkagenda - Loudka (Funkagenda Re-Edit).mp3"></a>
</div>
</div>
</div>
这是我想出的jquery,但它不起作用。
function playNext(idx){
var players=$(".audio");
document.playerIDX = idx+1 <= players.length-1 ? idx+1 : 0;
players.eq(document.playerIDX).mb_miniPlayer_play();
}