Manoj
Manoj

Reputation: 67

Close bootstrap modal automatically when a video inside modal body stops playing

I am using video.js to load a video inside a bootstrap modal. I need a modal to shutdown when a video is completed.

Upvotes: 0

Views: 88

Answers (1)

Tomek Sułkowski
Tomek Sułkowski

Reputation: 7201

Use video.js's ended event and run .modal('hide') on its callback, like this:

videojs('some-video').ready(function(){
  this.on('ended', function(){
      $('#modal').modal('hide');
  });
});

Upvotes: 1

Related Questions