Autoplay video element on mobile browser

旧城冷巷雨未停 提交于 2019-12-06 11:39:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!