苹果手机无法播放音频,点击音频没有反应。?
发布于 3 年前 作者 min64 4975 次浏览 来自 官方Issues

苹果手机列表音频无法播放问题,在网上做了代码设置还是不生效,点击播放音乐按钮触发

  const innerAudioContext = wx.createInnerAudioContext() //播放录音

 console.log(e.target.dataset.id+"==========播放音频路径====="+JSON.stringify(e))

    if (wx.setInnerAudioOption{

      wx.setInnerAudioOption({

        obeyMuteSwitch: false,

        autoplay: true

      })

    }else {

      innerAudioContext.obeyMuteSwitch = false;

      innerAudioContext.autoplay = true;

    }

    innerAudioContext.autoplay = true //是否自动播放

    innerAudioContext.src = "https://wish.a2a.xin"+e.target.dataset.id, //音频资源的地址,用于直接播放

      innerAudioContext.onPlay(() => {

        console.log('开始播放')

      })

    //监听各个阶段

    innerAudioContext.onCanplay(() => {

      console.log('可以播放');

    });

    innerAudioContext.onPlay(() => {

      console.log('监听到音频开始播放');

    });

    innerAudioContext.onEnded(() => {

      console.log('音频自然播放结束事件');

    });

    innerAudioContext.onStop(() => {

      console.log('音频停止事件');

    });

    innerAudioContext.onError((res) => {

      console.log(res.errMsg);

      console.log(res.errCode);

    });

    innerAudioContext.onWaiting((res) => {

      console.log('音频加载中事件,当音频因为数据不足,需要停下来加载时会触发')

    });


苹果手机的播放音频三角形还是不会有任何反应


4 回复

换一个视频格式看看呢

最好有代码片段

url拼接的时候,前面的字符是不是应该 / 结尾?

检查下是不是你的音频文件的问题

回到顶部