Impossible to autoplay youtube videos in an Android webview by using youtube iframe API. Does someone knows if that is possible?
Asked
Active
Viewed 452 times
1 Answers
0
As already mentioned in Mobile Considerations, functions and parameters such as autoplay
, playVideo()
, loadVideoById()
won't work in all mobile environments due to the restrictions wherein HTML5 <video>
element only allows playback to take place if it's initiated by a user interaction.
You may, however, try the given suggestions in the following SO posts and might work for you:
- Youtube Api android autostart
You can use
loadVideo()
method which loads and plays the specified video. And, there is also thecueVideo()
method, which adds the video to the playlist, but does not automatically start playing the video. - Android webview html5 video autoplay not working on android 4.0.3
You can usually work around it by triggering the
play()
on another event (eg theonloaded
event).
Hope that helps!