Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
useEffect,
useState,
} from 'react';
import { CallingState, useCallStateHooks } from '@stream-io/video-react-sdk';

const EgressReadyNotificationContext = createContext((isReady: boolean) => {
// no-op
Expand All @@ -15,13 +14,10 @@ const EgressReadyNotificationContext = createContext((isReady: boolean) => {

export const EgressReadyNotificationProvider = (props: PropsWithChildren) => {
const [isReady, setIsReady] = useState(false);
const { useCallCallingState } = useCallStateHooks();
const callingState = useCallCallingState();
useEffect(() => {
if (isReady || callingState !== CallingState.JOINED) return;
if (isReady) return;
// it could happen that components won't notify us that they are ready
// in that case, we start recording anyway after 4 seconds.
console.log('Egress: Started waiting for components to notify readiness');
const timeout = setTimeout(() => {
if (!isReady) {
console.log('Timeout: Egress is ready');
Expand All @@ -32,7 +28,7 @@ export const EgressReadyNotificationProvider = (props: PropsWithChildren) => {
return () => {
clearTimeout(timeout);
};
}, [callingState, isReady]);
}, [isReady]);

const spyIsReady = useCallback((value: boolean) => {
setIsReady((current) => {
Expand Down
Loading