frontend/src/helpers/playPop.ts
kolaente 929d4f4023
chore: catch error when trying to play pop sound
Safari does not allow playing sound without user interaction, so we'll just silently catch and ignore the error until we have a better solution.
2023-06-18 18:58:57 +02:00

13 lines
281 B
TypeScript

import popSoundFile from '@/assets/audio/pop.mp3'
export const playSoundWhenDoneKey = 'playSoundWhenTaskDone'
export function playPopSound() {
try {
const popSound = new Audio(popSoundFile)
popSound.play()
} catch (e) {
console.error('Could not play pop sound:', e)
}
}