0

Possible Duplicate:
redirecting the page after a video plays using an html5 video player

Is there way to redirect this video

<video class="video-js vjs-default-skin" id="player1" controls="controls" poster="video/image.jpg"    preload="auto" data-setup="{}" autoplay="autoplay">
        The browser you are using does not support viewing HTML5 Video,please open it in Chrome or Firefox .
</video>

After it stops playing?

I tried this but did not work.

<script>
var video = document.getElementsById('player1');
    video.onended = function(e) {
      window.location.replace("http://stackoverflow.com");
    }
</script>
Community
  • 1
  • 1
user1299846
  • 387
  • 3
  • 8
  • 16
  • 1
    have you checked this : http://stackoverflow.com/questions/5208561/redirecting-the-page-after-a-video-plays-using-an-html5-video-player?? – mfadel Jul 18 '12 at 08:30

1 Answers1

0

What you could do is this:

create a button that plays the video and sets a timer with the length of the video.

Something like (i didn't check this, just a quick thing)

<script>
$("#button").click(function() {
$('#videoId').get(0).play();
setInterval(function(){window.location.replace("http://stackoverflow.com")}, $('#videoId').duration();
});
</script>
Bob van Luijt
  • 7,153
  • 12
  • 58
  • 101