收藏
回答

Iphone 6s plus用wx.createInnerAudioContext播放音频无声音?

Iphone 6s plus 微信版本8.0.15【最新版本了】基础库版本2.33.0

<audio poster="{{poster}}" name="{{name}}" author="{{author}}" src="{{src}}" id="myAudio" controls loop></audio>


<button type="primary" bindtap="audioPlay">播放</button>
<button type="primary" bindtap="audioPause">暂停</button>
<button type="primary" bindtap="audio14">设置当前播放时间为14秒</button>
<button type="primary" bindtap="audioStart">回到开头</button>

------------------------

Page({
  onReadyfunction (e{
    wx.setInnerAudioOption({
      obeyMuteSwitchfalse,
      successe => {
        console.log("sussess: " + e.errMsg);
      },
      faile => {
        console.log("error: " + e.errMsg)
      }
    })
    this.audioContext = wx.createInnerAudioContext({
      useWebAudioImplementtrue,
    })
    this.audioContext.src = this.data.src;
    // 使用 wx.createAudioContext 获取 audio 上下文 context
    // this.audioCtx = wx.createAudioContext('myAudio')
  },
  data: {
    poster'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000',
    name'此时此刻',
    author'许巍',
    src'https://ltssimg.ershengsan.cn/405e24e867384e28a8ce3683d9f82ba4.mp3',
  },
  audioPlayfunction () {
    this.audioContext.play();
    // this.audioCtx.play()
  },
  audioPausefunction () {
    this.audioContext.pause();
    // this.audioCtx.pause()
  },
  audio14function () {
    this.audioContext.seek(14);
    // this.audioCtx.seek(14)
  },
  audioStartfunction () {
    this.audioContext.seek(0);
    // this.audioCtx.seek(0)
  }
})
回答关注问题邀请回答
收藏
登录 后发表内容