代码如下:
wx.onBackgroundAudioStop(function(res) {
console.log("In auto stop: ", res)
console.log(“this data”, this)
wx.playBackgroundAudio({
dataUrl: res.dataUrl,
})
})
在开发编辑器中res是有数据的,但是在手机上跑res是个空的,是小程序的bug?
- 这里的function(res)里的res参数我们可以自定义传入吗?有的话,应该怎么写,求指教!
在页面销毁的时候调用 onBackgroundAudioStop(nulll)出现崩溃。
WAService.js:3 thirdScriptError
Cannot read property ‘apply’ of null;at pages/story/play/play onUnload function;at onBackgroundAudioStop callback function
TypeError: Cannot read property ‘apply’ of null
at .<anonymous> (http://687585042.appservice.open.weixin.qq.com/WAService.js:3:7221)
at http://687585042.appservice.open.weixin.qq.com/WAService.js:4:27744
at n.<anonymous> (http://687585042.appservice.open.weixin.qq.com/asdebug.js:1:12260)
at n.emit (http://687585042.appservice.open.weixin.qq.com/asdebug.js:1:8658)
at r (http://687585042.appservice.open.weixin.qq.com/asdebug.js:1:1494)
at g (http://687585042.appservice.open.weixin.qq.com/asdebug.js:1:4855)