收藏
回答

wx.createInnerAudioContent()无法在ios系统中播放?

在使用wx.createInnerAudioContent()时,逻辑相同的代码,自己的代码+音频可播放,别人的代码+音频就不可播放了。但是都是mp3,用了格式工厂,怎么搞也不会出现音频码率什么的差别太大的问题吧。

在别人电脑上用自己的代码+别人的音频,也无法播放。

界面

<view class="container">
  <image wx:if="{{!isPlay}}" bind:tap="play" class="record" src="/icons/record-0.png"></image>
  <image wx:else bind:tap="pause" class="record" src="/icons/record-ing.png"></image>
  <image bind:tap="stop" class="record" src="/icons/record-stop.png"></image>
</view>


JS

// pages/index/index.js
Page({


  /**
   * 页面的初始数据
   */
  data: {
    music: {},
    isPlay: false,
    content: {
      src: "cloud://===========================/01.mp3"
    }
  },


  play(){
    const music = this.data.music;
    music.play()
    this.setData({
      isPlay: true
    })
  },
  pause(){
    const music = this.data.music;
    music.pause()
    this.setData({
      isPlay: false
    })
  },
  stop(){
    const music = this.data.music;
    music.stop()
    this.setData({
      isPlay: false
    })  
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const music = wx.createInnerAudioContext();
    music.src = this.data.content.src;


    this.setData({
      music
    })
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {


  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {


  },


  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    this.stop()
  },


  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    this.stop()
  },


  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {


  },


  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {


  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {


  }
})
回答关注问题邀请回答
收藏

1 个回答

  • 社区技术运营专员--许涛
    社区技术运营专员--许涛
    2022-04-23

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

    2022-04-23
    有用
    回复 2
    • 天路上的大锤子
      天路上的大锤子
      发表于移动端
      2022-04-25
      谢谢~不用啦~之前用fieID一直播放不出来。改用下载地址就OK了
      2022-04-25
      回复
    • 天路上的大锤子
      天路上的大锤子
      发表于移动端
      2022-04-25
      使用的是下载地址中不带参数的那部分(?之前的内容)
      2022-04-25
      回复
登录 后发表内容