From 25b1913e8e919f63ffd79eb0249f52b3d769ff07 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Fri, 14 Apr 2023 13:41:44 -0700 Subject: [PATCH] fixing mute issue on speaker phone --- app/mobile/src/context/useRingContext.hook.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/mobile/src/context/useRingContext.hook.js b/app/mobile/src/context/useRingContext.hook.js index 21d6a795..442c5168 100644 --- a/app/mobile/src/context/useRingContext.hook.js +++ b/app/mobile/src/context/useRingContext.hook.js @@ -104,7 +104,8 @@ export function useRingContext() { } } catch (err) { - Alert.alert('webrtc error', err.toString()); + console.log(err); + //Alert.alert('webrtc error', err.toString()); } } @@ -153,7 +154,8 @@ export function useRingContext() { } } catch (err) { - Alert.alert('webrtc error', err.toString()); + console.log(err); + //Alert.alert('webrtc error', err.toString()); } } } @@ -468,11 +470,17 @@ export function useRingContext() { }); for (const track of stream.getTracks()) { if (track.kind === 'audio') { + if (audioTrack.current) { + audioTrack.current.stop(); + } audioTrack.current = track; pc.current.addTrack(track, stream); updateState({ localAudio: true }); } if (track.kind === 'video') { + if (videoTrack.current) { + videoTrack.current.stop(); + } videoTrack.current = track; pc.current.addTrack(track, stream); InCallManager.setForceSpeakerphoneOn(true);