I’d like to load a youtube video as background to a color section without autoplaying it.
I was able to make it play/pause on click, using CSS, but I would like it to play only if user clicks on it.
I have tried to stop it in multiple ways, I even tried programatically clicking on it, so far nothing worked.
It is the only video in all website, so a solution that disables background videos from autoplaying throughout the website is also acceptable.
Is the YouTube IFrame Player API accessible? If so, could you give me an example?
Thank you.
Finally found a way around it, with this script:
jQuery(document).ready(function($) {
$('#videoverlay').on('av-video-loaded', function(e){
setTimeout(function(){
$('.avia_playpause_icon').css({'display':'block'});
document.getElementById($('.av_youtube_frame').attr('id')).contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
}, 500);
});
});
