Pergunta

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?

Foi útil?

Solução 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();
    });
})

Outras dicas

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');
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top