收藏
回答

onBackgroundAudioStop callback的bug

代码如下:

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参数我们可以自定义传入吗?有的话,应该怎么写,求指教!

回答关注问题邀请回答
收藏

2 个回答

  • Special
    Special
    2017-01-15

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

    2017-01-15
    有用
    回复
  • 罗正.有事加lozn00(弃用)
    罗正.有事加lozn00(弃用)
    2017-06-05

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


    2017-06-05
    有用
    回复
登录 后发表内容