modal-video
modal-video copied to clipboard
Example for adding options
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>
Hi @bradley2083 Thank you for the question
You should use autoplay with muted like below.
$(".video-modal-link").modalVideo({ autoplay: 1, mute: 1 });
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 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
I believe if the youtube iframe api would take precedence.