From b8d5a1c1665567cc7e8daac83dffbc9cbac57511 Mon Sep 17 00:00:00 2001 From: Audric Ackermann <audric@loki.network> Date: Mon, 15 Nov 2021 14:46:22 +1100 Subject: [PATCH] disable audio output switching as this is broken for now --- _locales/en/messages.json | 2 +- ts/components/session/calling/CallButtons.tsx | 66 +++++++++---------- .../calling/InConversationCallContainer.tsx | 2 +- ts/session/utils/CallManager.ts | 18 ++--- 4 files changed, 42 insertions(+), 46 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 70b452a27..2189156f3 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -443,7 +443,7 @@ "endCall": "End call", "cameraPermissionNeededTitle": "Voice/Video Call permissions required", "cameraPermissionNeeded": "You can enable the 'Voice and video calls' permission in the Privacy Settings.", - "unableToCall": "cancel your ongoing call first", + "unableToCall": "Cancel your ongoing call first", "unableToCallTitle": "Cannot start new call", "callMissed": "Missed call from $name$", "callMissedTitle": "Call missed", diff --git a/ts/components/session/calling/CallButtons.tsx b/ts/components/session/calling/CallButtons.tsx index 1d557a91a..0469ee810 100644 --- a/ts/components/session/calling/CallButtons.tsx +++ b/ts/components/session/calling/CallButtons.tsx @@ -71,16 +71,16 @@ export const AudioInputButton = ({ export const AudioOutputButton = ({ currentConnectedAudioOutputs, - isAudioOutputMuted, - hideArrowIcon = false, -}: { +}: // isAudioOutputMuted, +// hideArrowIcon = false, +{ currentConnectedAudioOutputs: Array<InputItem>; isAudioOutputMuted: boolean; hideArrowIcon?: boolean; }) => { return ( <> - <DropDownAndToggleButton + {/* <DropDownAndToggleButton iconType="volume" isMuted={isAudioOutputMuted} onMainButtonClick={() => { @@ -90,7 +90,7 @@ export const AudioOutputButton = ({ showAudioOutputMenu(currentConnectedAudioOutputs, e); }} hidePopoverArrow={hideArrowIcon} - /> + /> */} <AudioOutputMenu triggerId={audioOutputTriggerId} @@ -238,19 +238,19 @@ const showAudioInputMenu = ( }); }; -const showAudioOutputMenu = ( - currentConnectedAudioOutputs: Array<any>, - e: React.MouseEvent<HTMLDivElement> -) => { - if (currentConnectedAudioOutputs.length === 0) { - ToastUtils.pushNoAudioOutputFound(); - return; - } - contextMenu.show({ - id: audioOutputTriggerId, - event: e, - }); -}; +// const showAudioOutputMenu = ( +// currentConnectedAudioOutputs: Array<any>, +// e: React.MouseEvent<HTMLDivElement> +// ) => { +// if (currentConnectedAudioOutputs.length === 0) { +// ToastUtils.pushNoAudioOutputFound(); +// return; +// } +// contextMenu.show({ +// id: audioOutputTriggerId, +// event: e, +// }); +// }; const showVideoInputMenu = ( currentConnectedCameras: Array<InputItem>, @@ -300,22 +300,22 @@ const handleMicrophoneToggle = async ( } }; -const handleSpeakerToggle = async ( - currentConnectedAudioOutputs: Array<InputItem>, - isAudioOutputMuted: boolean -) => { - if (!currentConnectedAudioOutputs.length) { - ToastUtils.pushNoAudioInputFound(); +// const handleSpeakerToggle = async ( +// currentConnectedAudioOutputs: Array<InputItem>, +// isAudioOutputMuted: boolean +// ) => { +// if (!currentConnectedAudioOutputs.length) { +// ToastUtils.pushNoAudioInputFound(); - return; - } - if (isAudioOutputMuted) { - // selects the first one - await CallManager.selectAudioOutputByDeviceId(currentConnectedAudioOutputs[0].deviceId); - } else { - await CallManager.selectAudioOutputByDeviceId(CallManager.DEVICE_DISABLED_DEVICE_ID); - } -}; +// return; +// } +// if (isAudioOutputMuted) { +// // selects the first one +// await CallManager.selectAudioOutputByDeviceId(currentConnectedAudioOutputs[0].deviceId); +// } else { +// await CallManager.selectAudioOutputByDeviceId(CallManager.DEVICE_DISABLED_DEVICE_ID); +// } +// }; const StyledCallWindowControls = styled.div` position: absolute; diff --git a/ts/components/session/calling/InConversationCallContainer.tsx b/ts/components/session/calling/InConversationCallContainer.tsx index 83aa23b6d..4d4702a1b 100644 --- a/ts/components/session/calling/InConversationCallContainer.tsx +++ b/ts/components/session/calling/InConversationCallContainer.tsx @@ -161,7 +161,7 @@ export const InConversationCallContainer = () => { if (currentSelectedAudioOutput === DEVICE_DISABLED_DEVICE_ID) { videoRefLocal.current.muted = true; } else { - void videoRefLocal.current.setSinkId(currentSelectedAudioOutput); + // void videoRefLocal.current.setSinkId(currentSelectedAudioOutput); videoRefLocal.current.muted = false; } } diff --git a/ts/session/utils/CallManager.ts b/ts/session/utils/CallManager.ts index 78c19843a..339ce240c 100644 --- a/ts/session/utils/CallManager.ts +++ b/ts/session/utils/CallManager.ts @@ -29,9 +29,6 @@ export type InputItem = { deviceId: string; label: string }; let currentCallUUID: string | undefined; -// const VIDEO_WIDTH = 640; -// const VIDEO_RATIO = 16 / 9; - export type CallManagerOptionsType = { localStream: MediaStream | null; remoteStream: MediaStream | null; @@ -280,7 +277,6 @@ export async function selectAudioInputByDeviceId(audioInputDeviceId: string) { export async function selectAudioOutputByDeviceId(audioOutputDeviceId: string) { if (audioOutputDeviceId === DEVICE_DISABLED_DEVICE_ID) { selectedAudioOutputId = audioOutputDeviceId; - console.warn('selectedAudioOutputId', selectedAudioOutputId); callVideoListeners(); return; @@ -288,13 +284,11 @@ export async function selectAudioOutputByDeviceId(audioOutputDeviceId: string) { if (audioOutputsList.some(m => m.deviceId === audioOutputDeviceId)) { selectedAudioOutputId = audioOutputDeviceId; - console.warn('selectedAudioOutputId', selectedAudioOutputId); - callVideoListeners(); } } -async function handleNegotiationNeededEvent(_event: Event, recipient: string) { +async function handleNegotiationNeededEvent(recipient: string) { try { makingOffer = true; window.log.info('got handleNegotiationNeeded event. creating offer'); @@ -573,7 +567,7 @@ function onDataChannelReceivedMessage(ev: MessageEvent<string>) { } function onDataChannelOnOpen() { window.log.info('onDataChannelOnOpen: sending video status'); - + setIsRinging(false); sendVideoStatusViaDataChannel(); } @@ -593,8 +587,8 @@ function createOrGetPeerConnection(withPubkey: string, isAcceptingCall = false) dataChannel.onopen = onDataChannelOnOpen; if (!isAcceptingCall) { - peerConnection.onnegotiationneeded = async (event: Event) => { - await handleNegotiationNeededEvent(event, withPubkey); + peerConnection.onnegotiationneeded = async () => { + await handleNegotiationNeededEvent(withPubkey); }; } @@ -953,7 +947,9 @@ export async function handleCallTypeIceCandidates( window.log.info('handling callMessage ICE_CANDIDATES'); pushCallMessageToCallCache(sender, remoteCallUUID, callMessage); - await addIceCandidateToExistingPeerConnection(callMessage); + if (currentCallUUID && callMessage.uuid === currentCallUUID) { + await addIceCandidateToExistingPeerConnection(callMessage); + } } async function addIceCandidateToExistingPeerConnection(callMessage: SignalService.CallMessage) {