Files
ember-market-frontend/components/audio-preloader.tsx
g 96638f968f Update notification sound to notification.mp3
Replaces all references to hohoho.mp3 with notification.mp3 for notification sounds across the app. Moves AudioPreloader to layout component and removes duplicate usage. Adds a guard in BroadcastDialog to prevent duplicate sends.
2025-12-28 19:21:02 +00:00

35 lines
721 B
TypeScript

"use client"
import { useEffect } from "react"
/**
* Preloads the notification audio file to ensure it's ready when needed
*/
export function AudioPreloader() {
useEffect(() => {
// Preload the audio file
const audio = new Audio('/notification.mp3')
audio.preload = 'auto'
// Try to load it immediately
try {
const loadPromise = audio.load();
if (loadPromise !== undefined) {
loadPromise.catch(err => {
console.log('Audio preload failed (non-critical):', err)
});
}
} catch (err) {
console.log('Audio preload failed (non-critical):', err)
}
return () => {
// Cleanup
audio.src = ''
}
}, [])
return null
}