0

I am using a modal window to display multiple videos, but my autoplay seems to be ignored in the modal window. If I have the video on the page and it is not hidden the autoplay is fine. Do I need to do something else to trigger the autoplay in a modal window?

I am using SimpleModal to do the modal window. For the video I am using a simple video tag and an mp4 video with the autoplay boolean on.

Any help would be appreciated.

dario_ramos
  • 7,118
  • 9
  • 61
  • 108

1 Answers1

4

I was only able to get this to work by using a javascript play() call in the 'open' handler for a jQuery UI dialog. No other method would work.. maybe simplemodal has an analog? Here is the solution for jQuery UI:

$('div#mydialog').dialog({
    open: function(event, ui)   {
        $('video#myvideo').get(0).play();   
    }
});