safari-mobile - iOS 4.2.1 以后的版本Safari怎么自动播放
PHP中文网
PHP中文网 2017-04-17 11:06:35
[iOS讨论组]

在做一个需要播放声音的页面,调用player.load()和player.play()以后,在以前的版本是可以自动播放的
但是4.2.1貌似播放不出来了,是因为Safari修改了什么东西,不允许自动播放了?

PHP中文网
PHP中文网

认证高级PHP讲师

全部回复(1)
阿神

苹果官方文档 http://developer.apple.com/library/sa...

User Control of Downloads Over Cellular Networks

In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload 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() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.

This plays the movie: <input type="button" value="Play" onclick="document.myMovie.play()">

This does nothing on iOS: <body onload="document.myMovie.play()">
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号