Closed pavel-khudiakov-effectiff closed 1 year ago
I think the problem is somewhere inside getAudioAndVideoTracks()
in PreJoinScreens.tsx
:
1) If we use NextJS with reactStrictMode: true
, it permanently uses mic and camera, because of useEffect
without return
. Probably I should add:
return () => { localTracks.forEach((track) => track.stop()); };
2) Then if I skip <DeviceSelectionScreen />
and replace it with <Button onClick={handleJoin}>
instead, I facing some async problem:
How should I init camera and mic in a correct way, when I skip DeviceSelectionScreen part? I need it to accept incoming call without device checks.
The problem is reproduced if isAcquiringLocalTracks
is true
at the same time while we are trying to get publications from usePublications
. I modify my example for join on submit:
Now it's easier to reproduce. Probably the problem is somewhere inside async operations.
I tried any variation if (isAcquiringLocalTracks) return <Spinner>
or waiting isAcquiringLocalTracks
before call handleJoin()
, but it's not helping.
Add commit 'debug 2':
1) When I try to call handleJoin()
from useEffect
with if (!isAcquiringLocalTracks) ...
it is still black screen:
useEffect(() => {
if (isJoining && !isAcquiringLocalTracks) {
handleJoin();
}
}, [isJoining, isAcquiringLocalTracks]);
2) But if I click at the button (after it is no more disabled), everything is fine:
<Button
variant="contained"
color="primary"
data-cy-join-now
onClick={handleJoin}
disabled={isAcquiringLocalTracks}
>
Now it's working:
https://github.com/twilio/twilio-video-app-react/commit/732d70453dbeb3d4625696b6af58fb520afa3b34
If anyone has better ideas, please feel free to text me.
Question Hello everyone! My version is 0.7.1.
I need to skip
deviceSelectionStep
, but if I replace (for example)<DeviceSelectionScreen …>
to<Button onClick={handleJoin}>
inPreJoinScreens.tsx
, after join the room my video is black (it's switching on after double click on/off) and microphone is muted forever.Can't understand why. Red dot on Chrome tab showing that video and audio tracks is working.
Additional context![image](https://user-images.githubusercontent.com/110397629/207753079-50c7ef8c-d2a3-40ef-a869-5eaab38f3427.png)