Skip to content

Commit

Permalink
fix: updated return on rtc-connection-events-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Dec 5, 2024
1 parent 6e93221 commit 04ee700
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/production-line/use-rtc-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,16 @@ export const useRtcConnection = ({

// Debug hook for logging RTC events TODO remove
useEffect(() => {
if (
!rtcPeerConnectionRef.current ||
rtcPeerConnectionRef.current.connectionState === "closed"
) {
rtcPeerConnectionRef.current = new RTCPeerConnection();
}
const rtcPeerConnection = rtcPeerConnectionRef.current;

if (!rtcPeerConnection) {
return () => {
console.log(
"Exited debug hook for logging RTC events early, no rtcPeerConnection"
);
};
}

const onIceGathering = () =>
console.log("ice gathering:", rtcPeerConnection.iceGatheringState);
const onIceConnection = () =>
Expand Down

0 comments on commit 04ee700

Please sign in to comment.