小游戏从后台切回前台,背景音乐暂停,点击屏幕后才会播放

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:00 783 0 全屏看文

AI助手支持GPT4.0

小游戏从后台切回前台,背景音乐暂停,点击屏幕后才会播放
框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
小游戏 Bug Android 安卓10 都有 7.0.16

https://developers.weixin.qq.com/minigame/dev/api/base/app/life-cycle/wx.onShow.html

我进入游戏后用createInnerAudioContext创建了一个背景音乐,切到后台再回前台就没声音了,但是点一下屏幕随便一个地方就能继续播


Framework type problem type operating system operating system version mobile phone model wechat version small game bug Android Android 10 all have 7.0.16 https://developers.weixin.qq.com/minigame/dev/api/base/app/life-cycle/wx.onShow.html After I entered the game, I created a background music with the createinnereaudiocontext. After switching to the background and returning to the foreground, there was no sound, but clicking on the screen could continue playing anywhere

回答:

Forever:

回到前台,要不要播放,开发者自己控制的,可以参考官方的小游戏api调用demo(https://github.com/wechat-miniprogram/minigame-demo)

-EOF-

AI助手支持GPT4.0