收藏
回答

wx.getBackgroundAudioManager() 无法后台调用播放

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.getBackgroundAudioManager() 微信安卓客户端 7.0.8 2.8.3

我在全局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)








最后一次编辑于  2019-11-23
回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容
问题标签