We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
方法一
//第一步:首先加载一个微信JS-SDK <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> //第2步:写一些配置 <script> function autoPlayAudio() { wx.config({ // 配置信息, 即使不正确也能使用 wx.ready debug: false, appId: '', timestamp: 1, nonceStr: '', signature: '', jsApiList: [] }); wx.ready(function() { var globalAudio=document.getElementById("audio标签id"); globalAudio.play(); }); }; // 解决ios音乐不自动播放的问题 autoPlayAudio(); </script>
方法二
这个是监听touch事件 开启播放 // 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("touchstart",play, false); // } // audioAutoPlay('audio'); 通过点击进行load
var myAudio = document.getElementById('audio') myAudio.pause() 播放 myAudio.play() 暂停
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ios
方法一
方法二
安卓
The text was updated successfully, but these errors were encountered: