creator H5声音背景播放问题

H5游戏这里有一个坑。背景音乐的问题。

creator H5声音背景播放问题
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

因为需要玩家主动点击后才能播放,所以,需要监督玩家点击了后,才播放背景音乐。

AudioManager.resumeBGM(); 还原一下播放也可以。

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio 的指南:
Key Point: If an AudioContext is created prior to the document receiving a user gesture, it will be created in the "suspended" state, and you will need to call resume() after a user gesture is received.

你可能感兴趣的:(creator H5声音背景播放问题)