Question

When using Bootstrap 3 modal windows normally the content is there, in the same window, so, whenever you close a modal, you just hide it within the same page. If it's a <video>, it'll keep playing until you refresh the page, or re-open the modal just to pause it (since it can't be stopped).
How do you pause a video inside a Bootstrap modal?

Was it helpful?

Solution 2

I found this to be an option to work for all my modals with (using Mediaelement.js) inside them.

$('.modal').on('hidden.bs.modal', function () {
    $('video').each(function() {
      this.player.pause();
    });
})

OTHER TIPS

I searched all over the internet for an answer for this question. none worked for me except this code. Guaranteed. It work perfectly.

$('body').on('hidden.bs.modal', '.modal', function () {
$('video').trigger('pause');
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top