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 inactiveuntil 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.html
<audio src="bg.mp3" id="CW" autoplay preload></audio> $(function() { audioAutoPlay('CW'); }); function audioAutoPlay(id){ var audio = document.getElementById(id), play = function(){ audio.play(); document.removeEventListener("touchstart",play, false); }; audio.play(); //兼容微信 document.addEventListener("WeixinJSBridgeReady", function () { play(); }, false); //兼容易信 document.addEventListener('YixinJSBridgeReady', function() { play(); }, false); document.addEventListener("touchstart",play, false); }