voice: function (event){
var that = this;
clearInterval(that.data.times)
var arr = ['../../image/voice_001.png', '../../image/voice_011.png','../../image/voice_01.png']
const backgroundAudioManager = wx.getBackgroundAudioManager()
backgroundAudioManager.stop()
backgroundAudioManager.onStop(function(){
clearInterval(that.data.times)
that.setData({
bigPic: arr[2]
})
console.log("播放停止");
})
backgroundAudioManager.src = event.target.dataset.url // 设置了 src 之后会自动播放
backgroundAudioManager.onPlay(function(){
console.log("开始播放")
util.play(arr, "bigPic", function (i, time) {
that.setData({
bigPic: arr[i],
times: time
})
})
})
backgroundAudioManager.onEnded(function(){
clearInterval(that.data.times)
that.setData({
bigPic: arr[2]
})
console.log("播放完成");
})
}
现在是需要做一个点击把之前的播放停止然后 立即 重新播放的功能,现在点击之后停止了,但是重新播放无法生效,想知道有什么办法可以让重新播放生效