Hi,
It is a well known Browser behavior that Audiocontent cannot start if the page is not in focus and it’s suspended until we perform onTouch or onGesture to bring back focus so the sound could continue.
It was the case up to Cocos Creator version 3.5
Since updating to 3.6 and later 3.7, we started to notice that the canvas in some scenarios (ex. refresh - when loading from cache)) would not resume the suspended background looping sound even onTouch and onGesture (The promise never gets resolved)
The sound related game logic was not changed
The games becomes kinda muted without the option to resume even by clicking and switching tabs or starting the sound anew.
After further investigation we found out that indeed it happens because the promise is not resolved, and it can be solved only on the Cocos engine level (not the game)
Based on version 3.7.2, we can add those few lines to solve the issue:
Thanks for the suggestion, can you take this fix and submit a PullResuest to the Creator engine’s repository? I will actively review and review your commit with my engine team colleagues and thank you for your contribution.
Address: Pull requests · cocos/cocos-engine · GitHub