Skip to content

Commit

Permalink
fix: resolve issue with echo and missing remote video for callee
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Dec 20, 2023
1 parent c7f6300 commit 2127609
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
9 changes: 5 additions & 4 deletions mods/frontoffice/src/components/chat/video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,18 @@ export const FOVideo = forwardRef((props: FOVideoProps, ref) => {
</HeaderContainer>
</Header>
<RemoteVideoContainer>
<audio style={{ display: "none" }} id="goodtok-audio" controls>
<p>Your browser doesn't support HTML5 audio.</p>
</audio>
<RemoteVideo ref={remoteVideoRef} className="goodtok-video__remote" />
{props.isLocalCameraMuted && (
<MutedOverlay>
<MutedCameraIcon />
</MutedOverlay>
)}
<LocalVideoContainer>
<LocalVideo ref={localVideoRef} className="goodtok-video__local" />
<LocalVideo
ref={localVideoRef}
className="goodtok-video__local"
muted
/>
</LocalVideoContainer>
<Controls>
<ButtonCircleWrapper onClick={() => props.onMuteMicrophone()}>
Expand Down
11 changes: 7 additions & 4 deletions mods/frontoffice/src/containers/ChatContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ function ChatContainer() {
};

const onCustomerDequeue = async () => {
// TODO: If peer exist and is connected, hangup

const queues = new SDK.Queues(client);
queues.updateQueueEntryStatus({
workspaceId,
Expand All @@ -200,7 +198,12 @@ function ChatContainer() {
};

const handleHangup = async () => {
// TODO: If peer exist and is connected, hangup
// Release media resources
if (localStream) {
localStream.getTracks().forEach((track) => track.stop());
}

// TODO: remotePeer.close();
};

const handleMuteCamera = async () => {
Expand All @@ -219,7 +222,7 @@ function ChatContainer() {
if (peer) {
setIsLocalMicrophoneMuted(!isLocalMicrophoneMuted);
localStream!.getAudioTracks().forEach((track) => {
track.enabled = true;
track.enabled = !track.enabled;
});
}
};
Expand Down
4 changes: 3 additions & 1 deletion mods/widget/src/GoodtokUA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const GoodtokUA = () => {
});

peer.on("call", (mediaConnection: MediaConnection) => {
mediaConnection.answer(localStream);
mediaConnection.answer(stream);

mediaConnection.on("stream", (stream) => {
remoteVideo.srcObject = stream;
Expand Down Expand Up @@ -243,6 +243,8 @@ const GoodtokUA = () => {
localStream.getTracks().forEach((track) => track.stop());
}

// TODO: remotePeer.close();

// TODO: If is connected, unregister, disconnect and hangup
break;
}
Expand Down
9 changes: 5 additions & 4 deletions mods/widget/src/components/video/MobileVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,18 @@ export const MobileVideo = forwardRef((props: VideoProps, ref) => {
return (
<MobileVideoContainer style={{ display: props.isOpen ? "block" : "none" }}>
<RemoteVideoContainer>
<audio style={{ display: "none" }} id="goodtok-audio" controls>
<p>Your browser doesn't support HTML5 audio.</p>
</audio>
<RemoteVideo ref={remoteVideoRef} className="goodtok-video__remote" />
{isCustomerCameraMuted && (
<MutedOverlay>
<MutedCameraIcon />
</MutedOverlay>
)}
<LocalVideoContainer>
<LocalVideo ref={localVideoRef} className="goodtok-video__local" />
<LocalVideo
ref={localVideoRef}
className="goodtok-video__local"
muted
/>
</LocalVideoContainer>
<Controls>
<ButtonCircleWrapper
Expand Down
9 changes: 5 additions & 4 deletions mods/widget/src/components/video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,18 @@ export const Video = forwardRef((props: VideoProps, ref) => {
</HeaderContainer>
</Header>
<RemoteVideoContainer>
<audio style={{ display: "none" }} id="goodtok-audio" controls>
<p>Your browser doesn't support HTML5 audio.</p>
</audio>
<RemoteVideo ref={remoteVideoRef} className="goodtok-video__remote" />
{isCustomerCameraMuted && (
<MutedOverlay>
<MutedCameraIcon />
</MutedOverlay>
)}
<LocalVideoContainer>
<LocalVideo ref={localVideoRef} className="goodtok-video__local" />
<LocalVideo
ref={localVideoRef}
className="goodtok-video__local"
muted
/>
</LocalVideoContainer>
<Controls>
<ButtonCircleWrapper
Expand Down

0 comments on commit 2127609

Please sign in to comment.