苹果手机无法播放音频,点击音频没有反应。?

小程序 文章 2021-03-08 14:01 1780 0 全屏看文

AI助手支持GPT4.0

苹果手机无法播放音频,点击音频没有反应。?The iPhone cannot play audio, and there is no response to clicking on the audio. ?

苹果手机无法播放音频,点击音频没有反应。?


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

  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('音频加载中事件,当音频因为数据不足,需要停下来加载时会触发')

    });


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









Apple's list audio can't be played. After setting the code on the Internet, it still doesn't work. Click the play music button to trigger const inneraudiocontext= wx.createInnerAudioContext () / / play the recording console.log (e. target.dataset.id +"= = = = = play audio path = = ="+ JSON.stringify (e)) if ( wx.setInnerAudioOption ) { wx.setInnerAudioOption ({ obeyMuteSwitch: false, autoplay: true }) }else { innerAudioContext.obeyMuteSwitch = false; innerAudioContext.autoplay = true; } innerAudioContext.autoplay =True / / auto play innerAudioContext.src = " https://wish.a2a.xin "+e. target.dataset.id , //The address of the audio resource for direct playback innerAudioContext.onPlay (() => { console.log ('Start playing ')}) / / monitor each stage innerAudioContext.onCanplay (() => { console.log ('can play ');}; innerAudioContext.onPlay (() => { console.log ('listen to audio and start playing ');}); innerAudioContext.onEnded (() => { console.log ('audio natural play end event ');}); innerAudioContext.onStop (() => { console.log ('audio stop event ');}); innerAudioContext.onError ((res) => { console.log ( res.errMsg ); console.log ( res.errCode ); }); innerAudioContext.onWaiting ((res) => { console.log ('audio loading event, which will be triggered when the audio needs to stop to load due to insufficient data ')}); the playback audio triangle of Apple phone still has no response

回答:

😮😮:

换一个视频格式看看呢

洋洋:.视频可以播放
😮😮:我的意思是小程序只支持这几种格式,其他的不一定支持
😮😮:这个是音频。。
黄sir:

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


洋洋:/file/wx74120210306151835.mpeg   这个就是服务器返回的,域名后面的数据,有反斜杠
张有釜:

最好有代码片段

洋洋:有的,代码片段,文章中
陈宇明:

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

洋洋:https://wish.a2a.xin/file/wx74120210306151835.mpegt安卓手机就可以播放,苹果手机无法播放

-EOF-

AI助手支持GPT4.0