收藏
回答

wx.getBackgroundAudioManager() ios加载问题过长

wx.getBackgroundAudioManager()  在安卓第一次加载播放时间很快,但在ios上第一次加载很慢,有时能有几分钟,怎么回事?

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

1 个回答

  • 是小白啊
    是小白啊
    2019-07-12

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

    2019-07-12
    有用
    回复 5
    • 堕落心焰
      堕落心焰
      2019-07-12

      具体机型:iPhone 7 ,iPhone X  微信版本号:7.0.4  系统版本号:IOS 12.3.1  

      复现代码:

      audio.title = this.data.programName;
            audio.src = this.data.src;
            audio.singer = this.data.anchorName;
            audio.coverImgUrl = this.data.programImage;
            this.playAudio();//播放音频
            let that = this;
            audio.onTimeUpdate(function () {
              console.log(audio.currentTime);
              that.setData({
                startTime: that.dateFormat(audio.currentTime),
                duration: that.dateFormat(audio.duration),
                offset: (audio.currentTime / audio.duration).toFixed(2) * 100,
                currentTime:parseInt(audio.currentTime)
              })
              app.globalData.currentAudioTime = audio.currentTime
              setTimeout(() => {
                wx.hideLoading();
              }, 300);
            })
                 
            //音频自然播放完成
            audio.onEnded(() => {
              clearInterval(app.globalData.backDmTimer)
              app.globalData.currentAudioTime=0;
              app.globalData.programBackId="";
              this.setData({
                audioOperateImg: '/pageimg/now_play.png',
                offset:100,
                startTime: this.dateFormat(audio.duration)
              });
              // 加载音频
              audio.onWaiting(() => {
                wx.showLoading({
                  title: '音频加载中…'
                });
              })
              audio.title = this.data.programName;
              audio.src = this.data.src;
              audio.singer = this.data.anchorName;
              audio.coverImgUrl = this.data.programImage;
              this.pauseAudio();//播放音频
              let that = this;
              audio.onTimeUpdate(function () {
                console.log(audio.currentTime);
                that.setData({
                  startTime: that.dateFormat(audio.currentTime),
                  duration: that.dateFormat(audio.duration),
                  offset: (audio.currentTime / audio.duration).toFixed(2) * 100,
                  currentTime: parseInt(audio.currentTime)
                })
                app.globalData.currentAudioTime = audio.currentTime
                setTimeout(() => {
                  wx.hideLoading();
                }, 300);
              })
            })

      截图:


      描述:

      点进来之后,一直在加载,也无onWaiting响应,MP4格式几分钟,安卓无问题;AAC格式也要几十秒,安卓无法打开,报文件错误。

      http://video.cundtfm.com/661ae809vodcq1259235912/f8d8f3f85285890791418648563/f0.mp4

      http://video.cundtfm.com/661ae809vodcq1259235912/c10ee4955285890791421261899/f0.aac

      2019-07-12
      回复
    • 是小白啊
      是小白啊
      2019-07-12回复堕落心焰

      这个格式的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

      2019-07-12
      回复
    • 堕落心焰
      堕落心焰
      2019-07-12
      https://developers.weixin.qq.com/s/L30xcOmO7s9i 只有在真机上iphone才会出现
      2019-07-12
      回复
    • 是小白啊
      是小白啊
      2019-07-12回复堕落心焰

      不支持MP4格式,aac格式这边测试是正常的

      2019-07-12
      回复
    • 堕落心焰
      堕落心焰
      2019-07-12回复是小白啊
      aac是可以,但加载时间也不短,而且安卓是不支持aac,会显示播放文件错误; mp4格式是支持的,也是同样的问题,在ios上第一次加载时间太长,安卓没有这样的问题
      2019-07-12
      回复
登录 后发表内容