Skip to content

Commit

Permalink
fix: updated onclick-function to mute output-audio
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Apr 19, 2024
1 parent bdb3a88 commit 00c757e
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/components/production-line/production-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export const ProductionLine: FC = () => {
inputAudioStream.getTracks().forEach((t) => {
// eslint-disable-next-line no-param-reassign
t.enabled = !mute;
setIsInputMuted(mute);
});
setIsInputMuted(mute);
}
},
[inputAudioStream]
Expand Down Expand Up @@ -106,16 +106,13 @@ export const ProductionLine: FC = () => {
sessionId,
});

const muteOutput = useCallback(
(mute: boolean) => {
audioElements.map((singleElement: HTMLAudioElement) => {
// eslint-disable-next-line no-param-reassign, no-return-assign
singleElement.muted = !mute;
return setIsOutputMuted(!mute);
});
},
[audioElements]
);
const muteOutput = useCallback(() => {
audioElements.forEach((singleElement: HTMLAudioElement) => {
// eslint-disable-next-line no-param-reassign
singleElement.muted = !isOutputMuted;
setIsOutputMuted(!isOutputMuted);
});
}, [audioElements, isOutputMuted]);

const line = useLinePolling({ joinProductionOptions });

Expand Down Expand Up @@ -196,10 +193,7 @@ export const ProductionLine: FC = () => {
<div>
<DisplayContainerHeader>Controls</DisplayContainerHeader>
<TempDiv>
<UserControlBtn
type="button"
onClick={() => muteOutput(isOutputMuted)}
>
<UserControlBtn type="button" onClick={() => muteOutput()}>
<ButtonIcon>
{isOutputMuted ? <SpeakerOff /> : <SpeakerOn />}
</ButtonIcon>
Expand Down

0 comments on commit 00c757e

Please sign in to comment.