Co-authored-by: Dara Adedeji <[email protected]> Co-authored-by: Dara Adedeji <[email protected]> Co-authored-by: Wout Stiens <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
12 lines
442 B
TypeScript
12 lines
442 B
TypeScript
import type { SnapShotSound } from "@t3tools/contracts";
|
|
|
|
import snapShotClickUrl from "../assets/snap-shot-click.mp3?url";
|
|
import snapShotWhooshUrl from "../assets/snap-shot-whoosh.mp3?url";
|
|
|
|
export function playSnapShotSound(sound: SnapShotSound): void {
|
|
const audio = new Audio(sound === "soft-pop" ? snapShotWhooshUrl : snapShotClickUrl);
|
|
audio.preload = "auto";
|
|
audio.currentTime = 0;
|
|
void audio.play().catch(() => undefined);
|
|
}
|