2011-12-30 57 views
2

我是新來mediaelements.js重定向完成

我視頻的結尾,我希望將用戶重定向到另一個頁面

我已經試過類似

<script> 
$(function(){ 
     $('audio,video').mediaelementplayer({ 
      success: function(player, node) { 
       window.location = "http://google.com"; 
       }); 
      } 
     }); 
    }); 


</script> 

但我一直沒有成功,也許有人會有想法

回答

0

這對我有效。 'player1'是視頻的ID

<script> 
new MediaElement('player1', { 

success: function (mediaElement, domObject) { 

// add event listener 
mediaElement.addEventListener('ended', function(e) { 

     //Do Stuff here 
     //alert("sometext"); 
     window.location = "http://google.com"; 

     }, false); 
    }, 
}); 
</script> 

我發佈的代碼是用於媒體元素播放器。我看起來像你在發佈的鏈接中使用video.js播放器。我不知道這將如何工作,但我確實發現這... help.videojs.com/discussions/questions/26-redirect-to-url-once-video-has-ended

+0

謝謝ShockTower,你會有一個功能的版本的網址,因爲我只是不能得到它的工作我當前的網址是http:///www.atanahoue.com/video/video-js/預先感謝你 – 2012-01-01 17:56:33

+0

oups,我已經嘗試了與錯誤的js庫,請原諒我 – 2012-01-03 05:47:50

+0

工作完美,非常感謝你,請原諒我的stupindess – 2012-01-03 05:52:49