自动播放音频与iOS 5移动Safari浏览器,任何变通办法离开? [英] Autoplay audio with iOS 5 Mobile Safari, any workarounds left?

查看:252
本文介绍了自动播放音频与iOS 5移动Safari浏览器,任何变通办法离开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道,苹果不允许与移动Safari浏览器的HTML5音频标签自动播放。适用于iOS 4的解决方法是使用iframe带MP3 SRC。苹果似乎已经修补了这个在iOS 5。

We all know Apple doesn't allow autoplay on html5 audio tags with Mobile Safari. The workaround for iOS 4 was to use an iframe with an mp3 src. Apple seems to have patched this on iOS 5.

<html>
<body>
iframe mp3 autoplay test
<iframe src='iframe.mp3' width='0px' height='0px' scrolling='no'></iframe>
</body>
</html>

这适用于iOS 4.3.1,而不是5.0.1。

This works on iOS 4.3.1, but not on 5.0.1.

任何变通办法离开,或者已经苹果最终修补所有的自动播放漏洞?

Any workarounds left, or has Apple finally patched all the autoplay loopholes?

推荐答案

其实苹果已经禁用了移动Safari浏览器的自动播放功能。
以上的Safari的iPhone OS(对于所有设备,包括ipad公司),其中用户可以是蜂窝网络中,每个数据单元,自动缓冲和自动播放被禁止。没有数据加载,直到用户启动它充电。这意味着JavaScript的play()和load()的方法也没有改变,直到用户启动播放,除非play()方法是由用户操作触发的。换句话说,一个用户发起的播放按钮的作品,但在onload播放事件没有。

Actually Apple have disabled the auto play feature for mobile safari. "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. In other words, a user-initiated Play button works, but an onLoad play event does not."

可先加载视频来完成,然后伪造用户点击事件,如下面的链接描述
看看这个链接周围的工作,

It can be done by first loading the video and then faking the user click event as described in the following link Have a look at this link for a work around,

http://roblaplaca.com /博客/ 2010/04/14 / ipad公司和iPhone-HTML5的视频自动播放/

本页面查看源代码code

view source code of this page

http://www.roblaplaca.com/examples/html5AutoPlay/

这篇关于自动播放音频与iOS 5移动Safari浏览器,任何变通办法离开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆