modal-video icon indicating copy to clipboard operation
modal-video copied to clipboard

Example for adding options

Open bradhogan opened this issue 6 years ago • 4 comments

Thanks for developing this! Quick question, can you send an example of adding an option to a video, autoplay for a Youtube video for example. I see the "autoplay" option, but when I tried adding it to the jQuery call it broke my page.

<script type="text/javascript"> jQuery(document).ready(function($){ $(".video-modal-link").modalVideo({ 'autoplay' => 1 }); }); </script>

bradhogan avatar Apr 09 '19 03:04 bradhogan

Hi @bradley2083 Thank you for the question

You should use autoplay with muted like below. $(".video-modal-link").modalVideo({ autoplay: 1, mute: 1 });

steelydylan avatar Apr 12 '19 04:04 steelydylan

Chrome is more aggressive against autoplaying. I find the solution is to add the following property to the iframe code:

allow="autoplay"

Hope this helps!

Blindmikey avatar Apr 17 '19 03:04 Blindmikey

@Blindmikey Oh that's very helpful thank you :)

but I'm wondering if I should set the attribute on the iframe code. because the modal-video is now following the Youtube Iframe API

steelydylan avatar Apr 17 '19 08:04 steelydylan

I believe if the youtube iframe api would take precedence.

Blindmikey avatar Apr 17 '19 16:04 Blindmikey