Skip to content Skip to sidebar Skip to footer

There's No Way Method To Do Autoplay Video On Android Platform?

I read in billions of foruns and posts on the stackoverflow, and nothing. When I found a solution or something like that, not work anymore. I tried with Google API and nothing too.

Solution 1:

<divid="player"></div><script>var tag = document.createElement('script');
       tag.src = "https://www.youtube.com/player_api";
       var firstScriptTag = document.getElementsByTagName('script')[0];
       firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
       var player;
       functiononYouTubePlayerAPIReady() {
            player = newYT.Player('player', {
                  height: '480',
                  width: '853',
                  videoId: 'YOUR ID',
                  events: {
                       'onReady': onPlayerReady,
                       'onStateChange': onPlayerStateChange
                  },
                  playerVars: {
                        'autoplay': 1,
                        'showinfo': 0,
                        'controls': 0
                                }
                            });
                        }
                        functiononPlayerReady(event) {
                            event.target.playVideo();
                        }

                        var done = false;
                        functiononPlayerStateChange(event) {
                            if (event.data == YT.PlayerState.PLAYING && !done) {
                                done = true;
                            }
                        }
                        functionstopVideo() {
                            player.stopVideo();
                        }
                    </script>

Solution 2:

When you use the Player in a browser that has Flash disabled, playback is handled via HTML5 tags.

Apple explicitly prohibits autoplaying media in tags in iOS Safari.

This is also the case for at least recent versions the default Android Browser or in Chrome. I'd strongly suspect that Android Firefox has the same restriction.

Solution 3:

<iframesrc='http://www.youtube.com/embed/bhRqrw82P3A?autoplay=1&modestbranding=1&showinfo=0&fs=0'width='300'height='175'frameborder='0' ></iframe>

Post a Comment for "There's No Way Method To Do Autoplay Video On Android Platform?"