How to implement a "Liener" in a video?

Asked

Viewed 30 times

0

Well, I have a button and when clicking it, it will call a function that opens a page with a fullscreen video with autoplay="true". IT HAPPENS THAT, after the end of the video I need to redirect the user to another html page. Can anyone point me in the direction of implementing this script? I think it would be a sort of 'Istener', but I have no idea.

1 answer

0


There is a property of HTML 5 videos that is able to detect whether or not the video is over.

I think a few lines of code are needed

 //caso o vídeo tenha acabado o retorno é true, caso não será false
   document.getElementById('myVideo').addEventListener('ended',myHandler,false);

    function myHandler(e) {
        window.location.href = "http://answall.com";    
    }

Useful Link

Video end detection

  • Really fell like a glove and achieved the goal. Thank you for the strength. Increasingly loving' programming'.

  • That’s great! Anything you ask.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.