机型:华为鸿蒙手机(HarmonyOS)
微信版本:8.0.17
基础库:3.16.0
复现步骤:小程序中使用 uni.createInnerAudioContext() 播放网络音频(https://dict.youdao.com/dictvoice),连续快速切换音频源时小程序闪退
错误信息:received error code -1 on dm-29-30-1/1-(195)-1779458713201
// 最小复现:连续创建 InnerAudioContext 播放网络音频,鸿蒙手机微信闪退
Page({
data: {
words: ['hello', 'world', 'apple', 'banana', 'orange'],
index: 0
},
onLoad() {
this.playNext()
},
playNext() {
if (this.data.index >= this.data.words.length) return
const word = this.data.words[this.data.index]
const audio = wx.createInnerAudioContext()
audio.src = 'https://dict.youdao.com/dictvoice?audio=' + word + '&type=1'
audio.onEnded(() => {
audio.destroy()
this.setData({ index: this.data.index + 1 })
this.playNext()
})
audio.onError(() => {
audio.destroy()
this.setData({ index: this.data.index + 1 })
this.playNext()
})
audio.play()
}
})
iOS/Android 同样代码无此问题,仅鸿蒙手机微信复现
说明:此代码在 iOS/Android 微信正常运行,在鸿蒙手机微信上运行 2-5 个词后闪退,报 error code -1。
