【发布时间】:2011-02-15 11:17:06
【问题描述】:
当我点击播放时,我需要在播放新的 jPlayer 之前停止所有其他实例。
感谢您的帮助。
【问题讨论】:
当我点击播放时,我需要在播放新的 jPlayer 之前停止所有其他实例。
感谢您的帮助。
【问题讨论】:
$('#jPlayer_ID').jPlayer("pauseOthers");
【讨论】:
// Equivalent to "stop others", passing time as zero. $("#jpId").jPlayer({ play: function() { $(this).jPlayer("pauseOthers", 0); // stop all players except this one. } });
你可以使用这个方法:
$.jPlayer.pause(); // Pause all instances of jPlayer on the page
或者,您也可以将其放入 onclick 或 click 事件函数处理程序中
$('[id^="jquery_jplayer"]').jPlayer("pause");
【讨论】:
$().jPlayer({play:function(){$(this).jPlayer("pauseOthers");}});
给所有玩家一个类(我认为默认是 class="jp-jplayer"),然后在初始化选项中包含以下“播放”事件处理程序:
$("#jplayer1").jPlayer({
ready: function() {
$(this).jPlayer("setMedia", {
mp3: "mp3/track1.mp3"
});
},
play: function() {
$(".jp-jplayer").not(this).jPlayer("stop");
},
swfPath: "js",
wmode: "window"
});
【讨论】:
已解决
只需将 onclick 函数分配给播放触发器,函数就会:
function stopall(){
$(".jplyrselectr").jPlayer("stop");
}
【讨论】:
也许$("#jpId1, #jpId2, #jpId3").stop();
【讨论】: