音频的onPlay和onStop,重复执行,执行的函数次数累加
<!–pages/bofang/bofang.wxml–>
<button bindtap=‘bofang’>播放录音</button>
// pages/bofang/bofang.js
const innerAudioContext = wx.createInnerAudioContext();
Page({
bofang: function () {
innerAudioContext.src = “https://oss.medkr.com/files/1520504115434.m4a”;
innerAudioContext.play();
innerAudioContext.onPlay((res) => {
console.log(‘开始播放’)
})
innerAudioContext.onEnded((res) => {
console.log(‘播放完了’)
})
innerAudioContext.onStop((res) => {
console.log(‘播放停止’)
})
},
})
