Search code examples
javascriptjqueryhtmlhtml5-video

How to show html5 video poster end of video play?


I want to show video poster after play. I am trying following code but no luck.

var video=$('#cms_video').get(0);
video.play();
video.addEventListener('ended',function(){
    this.posterImage.show();
});  

Solution

  • Here is the solution I found:

    var video=$('#cms_video').get(0);        
    video.play();
    video.addEventListener('ended',function(){
        v=video.currentSrc;
        video.src='';
        video.src=v;            
    });