I am using IFrame Player API to play youtube videos in my website.when user clicks a particular link it popups a lightbox and plays video automatically.In Desktop it works fine,and in ios I understand why doesn't it work (they already mentioned why), but for android chrome its not working.Is autoplay was disabled also in andorid browsers? Please enlighten me.
Asked
Active
Viewed 4,983 times
1 Answers
3
This link seems to answer most of your questions:
YouTube iframe embeds cannot autoplay on Android
But in short, it seems like autoplay has been disabled on Chrome for Android so you need to treat it in the same way as iOS and use a user interaction to trigger the play.
Update: There's a more affirmative information that it has been disabled here: https://developers.google.com/web/updates/2016/07/autoplay#why_the_change
It will play however if you set it to autoplay in a muted state.
A solution I've just been working on for autoplaying would be to instantiate the player with an empty video on page load:
var player = new YT.Player('yt-media-player', {
height: height,
width: width,
videoId: ''
});
Then on the click event of opening the lightbox you can load the particular video and call it to play:
player.loadVideoById(youtubeId);
player.playVideo();
-
Thanks for your help,but,I went through all of these posts.There is an element of "may be" or "belief" in these posts.I need confirmation to explain the same to my client. – saiyan Apr 27 '17 at 04:36
-
@saiyan I've updated with a link which you might find useful. I've also been working on a similar problem which might help you. – etf213 Apr 27 '17 at 09:00
-
Thanks,I am giving an up vote for your useful information.but, I need authentic information regarding "autoplay disabled for Youtube videos" not just any html videos. – saiyan Apr 27 '17 at 09:36
-
All YouTube is doing is loading an iFrame with a HTML video inside it so it stands to reason that it must adhere to the same browser behaviour. – etf213 Apr 27 '17 at 12:00
-
Yeah,I can understand that it shows the same behaviour. But,I need a documented proof so, that I can convince my client by showing it.Actually,I wanted to ask youtube api support team.,but, they said to post a question here with "youtube-iframe-api" tag. – saiyan Apr 27 '17 at 12:15