2

I am using the Metro UI Template, but I have a problem with the dialog when using Videos. When I close the dialog, the video continues playing.

The code I have is:

<script>
function showDialog(id){
    var dialog = $("#"+id).data('dialog');
    if (!dialog.element.data('opened')) {
        dialog.open();
    } else {
        dialog.close();
    }
}
</script>

Then the dialog is called by:

<div data-role="dialog" id="video" class="padding20" data-close-button="true" data-overlay="true" data-overlay-color="op-dark">
<h2>Title of Video</h2>

<video width="800px" controls="controls">
    <source src="videos/video.mp4" type="video/mp4">

    Your browser does not support the HTML5 Video element.
</video>

</div>

Does anyone know how I can stop the video when the dialog is closed?

Antti29
  • 2,953
  • 12
  • 34
  • 36
Bob
  • 53
  • 6

1 Answers1

1

OK, so I have managed to resolve the issue.

I placed the video in an iframe, then refreshed the iframe when the dialog is closed using the code I found here http://www.codingforums.com/html-and-css/168580-refresh-iframe-without-page-refresh.html

Bob
  • 53
  • 6