in a html page i'm looking for a way to redirect to a url after the end of the video I've tryed this co开发者_如何学Cde without success (redirect event at the end)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
m4v: "intro.mp4",
poster: "intro.png"
}).jPlayer("play");
},
swfPath: "js",
supplied: "m4v",
size: {
width: "950px",
height: "320px",
cssClass: "jp-video-360p"
}
,
events:{
onComplete: function() {
window.location = "http://www.cnn.com";
}
},
});
});
//]]>
</script>
this code autoplay the video, but doesn't redirect after the playback.
Thank you
Here's the solution using ended event:
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
m4v: "intro.mp4",
poster: "splashvideo.png"
}).jPlayer("play");
},
swfPath: "js",
supplied: "m4v",
size: {
width: "950px",
height: "320px",
cssClass: "jp-video-360p"
}
,
ended: function() {
window.open("http://www.yoursite.com/welcome", "_self");
},
});
});
//]]>
</script>
精彩评论