Casey Jensen
Casey Jensen

Reputation: 65

Return to beginning state at the end of the video

I'm using video.js (4.1.0), and would like to return to the ready-to-start state at the end of the video. I don't see how to do this.

If I do myPlayer.on("ended", function(){ });

and load the poster frame in there, using myPlayer.posterImage.show(); it covers the entire video object, even if a user starts playing the video again.

If, at the end, I do this: this.pause(); this.currentTime(0); it has the video paused at the beginning, rather than the ready state with poster frame.

Any thoughts on how I can accomplish this?

Upvotes: 0

Views: 5081

Answers (1)

misterben
misterben

Reputation: 7821

The poster image should disappear again when playback restarts - do you have a link where it does not? It does in this fiddle, where the posterImage and bigPlayButton are shown and currentTime is set to 0.

var vid = videojs("myVideo");
vid.on("ended", function(){
  vid.posterImage.show();
  vid.bigPlayButton.show();
  vid.currentTime(0);
})

Upvotes: 2

Related Questions