From 0ffd860fdbb433e5b9caa4ee6405e8800a644f90 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 15 Jun 2022 21:37:42 +0100 Subject: [PATCH] catch a couple of exceptions --- src/sound/usePttSounds.ts | 8 ++++++-- src/video-grid/useMediaStream.ts | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/sound/usePttSounds.ts b/src/sound/usePttSounds.ts index 0bcc8a71..9f6e31d9 100644 --- a/src/sound/usePttSounds.ts +++ b/src/sound/usePttSounds.ts @@ -58,8 +58,12 @@ export const usePTTSounds = (): PTTSounds => { break; } if (ref.current) { - ref.current.currentTime = 0; - await ref.current.play(); + try { + ref.current.currentTime = 0; + await ref.current.play(); + } catch (e) { + console.log("Couldn't play sound effect", e); + } } else { console.log("No media element found"); } diff --git a/src/video-grid/useMediaStream.ts b/src/video-grid/useMediaStream.ts index 5565ab21..cce19079 100644 --- a/src/video-grid/useMediaStream.ts +++ b/src/video-grid/useMediaStream.ts @@ -68,7 +68,13 @@ export const useMediaStream = ( audioOutputDevice && mediaRef.current !== undefined ) { - console.log(`useMediaStream setSinkId ${audioOutputDevice}`); + if (mediaRef.current.setSinkId) { + console.log( + `useMediaStream setting output setSinkId ${audioOutputDevice}` + ); + } else { + console.log("Can't set output - no setsinkid"); + } // Chrome for Android doesn't support this mediaRef.current.setSinkId?.(audioOutputDevice); }