HTML5的audio标签设置了autoplay属性在手机端出现的问题
audio标签设置autoplay了,也设置了js的播放依然无法在手机端网页自动播放(微信),是否手机浏览器大都禁用了自动播放的功能,有没有其他接口
加贺黑丝骑脸爽
9 years, 8 months ago
Answers
Safari屏蔽了autoplay,必须由用户交互事件触发,因为autoplay在移动网络环境下可能会造成用户流量费剧增
Android的我不清楚,下面是引自Safari Reference
In Safari on iPhone OS (for all devices, including iPad), where the
user may be on a cellular network and be charged per data unit,
autobuffering and autoplay are disabled. No data is loaded until the
user initiates it. This means the JavaScript play() and load() methods
are also inactive until the user initiates playback, unless the play()
method is triggered by user action.
iOS 3.2之前还有一种fake的方式,可以通过js模拟一个点击事件来触发,但在之后的版本中就不再有效了
目前没有其他任何办法可以实现autoplay
撸过才算好男人
answered 9 years, 8 months ago