調用微信接口,經測試,可以實現,千辛萬苦找到個方法,希望分享可以幫助到各位!
<h4>1、audio設置autoplay屬性播放</h4> <p>IOS不支持</p> <audio id="audio" autoplay="autoplay" src="sound/music.mp3" ></audio>
function runNow() {
context.decodeAudioData(bufs[0], function(buffer) {
source = context.createBufferSource();
source.buffer = buffer;
// 源直接連接到輸出設備
source.connect(context.destination);
source.start(0);
alert('ok');///
});
}
if (window.WeixinJSBridge) {
// alert(0);///
WeixinJSBridge.invoke('getNetworkType', {}, function(e) {
// alert(1);///
setTimeout(runNow, 3000);
}, false);
}else{
document.addEventListener("WeixinJSBridgeReady", function() {
WeixinJSBridge.invoke('getNetworkType', {}, function(e) {
// alert(2);///
setTimeout(runNow, 3000);
});
}, false);
}
// setTimeout(runNow, 3000);///
</script>
有疑問的可以加羣162092974諮詢