I have this video modal here (top corner left button):
http://www.quebecguitare.ca/profs-admin ... oie-lepine
Backend: http://www.quebecguitare.ca/administrat ... ingDetails
The video won't stop when the bootstrap modal is closed or hidden.
This is the code used.
I've also added a script to stop the video on hide. No luck!
Any Clues?
Thank you
Regards
- Code: Select all
<!-- VIDEO PRESENTATION MODAL -->
<!-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal"><i class="fa fa-youtube-play"></i>Launch demo modal</a>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
// Stop video on hide
<script>
//Load player api asynchronously.
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag[removed].insertBefore(tag, firstScriptTag);
var done = false;
var player_3;
function onYouTubeIframeAPIReady() {
player_3 = new YT.Player('ivideo_3');
$('#video_3').on('hide', function () {
player_3.stopVideo();
});
}
</script>
<?php
$video = $this->fields->getFieldById(48);
if( isset($video) ) {
echo '<p />' . $video->getCaption();
echo ': ' . $video->getOutput(1);
}
?>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
Ref.: http://stackoverflow.com/questions/9761 ... odel-close