Possible Duplicate:
How can I stop a video with Javascript in Youtube?
I was wondering how I can use Twitter Bootstrap's modal feature to autoplay a Youtube video and when a user clicks the "close" button, it will stop the video from playing.
I have tried adding the following to my application.js file without prevail.
$('#my-video').on('hide', function () {
player.stopVideo();
})
HTML view
<div class="modal hide" id="myModal">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="modal-body">
<iframe width="560" height="315" src="http://www.youtube.com/embed/30Pjl31cyDY?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
Any insights is much appreciated.