html52.com
我爱小程序-开发者交流社区

onBackgroundAudioStop callback的bug

问题模块
API和组件

代码如下:

wx.onBackgroundAudioStop(function(res) {

      console.log("In auto stop: ", res)

      console.log("this data", this)

      wx.playBackgroundAudio({

        dataUrl: res.dataUrl,

      })

    })

在开发编辑器中res是有数据的,但是在手机上跑res是个空的,是小程序的bug?


2. 这里的function(res)里的res参数我们可以自定义传入吗?有的话,应该怎么写,求指教!

网友回复

A0000:情随事迁:

在页面销毁的时候调用 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)


Special:

文档中 callback 的 res 是不带有任何参数的,手机上的实现才是正确的,开发者工具中的问题我确认下

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付