How to add audio to my pomodoro from an external source? [Notifications API]

Hey guys,

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?

  <audio autoplay>
      <source src="" type="audio/mp3">

Maybe there’s other way i can’t think of?

Add this to your html

<audio id="notification" src="filename" preload="auto"></audio>

then call it in the javascript with


It didn’t work. I guess it’s the url’s fault.

I thought i need a direct link to the file.

I made it work using files from this site:
But there are only few sounds.

What websites would you recommend for audio sounds? And how to get urls properly?

First, its easier to do it pure javascript

var audio = new Audio('');;

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

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


this - gets me to 404 :slight_smile:

Yeah i know it needs to be an audio sound, obviously, but this didn’t work either:

is this because there is no audio player embeded?

Thanks for advice, i will try dropbox :slight_smile:

For dropbox just change the www. to dl.


Your link is not a valid audio file, because when I click it, it opens a freesound login page…

1 Like

What about this?

It is a valid file but there’s no sound in codepen. It froze my countdown too.

not sure if codepen can read .flac file. not sure what it is but I downloaded it from freesound

1 Like