Added notification sound.
This commit is contained in:
parent
4f1a48c197
commit
5aee606d5d
@ -323,6 +323,21 @@ class App extends EventHandler {
|
||||
rest = rest
|
||||
ws = null
|
||||
rpc = null
|
||||
sounds = ["/audio/soundfx.d_beep3.mp3"]
|
||||
playSound(soundIndex) {
|
||||
if (!soundIndex)
|
||||
soundIndex = 0
|
||||
|
||||
const player = new Audio(this.sounds[soundIndex]);
|
||||
|
||||
player.play()
|
||||
.then(() => {
|
||||
console.debug("Gave sound notification")
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Notification failed:", error);
|
||||
});
|
||||
}
|
||||
constructor() {
|
||||
super()
|
||||
this.rooms.push(new Room("General"))
|
||||
|
BIN
src/snek/static/audio/soundfx.d_alarm1.mp3
Normal file
BIN
src/snek/static/audio/soundfx.d_alarm1.mp3
Normal file
Binary file not shown.
BIN
src/snek/static/audio/soundfx.d_alarm2.mp3
Normal file
BIN
src/snek/static/audio/soundfx.d_alarm2.mp3
Normal file
Binary file not shown.
BIN
src/snek/static/audio/soundfx.d_beep1.mp3
Normal file
BIN
src/snek/static/audio/soundfx.d_beep1.mp3
Normal file
Binary file not shown.
BIN
src/snek/static/audio/soundfx.d_beep2.mp3
Normal file
BIN
src/snek/static/audio/soundfx.d_beep2.mp3
Normal file
Binary file not shown.
BIN
src/snek/static/audio/soundfx.d_beep3.mp3
Normal file
BIN
src/snek/static/audio/soundfx.d_beep3.mp3
Normal file
Binary file not shown.
@ -51,6 +51,7 @@ class ChatWindowElement extends HTMLElement {
|
||||
})
|
||||
const me = this
|
||||
channelElement.addEventListener("message",(message)=>{
|
||||
app.playSound(0)
|
||||
message.detail.element.scrollIntoView()
|
||||
|
||||
})
|
||||
|
@ -66,6 +66,7 @@ class MessageListElement extends HTMLElement {
|
||||
|
||||
this.messageEventSchedule.delay(() => {
|
||||
me.dispatchEvent(new CustomEvent("message", {detail:obj,bubbles:true}))
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user