how to display lightbox after Video Play Finishes?

ajax, javascript, jquery, lightbox, youtube

Solution

If you can use youtube api then, something like this should work:

<script type="text/javascript">
$(document).ready(function() {
var player;
    function onYouTubePlayerAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'YmHAAqOsBqA',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
    }
    function onPlayerReady(event) {
        event.target.playVideo();
    }
    function onPlayerStateChange(event) {        
        if(event.data === 0) {          
            //completed playing
            //open lightbox
            $('#yourElementId a').lightBox();
        }
    }
});
</script>

Did you mean something like this.

Hope it helps

Problem

I have a youtube video. I want to show a lightbox when it stops playing. I need this to be done using javascript/jQuery or PHP. Ajax is also fine. I looked for a solution but didn't find one that worked.

Original source