fix: validate screen share connection state

This commit is contained in:
illusia committed 2026-09-21 04:59:08 +08:00
1 parent ae530963bf
commit fb39d82c01
1 file changed
+5 -1
+5 -1
View File
@@ -1715,7 +1715,11 @@ export function useVoiceWebSocket() {
screenShareViewing.value = true;
};
peer.onconnectionstatechange = () => {
if (peer.connectionState === "connected" || peer.connectionState === "completed") {
// `completed` belongs to RTCIceConnectionState, not the aggregate
// RTCPeerConnection.connectionState. Treating it as a connection state
// both trips the type checker and can hide the actual failed/closed
// transitions we need to handle here.
if (peer.connectionState === "connected") {
clearScreenSharePeerTimer(peerId);
} else if (peer.connectionState === "failed") {
failScreenSharePeer(peerId);