I'm trying to play sound in push notification in Chrome browser when I get notification. And I have already set the browser push notification on my site but it does not play sound. I'm already going through the option for sound but get no sound.
option = {
'body' : 'This is tst Description',
'icon' : 'icon.png',
'silent' : 'false',
'sound' : 'bell.mp3'
}
If there is any other way to play the sound in the notification, please let me know.
or you can declare myAudio object globally and use play() funcation after or before notification is popped.
myAudio = new Audio("alert_tone.mp3");
var notification = new Notification("Hi there", options);
myAudio.play();
Currently browsers doesn't support Notification.sound see https://developer.mozilla.org/en/docs/Web/API/notification
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With