音频播放概率性失败
发布于 5 年前 作者 tding 4443 次浏览 来自 问答

请教一下,我现在使用

wx.createInnerAudioContext

这个接口,进行播放mp3格式的音频文件,src是http://www.xxx.com/xxx.mp3,

现在经常出现点了不播方法,触发了onplay事件,但是不触发onended事件 情况

我在开发工具中怎么点都能播放,在真机上就概率性(较大概率)出现上述情况

手机是iPhonese。

麻烦指导下

const app = getApp();
const recorderManager = wx.getRecorderManager();
const innerAudioContext = wx.createInnerAudioContext();
var util = require('../../utils/util.js');
Page({
 。。。。。
  //语音播放
  audioPlay: function (e) {
    var that = this,
     innerAudioContext.stop();
     innerAudioContext.src = url;
      innerAudioContext.play();
    }
  },
onLoad: function (options) {
    var that = this;
    /***音频组件开始 */
    innerAudioContext.obeyMuteSwitch = false;
    innerAudioContext.onPlay(() => {
      console.log("onplay is running")
      var i = that.data.i;
       that.setData({
        playID: i
      });
    })
    innerAudioContext.onEnded(() => {
      console.log("onEnded is running")
      var i = that.data.i;
       if (that.data.playID > -1) {
        that.setData({
          playID: -1
        })
      }
}
})
4 回复

官方的朋友能看看么

同样的问题,尝试了各种办法,音频接口都试了一遍,概率性失败,概率还不小,官方也没回个话

这个问题是没审核通过么,怎么没人回复……

这就沉了么…… 谁来解答下

回到顶部