Handle audio-less

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2022-08-13 18:29:30 +02:00
parent 4ac5c2c677
commit b2427bd810

View File

@@ -33,13 +33,13 @@ export function AudioForParticipant({
audioContext,
audioDestination,
}: AudioForParticipantProps): JSX.Element {
const { stream, localVolume } = useCallFeed(item.callFeed);
const { stream, localVolume, audioMuted } = useCallFeed(item.callFeed);
const gainNodeRef = useRef<GainNode>();
const sourceRef = useRef<MediaStreamAudioSourceNode>();
useEffect(() => {
if (!item.isLocal && audioContext) {
if (!item.isLocal && audioContext && !audioMuted) {
if (!gainNodeRef.current) {
gainNodeRef.current = new GainNode(audioContext, {
gain: localVolume,
@@ -60,7 +60,7 @@ export function AudioForParticipant({
gainNode.disconnect();
};
}
}, [item, audioContext, audioDestination, stream, localVolume]);
}, [item, audioContext, audioDestination, stream, localVolume, audioMuted]);
return null;
}