循环多个单曲音频播放器以进行连续播放

时间:2011-11-24 04:31:54

标签: javascript html mp3 jplayer ogg

我正在尝试链接音频播放器,以便在完成后,下一首歌曲将开始播放。我会有无数的球员,所以我想知道如何做到这一点。这是非常简单的代码。以下是两首歌曲的示例:

<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();
}

1 个答案:

答案 0 :(得分:1)

使用播放列表附加组件:

http://www.jplayer.org/latest/demo-02-jPlayerPlaylist/

在我身边工作正常