Skip to content

Commit

Permalink
fix: updated mic-mute toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Apr 10, 2024
1 parent 81b42fe commit 471d909
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/production-line/production-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const UserControlBtn = styled.button`

export const ProductionLine: FC = () => {
// const { productionId, lineId } = useParams();
const [{ joinProductionOptions, audioInput }, dispatch] = useGlobalState();
const [{ joinProductionOptions, mediaStreamInput }, dispatch] =
useGlobalState();
const navigate = useNavigate();
const audioContainerRef = useRef<HTMLDivElement>(null);
const [micMute, setMicMute] = useState(true);
Expand Down Expand Up @@ -83,10 +84,13 @@ export const ProductionLine: FC = () => {
};

useEffect(() => {
if (audioInput) {
audioInput.enabled = !micMute;
if (mediaStreamInput) {
mediaStreamInput.getTracks().forEach((track) => {
// eslint-disable-next-line no-param-reassign
track.enabled = !micMute;
});
}
}, [audioInput, micMute]);
}, [mediaStreamInput, micMute]);

// Mute/Unmute speaker
// Show active sink and mic
Expand Down

0 comments on commit 471d909

Please sign in to comment.