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 9, 2024
1 parent 95b9197 commit 331d416
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 @@ -23,7 +23,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 @@ -89,10 +90,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 331d416

Please sign in to comment.