我在全局app.js顶部上创建了wx.getBackgroundAudioManager(),然后我想每次监听socket之后,都调用这个播放一次提醒接单,但是在真机调试的时候手机一进入后台后就无法再次调用播放,并且报错。在论坛翻了好多帖子,说把.stop换成.pause,每次进入后台的之前都要提前调用一次播放,在后台才能再次有效的调用播放,我测试了有点效果,但我总不能一直这样吧?急急急,是不是我的语法有问题呢?求大佬们赐教,已经弄了一天一夜,实在没有办法了。
VM135 [publib]:1 thirdScriptError
APP-SERVICE-SDK:Can not set wx.backgroundAudio.title, background audio is preempted.;at App playMusicSrc function
Error: APP-SERVICE-SDK:Can not set wx.backgroundAudio.title, background audio is preempted.
at Ja ([publib]:1:828402)
at Object.set ([publib]:1:828198)
at pe.playMusicSrc (weapp:///app.js:359:30)
at pe.<anonymous> ([publib]:1:1539858)
at pe.playMusic (weapp:///app.js:349:18)
at pe.<anonymous> ([publib]:1:1539858)
at weapp:///app.js:286:24
at processTicksAndRejections (internal/process/task_queues.js:86:5)
VM135 [publib]:1 thirdScriptError
setBackgroundAudioState:fail: jsapi has no permission, event=setBackgroundAudioState, runningState=background, permissionMsg=permission ok, detail=jsapi permission required playing audio but current not playing audio in background state;at App acceptOrder function;at api setBackgroundAudioState fail callback function
Error: setBackgroundAudioState:fail: jsapi has no permission, event=setBackgroundAudioState, runningState=background, permissionMsg=permission ok, detail=jsapi permission required playing audio but current not playing audio in background state
at Function.fail ([publib]:1:829011)
at Object.fail ([publib]:1:108202)
at [publib]:1:501648
at v ([publib]:1:501817)
at Object.<anonymous> ([publib]:1:502715)
at h ([publib]:1:1085)
at [publib]:1:1224
at Object.g [as invoke] ([publib]:1:1382)
at Object.invoke ([publib]:1:206467)
at i ([publib]:1:500203)
老哥解决了吗,我也遇到同样的问题,小程序进入后台,或者手机息屏,都无法在进行播放,你后来怎么解决的
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)