在真机调试的时候,播放背景音乐,如果在背景音乐播放中 返回退出小程序,那么程序是正常的。
如果在背景音乐不再播放的过程中 退出小程序,那么息屏之后不会播放音乐,会出现如下错误。
- 当前 Bug 的表现(可附上截图)
onLaunch: function () { this .playAudio(); setInterval(() => { this .playAudio(); }, 10000) }, |
playAudio() { console.log( this ); this .globalData.backgroundAudioManager && this .globalData.backgroundAudioManager.onStop(); const backgroundAudioManager = wx.getBackgroundAudioManager() backgroundAudioManager.title = '订单提醒' // 设置了 src 之后会自动播放 backgroundAudioManager.src = 'http://dazezb.oss-cn-zhangjiakou.aliyuncs.com/xiaodian/demo.mp3' ; this .globalData.backgroundAudioManager = backgroundAudioManager; } |
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
https://developers.weixin.qq.com/s/ypzEbymx7F92
注释了 还是会存在这个问题。
在音乐播放之后 按返回键,退出小程序 然后在进入,即可复现。
在电脑上没任何问题,需要在真机上测试。(需要音乐播放之后在退出,多尝试下 谢谢)
手机机型:小米note3
安卓版本:8.1.0
微信版本:7.0.4
小程序基础版本:2.7.2
https://developers.weixin.qq.com/community/develop/doc/0006807789c720b2d8c8214d75b000?_at=1562319664872