I'm encountering issues with both Android and IPhone playing an embedded youtube video using an iFrame.
"Warning: To prevent unsolicited downloads over cellular networks at the user’s expense, embedded media cannot be played automatically in Safari on iOS — the user always initiates playback."
But on my samsung galaxy s6 edge I can sorta get it to play. In the code below. If I call mute() first then it will play. Problem of course is that there is no volume. So I tried placing unMute() after the playVideo() call but the video no longer plays. Is this a bug in the API? Is there really no solution to play the video without having to manually touch the play button?
<iframe id="cvVideoPlayer" seamless="seamless" style="position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding-top: 10px; border: none;"></iframe>
var parameters = '&enablejsapi=1';
var url = 'https://www.youtube.com/embed/' + entrys.VideoID + '?start=' + 0 + '&autoplay=1' + parameters;
var iframe = $('#cvVideoPlayer');
if (iframe.length) {
iframe.attr('src', url);
self.ytVidePlayer = new YT.Player('cvVideoPlayer', {
events: {
'onReady': this.onPlayerReady,
'onStateChange': this.onPlayerStateChange
}
});
}
onPlayerReady: function (evt) {
evt.target.mute();
evt.target.playVideo();
}