this.audioCtx.play();
发布于 6 年前 作者 yang54 8365 次浏览 来自 问答

工具上可以播放 ios真机上不能播放  怎么回事

10 回复

解决了吗 我现在也是遇到IOS不能播放语音 安卓正常

你自己的可以在ios上播放出声音吗?

that.audioCtx = wx.createAudioContext(‘myAudio’);

wx.downloadFile({
      url: that.data.mysite + '/data/step_stand.mp3',
      success: function (res) {
        that.audioCtx.setSrc(res.tempFilePath);
        that.audioCtx.play();
        setTimeout(function () {
          wx.downloadFile({
            url: that.data.mysite + '/data/step_walk.mp3',
            success: function (res) {
              that.audioCtx.setSrc(res.tempFilePath);
              that.audioCtx.play();
              setTimeout(function(){
                that.startBtn();
                setTimeout(that.autofinish, 10000);
              },4000)
            }
          })
        }, 6000);
         
      }
    })

帮我看下,是有啥问题吗?

onLoad: function () {
    var that = this;
    that.audioCtx = wx.createAudioContext('myAudio');
    wx.downloadFile({
      url: that.data.mysite + '/data/step_stand.mp3',
      success: function (res) {
        that.audioCtx.setSrc(res.tempFilePath);
        that.audioCtx.play();
        setTimeout(function () {
          wx.downloadFile({
            url: that.data.mysite + '/data/step_walk.mp3',
            success: function (res) {
              that.audioCtx.setSrc(res.tempFilePath);
              that.audioCtx.play();
              setTimeout(function(){
                that.startBtn();
                setTimeout(that.autofinish, 10000);
              },4000)
            }
          })
        }, 6000);
         
      }
    })
    that.onTimeChange();
     
    
  },

你是咋写的,我看下,我这边没找出来是啥问题

可以  肯定是代码的原因  多测一测

这个我写了,代码里面我没有复制进去

我这边安卓播放有声音,但是ios上面就没有声音

回到顶部