网页之间打电话用webrtc

This commit is contained in:
2025-12-16 10:21:29 +08:00
parent 46a4bf26cf
commit 5a977f1b7c

View File

@@ -170,10 +170,10 @@ export function useWebRTC(
// WebRTC 模式:创建 Offer只有 useRTMP 为 false 时才使用 WebRTC // WebRTC 模式:创建 Offer只有 useRTMP 为 false 时才使用 WebRTC
if (!useRTMP.value) { if (!useRTMP.value) {
console.log('[WebRTC] WebRTC 模式:创建 Offer') console.log('[WebRTC] WebRTC 模式:创建 Offer')
if (!pc) await createPC() if (!pc) await createPC()
const offer = await pc!.createOffer() const offer = await pc!.createOffer()
await pc!.setLocalDescription(offer) await pc!.setLocalDescription(offer)
sendSignal('offer', offer) sendSignal('offer', offer)
} else { } else {
console.log('[WebRTC] RTMP 模式:等待 FLV 流') console.log('[WebRTC] RTMP 模式:等待 FLV 流')
} }
@@ -531,7 +531,7 @@ export function useWebRTC(
// RTMP 模式:加入房间后会自动开始 WebSocket 推流 // RTMP 模式:加入房间后会自动开始 WebSocket 推流
} else { } else {
console.log('[WebRTC] 📡 使用 WebRTC 模式') console.log('[WebRTC] 📡 使用 WebRTC 模式')
await createPC() await createPC()
} }
playRingtone('dialing') playRingtone('dialing')
@@ -570,7 +570,7 @@ export function useWebRTC(
await joinCallRoomAndGetFlvUrls() await joinCallRoomAndGetFlvUrls()
} else { } else {
console.log('[WebRTC] 📡 接听:使用 WebRTC 模式') console.log('[WebRTC] 📡 接听:使用 WebRTC 模式')
await createPC() await createPC()
} }
console.log('[WebRTC] 📤 发送 accepted 信令给:', currentReceiverUserId) console.log('[WebRTC] 📤 发送 accepted 信令给:', currentReceiverUserId)