修复了点击联系人信息发送消息的时候房间id绑定问题

This commit is contained in:
2025-12-04 10:09:01 +08:00
parent 47fac373b7
commit f54a103de5
6 changed files with 35 additions and 7 deletions

View File

@@ -392,6 +392,11 @@ export function useWebRTC(userId: string, onIncomingCall?: (senderUserId: string
call.status = 'connected'
call.statusText = '通话中'
startCallTimer()
// 确保 pc 已创建
if (!pc) {
await initMedia(call.type === 'video')
await createPC()
}
const offer = await pc!.createOffer()
await pc!.setLocalDescription(offer)
sendSignal('offer', offer)
@@ -412,6 +417,11 @@ export function useWebRTC(userId: string, onIncomingCall?: (senderUserId: string
startCallTimer()
} else if (signal === 'answer') {
// 确保 pc 已创建
if (!pc) {
await initMedia(call.type === 'video')
await createPC()
}
await pc!.setRemoteDescription(content)
processPendingCandidates()