I’m finishing my pomodoro clock, and i try to use Notifications API.
So I actually got notifications work, but i wanted to play a quiet sound along with it.
The world would be beautiful to me if this was available in browsers.
I wonder what is the good way to do it? Any clues?
I thought i would append this to the website, and remove it after it played the sound, but i can’t make it work at all (even on the page load). I assume my url to the source is bad. Is it actually possible to pass the source as url?
var audio = new Audio('www.link.com');
audio.play();
For hosting audio, you can use dropbox, onedrive, etc. Cloudinary is a very good place to host images, videos, and probably sound. I personally use dropbox for its ease of use.
To get url properly, the link should be an actual audio file.
For example,
if you put that in your browser, you will get a audio player:
But if you have a link such as http://mp3-skulls.net/music/get/1234588798/Panda.html
it will not work, because it is a html file not an mp3. If you get an audio player when you open it in browser, it is a valid audio file. Check the specifications for file services such as dropbox or onedrive as there are certain things you must change to get a direct link (dropbox must be https://dl.dropbox.com).