| 1 | import type { SnapShotSound } from "@t3tools/contracts"; |
| 2 | |
| 3 | import snapShotClickUrl from "../assets/snap-shot-click.mp3?url"; |
| 4 | import snapShotWhooshUrl from "../assets/snap-shot-whoosh.mp3?url"; |
| 5 | |
| 6 | export function playSnapShotSound(sound: SnapShotSound): void { |
| 7 | const audio = new Audio(sound === "soft-pop" ? snapShotWhooshUrl : snapShotClickUrl); |
| 8 | audio.preload = "auto"; |
| 9 | audio.currentTime = 0; |
| 10 | void audio.play().catch(() => undefined); |
| 11 | } |