How do stop a multiple Youtube Video’s Playing on Twitter Bootstrap Model Close?
This is what I have… When I have just one video it works fine…
var player = document.getElementById('MjXAo2qxMlA'); //save the object or embed youtube video in a variable
$('#ttvideoModalTwo').on('hide', function () {
player.stopVideo();
})
var player = document.getElementById('zXscUitXHPc'); //save the object or embed youtube video in a variable
$('#ttvideoModalOne').on('hide', function () {
player.stopVideo();
})
According to the API you can pass the
$.stopVideo()function to stop the video from playing, include that inside yourmodal('hide')method and you should be able to stop the video once the modal is closed, like so:JS
Youtube API Documentation