It is possible to autoplay a regular YouTube video in fancybox by appending ?autoplay=1
to the video URL:
<a class="lightbox" href="https://www.youtube.com/embed/zRwBVYjUBOc?autoplay=1">video</a>
… and …
$(document).ready(function(){
$("a.lightbox").fancybox();
});
Unfortunately in some browsers (Chrome, Safari) this doesn't work if the "privacy-enhanced mode" is enabled (youtube-nocookie.com):
<a class="lightbox" href="https://www.youtube-nocookie.com/embed/zRwBVYjUBOc?autoplay=1">privacy-enhanced mode video</a>
The option autoplay=1
is not fully supported on youtube-nocookie.com.
How can I still have the video automatically played in the lightbox with privacy-enhanced mode?
Edit (Mar 23): Firefox, Chrome and Safari start playing the video immediately on https://www.youtube.com/embed/zRwBVYjUBOc?autoplay=1 (also without fancybox – just open the url). I found out that Firefox still starts to play the video on https://www.youtube-nocookie.com/embed/zRwBVYjUBOc?autoplay=1 , only Safari and Chrome don't.