From a2372b9d7db990f523c729f237ae80e5f0a55578 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.js | 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.js b/src/video-grid/useMediaStream.js index 774c6dd3..9c4b2813 100644 --- a/src/video-grid/useMediaStream.js +++ b/src/video-grid/useMediaStream.js @@ -56,7 +56,13 @@ export function useMediaStream(stream, audioOutputDevice, mute = false) { 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); }