let innerAudioContext = uni.createInnerAudioContext({
useWebAudioImplement: true
})
innerAudioContext.src = encodeURI(this.audio)
innerAudioContext.autoplay = true
innerAudioContext.volume = 0
innerAudioContext.startTime = 0
innerAudioContext.play();
const getDuration = () => {
setTimeout(() => {
if (innerAudioContext.duration === 0) {
getDuration();
} else {
this.duration = innerAudioContext.duration;
innerAudioContext.stop();
innerAudioContext.src = "";
innerAudioContext.autoplay = false;
innerAudioContext.destroy();
}
}, 100);
}
innerAudioContext.onPlay(getDuration);
找到问题了吗?是不是微信的bug?