结果
function loopVoice(srcs,maxtimes) {
let secondIAC = wx.createInnerAudioContext()
secondIAC.obeyMuteSwitch = false
secondIAC.onError(() => {
showToast({
icon: 'none',
title: '加载失败',
})
})
let times = 0
secondIAC.src = src[times]
secondIAC.onPlay(() => {
times++
})
secondIAC.onEnded(() => {
if (times === maxtimes) {
secondIAC.destroy()
}
secondIAC.src = src[times]
secondIAC.play()
})
secondIAC.play()
}
复制代码
起因
今天我在社区发