File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
sample-apps/react/egress-composite/src/hooks Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 66 useEffect ,
77 useState ,
88} from 'react' ;
9+ import { CallingState , useCallStateHooks } from '@stream-io/video-react-sdk' ;
910
1011const EgressReadyNotificationContext = createContext ( ( isReady : boolean ) => {
1112 // no-op
@@ -14,10 +15,13 @@ const EgressReadyNotificationContext = createContext((isReady: boolean) => {
1415
1516export const EgressReadyNotificationProvider = ( props : PropsWithChildren ) => {
1617 const [ isReady , setIsReady ] = useState ( false ) ;
18+ const { useCallCallingState } = useCallStateHooks ( ) ;
19+ const callingState = useCallCallingState ( ) ;
1720 useEffect ( ( ) => {
18- if ( isReady ) return ;
21+ if ( isReady || callingState !== CallingState . JOINED ) return ;
1922 // it could happen that components won't notify us that they are ready
2023 // in that case, we start recording anyway after 4 seconds.
24+ console . log ( 'Egress: Started waiting for components to notify readiness' ) ;
2125 const timeout = setTimeout ( ( ) => {
2226 if ( ! isReady ) {
2327 console . log ( 'Timeout: Egress is ready' ) ;
@@ -28,7 +32,7 @@ export const EgressReadyNotificationProvider = (props: PropsWithChildren) => {
2832 return ( ) => {
2933 clearTimeout ( timeout ) ;
3034 } ;
31- } , [ isReady ] ) ;
35+ } , [ callingState , isReady ] ) ;
3236
3337 const spyIsReady = useCallback ( ( value : boolean ) => {
3438 setIsReady ( ( current ) => {
You can’t perform that action at this time.
0 commit comments