Here is my markup. I'm not sure what i need to do to get the video to stop playing when i close the modal. It stops playing just fine in chrome, but in firefox the video keeps playing in the background.
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<iframe id="iframeYoutube" width="854" height="480" src="https://www.youtube.com/embed/TFpFJeWOvZg?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$("#myModal").on("hidden.bs.modal",function(){
$("#iframeYoutube").attr("src","#");
})
})
function changeVideo(vId){
var iframe=document.getElementById("iframeYoutube");
iframe.src="https://www.youtube.com/embed/"+vId;
$("#myModal").modal("show");
}
</script>