react-slack-clone icon indicating copy to clipboard operation
react-slack-clone copied to clipboard

Play sound new notif

Open alexey13 opened this issue 6 years ago • 5 comments

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

alexey13 avatar Jul 14 '18 11:07 alexey13

Nice one @alexey13 and good idea.. what happens if you receive a lot of messages at once? Do you debounce this call or something?

lukejacksonn avatar Jul 17 '18 08:07 lukejacksonn

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.

alexey13 avatar Jul 17 '18 17:07 alexey13

But I think debounce nice idea. For example 1 sound in 3 seconds

alexey13 avatar Jul 17 '18 17:07 alexey13

I think this one we can use https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events If playing not play

alexey13 avatar Jul 17 '18 17:07 alexey13

Nice.. well maybe with a slightly shorter sound and checking to see if we are already playing a sound we could make this work.

lukejacksonn avatar Jul 18 '18 10:07 lukejacksonn