Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #552647

    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.

    • This topic was modified 10 years, 4 months ago by rlucian.
    #552668

    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);
        });
    });
    • This reply was modified 10 years, 4 months ago by rlucian.
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘load youtube video as background without autoplaying’ is closed to new replies.