mobilusoss / react-web-notification

React component with HTML5 Web Notification API

Home Page:http://mobilusoss.github.io/react-web-notification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Playing a sound

jonathanasquier opened this issue · comments

Hey, I'm using a mp3 link in options.sound to play when the notification opens, but I can't get it to work.
Does it work on your side?
Am I missing something?

Thanks!

Hi @jonathanasquier
MDN say that Notification.sound is not supported in any browser yet.
https://developer.mozilla.org/en/docs/Web/API/notification/sound#Browser_compatibility

I think you can emulate notification sound like this solution
http://stackoverflow.com/questions/10105063/how-to-play-a-notification-sound-on-websites

playSound(){
  // See
  // http://stackoverflow.com/questions/10105063/how-to-play-a-notification-sound-on-websites
}

<Notification
    onShow={this.playSound.bind(this)}
...

Awesome! thanks!

Hi, is their any document-tutorial for this react-web-notification. i'm new to this.

Thanks.

Thanks for your response, i need some document or tutorial for my better understanding of your code flow and structure.

This component is just 180 lines.

https://github.com/georgeOsdDev/react-web-notification/blob/master/src/components/Notification.js

I have no plans to write a tutorial.

Okay Thanks.