Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Play sound new notif #65

Open
alexey13 opened this issue Jul 14, 2018 · 5 comments
Open

Play sound new notif #65

alexey13 opened this issue Jul 14, 2018 · 5 comments

Comments

@alexey13
Copy link

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

@lukejacksonn
Copy link
Owner

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

@alexey13
Copy link
Author

alexey13 commented Jul 17, 2018

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
Copy link
Author

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

@alexey13
Copy link
Author

alexey13 commented Jul 17, 2018

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

@lukejacksonn
Copy link
Owner

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants