YouTube fullscreen background autoplay not working in YTplayer

8.3k views Asked by At

I am using YTplayer plugin for fullscreen youtube player in this-website Get inspired tab!

  • I have provided code below with usefull links! I think the code is correct!
  • Player is working if we click on the play control on hover at bottom of video player!(image below)!
  • Please help me to sort out why autoplay is not working?
  • where my code is having error?

player


Useful Links >>


https://github.com/pupunzi/jquery.mb.YTPlayer

http://pupunzi.open-lab.com/mb-jquery-components/jquery-mb-YTPlayer/

http://pupunzi.com/#mb.components/mb.YTPlayer/YTPlayer.html


Here is the code >>


<a class="player" id="player" data-property="{
               videoURL: 'https://www.youtube.com/watch?v=j9fgbuH0_RI&feature=youtu.be',
               containment:'#videobg',
               autoPlay: true,
               optimizeDisplay: true,
               showControls: true,
               startAt: 0,
               opacity: 1,
               ratio: '4/3', 
               addRaster: false }"></a>

            <div id="videobg" class="section-divider white-text videobg" data-scroll-index="4">
                <div class="pattern-overlay"></div>
                <div class="triangle-right"></div>

                <div class="container extra-padding">
                    <div class="col-md-5 extra-padding">
                        <h1>INNOVATING THROUGH TRAVEL</h1>
                        <p>Travel is more than the seeing of sights; it is a change that goes on, deep and permanent, in the ideas of living.</p>
                    </div>
                </div>
            </div>

solution

  • Use Latest version of the java script for ytplayer.
1

There are 1 answers

2
mpgn On BEST ANSWER

EDIT

Seem the problem is from the repo jquery.mb.YTPlayer. If we look at the issue https://github.com/pupunzi/jquery.mb.YTPlayer/issues/49

Be sure you have the last version of the repo.


After reading the doc from the repo, try to replace : autoPlay: true, by autoplay: true,

Final code :

<a class="player" id="player" data-property="{
   videoURL: 'https://www.youtube.com/watch?v=j9fgbuH0_RI&feature=youtu.be',
   containment:'#videobg',
   autoplay: true,
   optimizeDisplay: true,
   showControls: true,
   startAt: 0,
   opacity: 1,
   ratio: '4/3', 
   addRaster: false }"></a>

<div id="videobg" class="section-divider white-text videobg" data-scroll-index="4">
    <div class="pattern-overlay"></div>
    <div class="triangle-right"></div>

    <div class="container extra-padding">
        <div class="col-md-5 extra-padding">
            <h1>INNOVATING THROUGH TRAVEL</h1>
            <p>Travel is more than the seeing of sights; it is a change that goes on, deep and permanent, in the ideas of living.</p>
        </div>
    </div>
</div>

Doc : https://github.com/pupunzi/jquery.mb.YTPlayer/wiki