鍍金池/ 問(wèn)答/HTML5  HTML/ 微信IOS音頻無(wú)法播放問(wèn)題

微信IOS音頻無(wú)法播放問(wèn)題

在IOS微信中無(wú)法播放聲音,有什么解決辦法?

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
    test audio
    <audio id="bgmAudio" src="http://hf.21tb.com/web-static/assets/minaRace/audio/readyGo.mp3?jsVersion=2.21"></audio>
    <script>
        window.onload = function () {
            document.querySelector("#bgmAudio").play()
            // setTimeout(() => {
            //     console.log("play")
            //     document.querySelector("#bgmAudio").play()
            // }, 500);
        }
    </script>
</body>

</html>


回答
編輯回答
別逞強(qiáng)

https ?

2018年4月30日 04:35
編輯回答
凝雅

ios特有限制,需要點(diǎn)擊一下屏幕才能play音頻,不然浪費(fèi)用戶的流量。
你監(jiān)聽(tīng)body的touch事件然后播放

2018年1月5日 07:59
編輯回答
北城荒
                wx.config({
                    // 配置信息, 即使不正確也能使用 wx.ready
                    debug: false,
                    appId: '',
                    timestamp: 1,
                    nonceStr: '',
                    signature: '',
                    jsApiList: []
                });
                wx.ready(function () {
                    document.getElementById('audio').play();
                });
2017年9月3日 14:28
編輯回答
初心
document.addEventListener "WeixinJSBridgeReady",->
  .audio.play()
,false

N 年的問(wèn)題了, 視頻 音頻不讓自動(dòng)播放.

2017年12月22日 23:57