mute audio from bg when video is in fullscreen

this is to avoid having two times the remote sound playing
one in the bg and one in the fullscreen
This commit is contained in:
Audric Ackermann 2021-11-22 15:28:27 +11:00
parent a4daabfa75
commit e716f73d6c
No known key found for this signature in database
GPG key ID: 999F434D76324AD4

View file

@ -5,6 +5,7 @@ import styled from 'styled-components';
import _ from 'underscore';
import { UserUtils } from '../../../session/utils';
import {
getCallIsInFullScreen,
getHasOngoingCallWith,
getHasOngoingCallWithFocusedConvo,
getHasOngoingCallWithFocusedConvoIsOffering,
@ -119,6 +120,8 @@ export const VideoLoadingSpinner = (props: { fullWidth: boolean }) => {
export const InConversationCallContainer = () => {
const ongoingCallProps = useSelector(getHasOngoingCallWith);
const isInFullScreen = useSelector(getCallIsInFullScreen);
const ongoingCallPubkey = useSelector(getHasOngoingCallWithPubkey);
const ongoingCallWithFocused = useSelector(getHasOngoingCallWithFocusedConvo);
const ongoingCallUsername = ongoingCallProps?.profileName || ongoingCallProps?.name;
@ -158,12 +161,17 @@ export const InConversationCallContainer = () => {
if (currentSelectedAudioOutput === DEVICE_DISABLED_DEVICE_ID) {
videoRefRemote.current.muted = true;
} else {
// void videoRefRemote.current.setSinkId(currentSelectedAudioOutput);
void (videoRefRemote.current as any)?.setSinkId(currentSelectedAudioOutput);
videoRefRemote.current.muted = false;
}
}
}
if (isInFullScreen && videoRefRemote.current) {
// disable this video element so the one in fullscreen is the only one playing audio
videoRefRemote.current.muted = true;
}
if (!ongoingCallWithFocused) {
return null;
}