这里是索引文件(javascript)
$(document).ready(function(){
player("video-1.mov","player1");
player("video-2.mov","player2");
player("video-3.mov","player3");
});
function player(video,id) {
flowplayer(id, "http://releases.flowplayer.org/swf/flowplayer-3.2.14.swf", {
playlist: [video],
clip: {
autoPlay: true,
autoBuffering: true
}
});
}
function goto_next(current,page)
{
$('#'+current).hide();
$('#'+page).show();
flowplayer.unload();
}
这是索引文件
<span id="1" class="step">
<div class="player formplayer" id="player1"></div>
</span>
<span id="2" class="step" style="display:none;">
<div class="player formplayer" id="player2"></div>
</span>
<span id="3" class="step" style="display:none;">
<div class="player formplayer" id="player3"></div>
</span>
当我点击下一个按钮时,它将调用带有两个不同id的goto_next来显示/隐藏。但是,之前跨度的视频将继续在后台播放。如何停止所有其他视频并仅播放当前视频?
P.S。:它在windows上工作正常:chrome,firefox。
但在mac上遇到firefox的问题。
尝试使用javascript api的stop()函数停止播放器(http://flowplayer.org/documentation/api/index.html)
function goto_next(current,page)
{
flowplayer(0).stop();
flowplayer(1).stop();
flowplayer(2).stop();
$('#'+current).hide();
$('#'+page).show();
flowplayer.unload();
}