Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

video.js display poster image at end of video

USING VIDEO.JS in Adobe Muse Currently I have poster image configured to display at beginning of video, when video has concluded I'd like the poster image to re-appear. Thanks for any help!

like image 531
Sunny Avatar asked Jan 09 '23 10:01

Sunny


1 Answers

In the future the best way to do this will be through css. I just added an issue for it.

.video-js.vjs-ended .vjs-poster {
  display: block;
}

For now there's two ways using javascript that should work.

var myPlayer = videojs(myId);

myPlayer.on('ended', function(){
  this.posterImage.show();
});

// or

myPlayer.on('ended', function(){
  this.trigger('loadstart');
});

You'll want to test both for your specific use case.

like image 151
heff Avatar answered Jan 11 '23 22:01

heff