react-slack-clone
react-slack-clone copied to clipboard
Play sound new notif
var audio = new Audio();
audio.preload = 'auto';
audio.src = '/path';
audio.play();
const notification = new Notification(...
I used this one https://freesound.org/people/Thoribass/sounds/253595/ Convert to mp3
Nice one @alexey13 and good idea.. what happens if you receive a lot of messages at once? Do you debounce this call or something?
You mean user send to another user messages one by one? No, not debounce. Interesting scenario, need to test it in real life. When I use chat on a desktop and hear the sound (whatsapp desktop using sound) I focus on the chat window, if I do not want to hear the sound I just turn it off in that window of a browser.
But I think debounce nice idea. For example 1 sound in 3 seconds
I think this one we can use https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events If playing not play
Nice.. well maybe with a slightly shorter sound and checking to see if we are already playing a sound we could make this work.