收藏
回答

背景音乐onTimeUpdate首次监听成功,第二次(下一首)onNext调用要求返回SRC?

第一次成功播放,下一首(第二次)触发backgroundAudioManager.onTimeUpdate要求设置title及src

thirdScriptError

setBackgroundAudioState:fail title is nil!;at App setPlayVoiceId function;at api setBackgroundAudioState fail callback function

Error: setBackgroundAudioState:fail title is nil!

    at Function.fail (http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:938593)

    at Object.fail (http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:127395)

    at v (http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:538029)

    at http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:539188

    at http://127.0.0.1:30613/appservice/__dev__/asdebug.js:1:12057

    at Object.n [as invoke] (http://127.0.0.1:30613/appservice/__dev__/asdebug.js:1:11693)

    at Object.invoke (http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:223844)

    at l (http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:536584)

    at http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:539170

    at y (http://127.0.0.1:30613/appservice/__dev__/WAService.js:2:539281)

//调用组件playerprogressbar
  backgroundAudioManager.onTimeUpdate(() => {
        /* console.log('onTimeUpdate') */
      }) 

//player播放Page页面
 onLoad: function (options) {
    /* console.log(options) */
    let _id = options.aId
    //获取列表信息序号
    nowPlayingIndex = options.index
    //获取本地存储信息
    beautylist = wx.getStorageSync('beautylist')
    this._loadArticleDetail(_id)
 }
 _loadArticleDetail(_id) {

    let articleDetail = beautylist[nowPlayingIndex]
/*     console.log(articleDetail) */
    this.setData({
      articleDubbing: articleDetail.articlevoice,
      articleTitle: articleDetail.title,
      isPlaying: false,
    })
    wx.showLoading({
      title: '配音加载中',
    })
    console.log(this.data.articleDubbing, this.data.articleTitle, _id)
    backgroundAudioManager.src = this.data.articleDubbing
    backgroundAudioManager.title = this.data.articleTitle
      this.setData({
        isPlaying: true
      })
      wx.hideLoading() 
  },

//bindtap 下一首
onNext() {
    nowPlayingIndex++
    if (nowPlayingIndex === beautylist.length) {
      nowPlayingIndex = 0
    }
    this._loadArticleDetail(beautylist[nowPlayingIndex]._id)
    },  
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签