forked from abner/for-legacy-web
Port sync, queue management and notifs.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import message from './message.mp3';
|
||||
import call_join from './call_join.mp3';
|
||||
import call_leave from './call_leave.mp3';
|
||||
|
||||
const SoundMap: { [key in Sounds]: string } = {
|
||||
message,
|
||||
call_join,
|
||||
call_leave
|
||||
}
|
||||
|
||||
export type Sounds = 'message' | 'call_join' | 'call_leave';
|
||||
|
||||
export function playSound(sound: Sounds) {
|
||||
let file = SoundMap[sound];
|
||||
let el = new Audio(file);
|
||||
try {
|
||||
el.play();
|
||||
} catch (err) {
|
||||
console.error('Failed to play audio file', file, err);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user