2011-09-21 24 views
0

在HTML頁面中我正在尋找一種方式將視頻 結束後重定向到URL我tryed這個代碼沒有成功(在最後重定向事件)jplayer到URL

<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> 

此代碼自動播放視頻,但播放後不重定向。

謝謝

回答

0

下面是使用端事件的解決方案:

<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>