Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix not diplaying video when audio is present #5

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions src/components/WebRTCView/WebRTCView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
const [isConnected, setIsConnected] = React.useState<boolean>(false);
const [retryAttempts, setRetryAttempts] = React.useState(0);
const [shouldRetry, setShouldRetry] = React.useState(false);
const [remoteStream, setRemoteStream] = React.useState<MediaStream | null>(
null,
const [remoteStream, setRemoteStream] = React.useState<MediaStream>(

Check failure on line 38 in src/components/WebRTCView/WebRTCView.tsx

View workflow job for this annotation

GitHub Actions / lint

'setRemoteStream' is assigned a value but never used. Allowed unused vars must match /^_/u
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't need to actually use the setRemoteStream function you can just prefix it with an underscore (_setRemoteStream) to prevent that linting error.

But the way this is working now looks like it should be fine. Will test in a bit, having some weird device issues at the moment lol

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good to know! No worries, hopefully all works okay.

new MediaStream(undefined),
);
const [localStream, setLocalStream] = React.useState<MediaStream | null>(
null,
Expand All @@ -63,9 +63,7 @@
const track = event?.track;
if (track) {
setIsConnected(true);
const remoteMediaStream = new MediaStream(undefined);
remoteMediaStream.addTrack(track);
setRemoteStream(remoteMediaStream);
remoteStream.addTrack(track);
}
};

Expand Down Expand Up @@ -169,6 +167,7 @@
if (!isWsOpen) {
throw 'Websocket not open yet';
}

const pc = peerConnection;
const ws = wsRef.current;

Expand Down Expand Up @@ -200,6 +199,7 @@
throw new Error('Could not connect');
}
}

setRetryAttempts(0);

// we no longer want to listen to connected state change events
Expand Down Expand Up @@ -237,7 +237,7 @@
return (
<BaseView className="flex-1 mt-4 px-6">
<BaseText className="text-center mb-2 text-red-600 text-lg">
Unable to load streme for {cameraName}
Unable to load stream for {cameraName}
</BaseText>
<TouchableOpacity
className="self-center border border-red-700 p-3 px-6 rounded-md"
Expand Down
Loading