Default stream mute on play

This commit is contained in:
Mitchell McCaffrey 2020-04-09 12:22:43 +10:00
parent 5b2f097248
commit 4b0336fa9d

View File

@ -8,7 +8,9 @@ function Nickname({ nickname, stream }) {
useEffect(() => {
if (audioRef.current) {
audioRef.current.srcObject = stream;
setStreamMuted(audioRef.current.defaultMuted);
audioRef.current.onplay = () => {
setStreamMuted(audioRef.current.defaultMuted);
};
}
}, [stream]);