2015-04-06 132 views
1

我在我的網站上使用jPlayer,我想改變下一件事,當你按下播放按鈕時(在你聽完那首歌后)歌曲從頭開始。jPlayer時間問題

$("#jquery_jplayer_1").jPlayer({ 
    ready: function() { 
     $(this).jPlayer("setMedia", { 
      title: "Stirring of a fool", 
      mp3: "albume/album1/melodii/1.mp3" 
     }); 
    }, 
    play: function() { // To avoid multiple jPlayers playing together. 
     $(this).jPlayer("pauseOthers"); 
    }, 
    swfPath: "../../js", 
    supplied: "mp3", 
    wmode: "window", 
    globalVolume: true, 
    useStateClassSkin: true, 
    autoBlur: false, 
    smoothPlayBar: true, 
    keyEnabled: true 
}); 

此刻,歌曲從我離開的地方開始。

+0

將autoPlay:真,添加此並嘗試

如下您的代碼應該進行修改。 – stanze 2015-04-06 09:43:49

+0

這是一回事..無論如何,我不會自動播放歌曲,每當我從0:00按播放時就開始播放 – Alex 2015-04-06 10:02:30

回答

0

如果歌曲暫停,我會建議將pause事件處理程序和重置位置添加到0。如果歌曲已播放到最後或尚未開始播放,則無論如何都應從頭開始播放。

$("#jquery_jplayer_1").jPlayer({ 
    ready: function() { 
     $(this).jPlayer("setMedia", { 
      title: "Stirring of a fool", 
      mp3: "albume/album1/melodii/1.mp3" 
     }); 
    }, 
    play: function() { // To avoid multiple jPlayers playing together. 
     $(this).jPlayer("pauseOthers"); 
    }, 
    pause: function(event){ 
     $(this).jPlayer("playHead", 0); 
    }, 
    swfPath: "../../js", 
    supplied: "mp3", 
    wmode: "window", 
    globalVolume: true, 
    useStateClassSkin: true, 
    autoBlur: false, 
    smoothPlayBar: true, 
    keyEnabled: true 
});