有关音频audio(疑似bug)
发布于 7 年前 作者 yyi 12537 次浏览 来自 问答
getInnerAudioContext:function(entry){
      if (this.audioCtx && this.audioSrc == entry.src){
        console.log(1111111);
        this.audioCtx.seek = this.duration;
        this.audioPlay();
        return;
      }
      if (this.audioCtx && (entry.src != this.audioSrc || !entry.src)){
        this.audioCtx.destroy;
        console.log(222222);
      }
      console.log(33333333);
      this.audioCtx = wx.createInnerAudioContext();
      this.audioCtx.autoplay = true;
      this.audioCtx.src = entry.src;
      this.audioSrc = entry.src
    },
 
    audioPlay:function(){
      this.audioCtx.play();
      this.audioCtx.onPlay(()=>{
        console.log('开始播放');
      });
    },
 
    audioPause:function(){
      if (!this.audioCtx){
        return;
      }
      this.audioCtx.pause();
      this.audioCtx.onPause(() => {
        console.log('暂停播放');
        this.duration = this.audioCtx.duration;
      });
    },

外部直接调用getInnerAudioContext并传src

我连续播放暂停,看以下日志

问题在于:多次打印

@大神、@官方。我问题出在哪?文档说明有点少,第一次做没点头绪,望告知,感激不尽

3 回复

问题解决了吗 我也想知道为什么会多次打印

还没搞懂

回到顶部