问题
I have read that autoplay was not possible, or not advised on both iOS and Android (more on that here: no autoplay in iframe HTML5 player on mobile (Android Chrome and Firefox)?). But I was wondering if there was a way that would allow to replicate the same behavior, that is the video playing soon as the page is loaded.
I have tried preloading the video, and playing it once the DOM is loaded, I tried forcing a play soon as the video can be played, none of that work, it always result in the user having to tap the video to play it.
Can anyone help?
NB: I'm working with plain old JavaScript, no jQuery.
回答1:
No, there is no way on iOS/Safari (or iBooks). Videos load only in the context of an event handler reacting to user action such as a touch. You're out of luck.
This has been documented extensively in any number of questions right here on SO, and is clearly documented by Apple.
来源:https://stackoverflow.com/questions/17827397/autoplay-video-element-on-mobile-browser