Handle audio-less
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user