收藏
回答

InnerAudioContext播放音频,seek()在真机上有时候就失灵了,怎么处理?

InnerAudioContext播放音频,在真机上报{errCode: 10001, errMsg: "errCode:62, err:load or init native decode so fail"},而且经常会有seek()失效的问题,怎么解决

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

1 个回答

  • 是小白啊
    是小白啊
    2019-11-15

    麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2019-11-15
    有用
    回复 12
    • 田坤
      田坤
      2019-11-18
      2019-11-18
      回复
    • 田坤
      田坤
      2019-11-18
      2019-11-18
      回复
    • 田坤
      田坤
      2019-11-18
      2019-11-18
      回复
    • 田坤
      田坤
      2019-11-18
      2019-11-18
      回复
    • 田坤
      田坤
      2019-11-18
      initInnerAudioContext() {
          let that = this;
          // 创建音频上下文
          let iac = wx.createInnerAudioContext();
          iac = wx.createInnerAudioContext();
          iac.src = that.data.audiosrc;
          // 监听音频播放事件
          iac.onPlay(() => {
            console.log('onPlay');
            that.setData({
              isplay: true
            });
          });
          // 监听音频播放进度更新事件
          iac.onTimeUpdate(function() {
            if (that.data.isdrag) {
              return;
            }
            let duration = iac.duration;
            let value = iac.currentTime;
            that.setData({
              max: duration,
              value: value
            });
          });
          iac.onWaiting(function() {
            console.log('onWaiting');
            that.setData({
              isloading: true
            });
          });
          iac.onCanplay(function() {
            console.log('onCanplay')
            that.setData({
              isloading: false
            });
          });
          // 监听音频暂停事件
          iac.onPause(function() {
            console.log('onPause');
            that.setData({
              isplay: false
            });
          });
          // 监听音频停止事件
          iac.onStop(function() {
            console.log('onStop');
            that.setData({
              isplay: false
            });
            iac.seek(0);
          });
          // 监听音频自然播放至结束的事件
          iac.onEnded(function() {
            console.log('onEnded');
            that.setData({
              isplay: false
            });
            iac.seek(0);
          });
          // 监听音频播放错误事件
          iac.onError(err => {
            console.log('监听音频播放错误事件', err, iac.src);
            that.setData({
              isplay: false,
              isloading: false
            });
            util.progressTips('音频播放失败!');
          });
          that.setData({
            iac: iac
          });
        }
      2019-11-18
      回复
    查看更多(7)
登录 后发表内容
问题标签