Autoplay youtube video on mobile

0

I would like to know how I can put the youtube video in autoplay on my mobile, because it is not working, on the mobile it does not autoplay, it does not play the video without having to press.

My Script.

   <script>      
          // 2. This code loads the IFrame Player API code asynchronously.
          var tag = document.createElement('script');
          tag.src = "http://www.youtube.com/player_api";
          var firstScriptTag = document.getElementsByTagName('script')[0];
          firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

          // 3. This function creates an <iframe> (and YouTube player)
          //    after the API code downloads.
          var player;
          function onYouTubePlayerAPIReady() {
            player = new YT.Player('player', {
              playerVars: { 'modestbranding':0,'autoplay': 1, 'controls': 0,'autohide':2,'wmode':'opaque','showinfo':0,'rel':0,'loop':0,'disablekb':1,'playlist':1,'playerapiid':0,'enablejsapi':1,'list':1,'listType':1, 'iv_load_policy':3 }, 
              videoId: 'RC0Wrd12sno',
              events: {
                'onReady': onPlayerReady
                }


            });


          }


          // 4. The API will call this function when the video player is ready.
          function onPlayerReady(event) {
            event.target.mute(true);
             event.target.loadPlaylist(['RC0Wrd12sno']);
             event.target.setLoop(true); 
          }


</script>
    
asked by anonymous 21.09.2015 / 16:58

0 answers