Handle audio-less
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
4ac5c2c677
commit
b2427bd810
1 changed files with 3 additions and 3 deletions
|
@ -33,13 +33,13 @@ export function AudioForParticipant({
|
||||||
audioContext,
|
audioContext,
|
||||||
audioDestination,
|
audioDestination,
|
||||||
}: AudioForParticipantProps): JSX.Element {
|
}: AudioForParticipantProps): JSX.Element {
|
||||||
const { stream, localVolume } = useCallFeed(item.callFeed);
|
const { stream, localVolume, audioMuted } = useCallFeed(item.callFeed);
|
||||||
|
|
||||||
const gainNodeRef = useRef<GainNode>();
|
const gainNodeRef = useRef<GainNode>();
|
||||||
const sourceRef = useRef<MediaStreamAudioSourceNode>();
|
const sourceRef = useRef<MediaStreamAudioSourceNode>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!item.isLocal && audioContext) {
|
if (!item.isLocal && audioContext && !audioMuted) {
|
||||||
if (!gainNodeRef.current) {
|
if (!gainNodeRef.current) {
|
||||||
gainNodeRef.current = new GainNode(audioContext, {
|
gainNodeRef.current = new GainNode(audioContext, {
|
||||||
gain: localVolume,
|
gain: localVolume,
|
||||||
|
@ -60,7 +60,7 @@ export function AudioForParticipant({
|
||||||
gainNode.disconnect();
|
gainNode.disconnect();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, [item, audioContext, audioDestination, stream, localVolume]);
|
}, [item, audioContext, audioDestination, stream, localVolume, audioMuted]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue