我需要将clip1
,clip2
,clip3
作为自动播放而非播放,但稍后取决于某些其他逻辑条件。
第一个clip1总是像这样工作。
但是我怎么能告诉jplayer玩clip2
?我必须删除#jquery_jplayer_1
div吗?
如果我删除它,那么它根本不起作用,因为m4v:
仍然只保留一个网址clip1
如何在Javascript中将clip1网址"http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"
更改为clip3(others.m4v)或clip2(etcetc.m4v)?
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/js/jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="/js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "Big Buck Bunny",
m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v",
});
},
swfPath: "/js",
supplied: "m4v, ogv",
cssSelectorAncestor: "",
cssSelector: {
play: "#play",
},
size: {
width: "320px",
height: "180px"
}
});
});
</script>
</head>
<body>
<p>
<button id="play">play</button>
</p>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
</body>
<html>
答案 0 :(得分:0)
工作。
<script type="text/javascript" src="/js/jquery-2.2.2.min.js"></script>
<script type="text/javascript" src="/js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
var pl =[];
pl[0] = {m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"};
pl[1] = {m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"};
function play1() {
$("#jquery_jplayer_1").jPlayer("setMedia", pl[0]);
$("#jquery_jplayer_1").jPlayer('play');
}
function play2() {
$("#jquery_jplayer_1").jPlayer("setMedia", pl[1]);
$("#jquery_jplayer_1").jPlayer('play');
}
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
supplied: "m4v, webm",
size: {
width: "100%",
height: "100%"
}
});
});
</script>
<button onclick="play1();">play1</button>
<button onclick="play2();">play2</button>
<div id="jquery_jplayer_1" ></div>