chore: catch error when trying to play pop sound
continuous-integration/drone/push Build is passing Details

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.
This commit is contained in:
kolaente 2023-06-18 18:58:57 +02:00
parent a92eb31ab3
commit 929d4f4023
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 2 deletions

View File

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