How to play sound in javascript?

0

Well, I'm developing a chat, I'd like to know how I add a simple sound when I get a notification. I'm using Meteor.

    
asked by anonymous 09.05.2018 / 17:17

1 answer

1

I think it can help, if you have any questions.

var audio = new Audio('audio.mp3');
audio.addEventListener('canplaythrough', function() {
  audio.play();
});

Or try using Buzz

link

    
09.05.2018 / 17:21