扫描后调用声音,苹果没有声音?安卓有声音。
发布于 6 年前 作者 fhuang 14644 次浏览 来自 问答
  scanBtn() { 
    wx.scanCode({
      success(res) => {
      this.voice()
      },
      fail(res) => {
      }
    })  //wx.scanCode
  },

  
  voicefunction () {
    let _this=this
    const innerAudioContext = wx.createInnerAudioContext()
    innerAudioContext.autoplay = true
    innerAudioContext.obeyMuteSwitch = false
    innerAudioContext.src = "https://xcx.yearconsports.com/s.mp3"
    innerAudioContext.play()
    innerAudioContext.onPlay(() => {
      console.log('开始播放')
    })
    // innerAudioContext.play();
    innerAudioContext.onError((e) => {
      console.log(e.errMsg)
      console.log(e.errCode)
      _this.voice()
    })
  },

上面这段代码苹果手机在【真机调试】下有声音,在【预览或发布体验版或上线】的时候没声音。为什么?

代码片段:https://developers.weixin.qq.com/s/qlXLXKmK75it

1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部