Open source video conferencing app powered by LiveKit. Built with Django and React.
π(frontend) harden speaker test against missing sinks and play errors
lebaudantoine52f119db02ac
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7f48fb87..5471cedd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,7 @@ and this project adheres to- π(frontend) downgrade unreachable external home URL from error to event- π(frontend) handle 401 responses when syncing user preferences+- π(frontend) harden speaker test against missing sinks and play errors## [1.26.0] - 2026-08-12diff --git a/src/frontend/src/components/SoundTester.tsx b/src/frontend/src/components/SoundTester.tsxindex 5080a1a4..7faa0845 100644--- a/src/frontend/src/components/SoundTester.tsx+++ b/src/frontend/src/components/SoundTester.tsx@@ -3,27 +3,30 @@ import { useEffect, useRef, useState } from 'react'import { useTranslation } from 'react-i18next'import { useMediaDeviceSelect } from '@livekit/components-react'import { reportError } from '@/features/analytics/telemetry'+import { canTestAudioOutput } from '@/features/rooms/utils/canTestAudioOutput'export const SoundTester = () => {const { t } = useTranslation('settings')const [isPlaying, setIsPlaying] = useState(false)const audioRef = useRef<HTMLAudioElement>(null)- const { activeDeviceId } = useMediaDeviceSelect({ kind: 'audiooutput' })+ const { devices, activeDeviceId } = useMediaDeviceSelect({+ kind: 'audiooutput',+ })useEffect(() => {- const updateActiveId = async (deviceId: string) => {- try {- await audioRef?.current?.setSinkId(deviceId)- } catch (error) {- reportError(- 'device_switch_failure',- new Error(`Error setting sinkId: ${error}`)- )+ if (!canTestAudioOutput() || !activeDeviceId) return+ if (!devices.some((device) => device.deviceId === activeDeviceId)) return+ audioRef.current?.setSinkId(activeDeviceId).catch((error) => {+ if (error instanceof DOMException && error.name === 'NotFoundError') {+ return}- }- updateActiveId(activeDeviceId)- }, [activeDeviceId])+ reportError(+ 'device_switch_failure',+ new Error(`Error setting sinkId: ${error}`)+ )+ })+ }, [devices, activeDeviceId])// prevent pausing the soundnavigator.mediaSession.setActionHandler('pause', function () {})@@ -32,9 +35,13 @@ export const SoundTester = () => {<><Buttonvariant="secondaryText"- onPress={() => {- audioRef?.current?.play()- setIsPlaying(true)+ onPress={async () => {+ try {+ await audioRef?.current?.play()+ setIsPlaying(true)+ } catch {+ setIsPlaying(false)+ }}}size="sm"isDisabled={isPlaying}@@ -48,7 +55,7 @@ export const SoundTester = () => {{/* eslint-disable jsx-a11y/media-has-caption */}<audioref={audioRef}- src="sounds/uprise.mp3"+ src="/sounds/uprise.mp3"onEnded={() => setIsPlaying(false)}/></>diff --git a/src/frontend/src/features/notifications/hooks/useSoundNotification.tsx b/src/frontend/src/features/notifications/hooks/useSoundNotification.tsxindex 900d30ea..cf052f42 100644--- a/src/frontend/src/features/notifications/hooks/useSoundNotification.tsx+++ b/src/frontend/src/features/notifications/hooks/useSoundNotification.tsx@@ -6,7 +6,7 @@ import type { NotificationType } from '@/features/notifications/NotificationType// fixme - handle dynamic audio output changesexport const useNotificationSound = () => {const notificationsSnap = useSnapshot(notificationsStore)- const [play] = useSound('./sounds/notifications.mp3', {+ const [play] = useSound('/sounds/notifications.mp3', {sprite: {participantJoined: [0, 1150],handRaised: [1400, 180],diff --git a/src/frontend/src/features/rooms/livekit/components/controls/Device/OutputSoundTester.tsx b/src/frontend/src/features/rooms/livekit/components/controls/Device/OutputSoundTester.tsxindex ba6f7d9f..27439b51 100644--- a/src/frontend/src/features/rooms/livekit/components/controls/Device/OutputSoundTester.tsx+++ b/src/frontend/src/features/rooms/livekit/components/controls/Device/OutputSoundTester.tsx@@ -126,7 +126,7 @@ export const OutputSoundTester = ({{/* eslint-disable-next-line jsx-a11y/media-has-caption */}<audioref={audioRef}- src="sounds/uprise.mp3"+ src="/sounds/uprise.mp3"onEnded={() => setIsPlaying(false)}/></StyledContainer>