修复web和微信小程序的通话

This commit is contained in:
2025-12-16 15:11:49 +08:00
parent ad73df1498
commit 18b9c8b3a5
2 changed files with 61 additions and 27 deletions

View File

@@ -1011,10 +1011,18 @@ export function useWebRTC(
return null
}
// 如果已有播放器,先销毁
// 如果已有播放器,先完整销毁(必须按顺序调用 pause, unload, detachMediaElement, destroy)
if (stream.player) {
console.log('[WebRTC] 🔄 销毁已有的 FLV 播放器')
stream.player.destroy()
try {
stream.player.pause()
stream.player.unload()
stream.player.detachMediaElement()
stream.player.destroy()
} catch (e) {
console.warn('[WebRTC] 销毁 FLV 播放器时出错:', e)
}
stream.player = undefined
}
console.log('[WebRTC] 🎬 创建 FLV 播放器:', stream.flvUrl)