From 6e1df928adb9c33f531c64f0699811630d0b95a6 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Thu, 2 Apr 2026 22:40:48 +1100 Subject: [PATCH] feat: enhance sound playback in InviteNotifications and MessageNotifications for Electron support --- src/app/pages/client/ClientNonUIFeatures.tsx | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx index e4b54e4..1dba998 100644 --- a/src/app/pages/client/ClientNonUIFeatures.tsx +++ b/src/app/pages/client/ClientNonUIFeatures.tsx @@ -150,12 +150,13 @@ function InviteNotifications() { ); const playSound = useCallback(() => { - console.log('[InviteNotifications] playSound called'); - // Use HTML5 Audio - works reliably in Chromium/Electron (supports OGG) - const audio = new Audio('/sound/invite.ogg'); - audio.play().catch((err) => { - console.error('[Audio] Failed to play invite sound:', err); - }); + if (isElectron() && (window as any).electron?.audio?.playNotificationSound) { + (window as any).electron.audio.playNotificationSound('invite'); + } else { + new Audio('./sound/invite.ogg').play().catch((err) => { + console.error('[Audio] Failed to play invite sound:', err); + }); + } }, []); useEffect(() => { @@ -295,13 +296,13 @@ function MessageNotifications() { ); const playSound = useCallback(() => { - console.log('[MessageNotifications] playSound called'); - // Use HTML5 Audio - works reliably in Chromium/Electron (supports OGG) - // Main process audio is unreliable on Windows (can't play OGG natively) - const audio = new Audio('/sound/notification.ogg'); - audio.play().catch((err) => { - console.error('[Audio] Failed to play notification sound:', err); - }); + if (isElectron() && (window as any).electron?.audio?.playNotificationSound) { + (window as any).electron.audio.playNotificationSound('message'); + } else { + new Audio('./sound/notification.ogg').play().catch((err) => { + console.error('[Audio] Failed to play notification sound:', err); + }); + } }, []); useEffect(() => {