BackgroundAudioManager errCode 10003
发布于 6 年前 作者 xueming 6335 次浏览 来自 官方Issues

这是一个部分用户触发的错误,地区国内。故无法提供可重现的代码,实在抱歉。

# 我们的测试方法

  1. 用户遇到播放错误,且更换地址重试3次都无法解决是,会提示用户,并请示到【测试界面】。

  2. 我们预先准备了4个播放地址(mp3和mp4格式),分别对 BackgroundAudioManager InnerAudioContext 进行测试。

  3. 触发过 time-update 事件则标记为 【正常】并结束测试;触发过 error 事件则标记为 【异常】并结束测试。


# 我们测试代码:

a. BackgroundAudioManager版本  ⬇

Component({
  properties: {
    source: {
      type: Object,
    }
  },
 
  methods: {
    nativePlayData() {
      const self = this;
      const data = this.data.source;
      const backgroundAudioManager = wx.getBackgroundAudioManager();
 
      this.ctx = backgroundAudioManager;
 
      backgroundAudioManager.title = '测试音频'
      backgroundAudioManager.epname = '';
      backgroundAudioManager.singer = '';
      backgroundAudioManager.coverImgUrl = data.shelfPicture;
      backgroundAudioManager.src = data.playUrl;
 
      backgroundAudioManager.onTimeUpdate(this.updateHandler = function(e) {
        self.triggerEvent('time-update', e);
      });
 
      backgroundAudioManager.onError(this.errorHandler = function(res) {
        self.triggerEvent('audio-error', {code: res.errCode, text: res.errCode + res.errMsg});
      });
    },
  },
 
  ready() {
    this.nativePlayData();
  },
 
  detached() {
    this.ctx.stop();
  }
});

b. InnerAudioContext版本  ⬇⬇⬇⬇⬇⬇

Component({
  properties: {
    source: {
      type: Object,
    }
  },
 
  methods: {
    nativePlayData() {
      const self = this;
      const data = this.data.source;
      const innerAudioContext = wx.createInnerAudioContext();
 
      this.ctx = innerAudioContext;
      innerAudioContext.autoplay = true;
      innerAudioContext.src = data.playUrl;
 
      innerAudioContext.onTimeUpdate(this.updateHandler = function(e) {
        self.triggerEvent('time-update', e);
      });
 
      innerAudioContext.onError(this.errorHandler = function(res) {
        self.triggerEvent('audio-error', {code: res.errCode, text: res.errCode + res.errMsg});
      });
    },
  },
 
  ready() {
    this.nativePlayData();
  },
 
  detached() {
    this.ctx.stop();
 
    try {
      this.ctx.offError(this.errorHandler);
    } catch (e) {}
 
    try {
      this.ctx.offTimeUpdate(this.updateHandler);
    } catch (e) {}
  }
});


# 用户检测结果:

下面是经过我们半个月的持续观察,总结出来的信息,希望能帮助找出问题。

  1. 每天影响用户0.2~1%不等。

  2. 用户不可以播放的时候,影响时长为0.5~5天不等。

  3. 跟网络也有一定关系,之前接待的一个用户就是4g不可以播,切到wifi可以;然后再切回4g时,依然不可以

  4. 我们的服务没问题,如图BackgroundAudioManager 不可以, InnerAudioContext 可以。直接网页打开链接也能播。

  5. 多见于IOS。

1 回复

麻烦复现问题的时候在手机微信上传日志: 我->设置->帮助与反馈右上角有个上报日志的入口,提供出现问题的微信号,出现问题的时间点(具体到分钟)

回到顶部