<audio id="test" controls="controls"> <source src="1.mp3" type="audio/mpeg" /> <source src="1.ogg" type="audio/ogg" /> </audio>
js代码以dom加载播放视频
document.getElementById('test').load(); document.getElementById('test').play();
在浏览器中工作但在iPad中工作,我需要设置什么?
解决方法
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()">
原文地址:https://www.jb51.cc/js/240929.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。