Skip to content
Makes a sound when a notification is shown
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.tx
_locales/en
images
pages
scripts
styles
.editorconfig
.eslintrc.json
.gitignore
.travis.yml
README.md
manifest.json
package-lock.json
package.json
pop.flac

README.md

icon Notification Sound

Greenkeeper badge Build Status

Makes a sound when a notification is shown.

Overrides Website's Notification constructor and showNotification method on ServiceWorker registrations to get notified when they're called. Other extensions can also let this extension know that they've shown a notification.

Currently can not play a sound when a ServiceWorker shows a notification.

Supports the silent and sound option on the Notification constructor.

Official Download

addons.mozilla.org/

Extension integration

For extensions to trigger a sound when creating a notification, they have to send the following message:

browser.runtime.sendMessage("@notification-sound", "new-notification");

new-notification returns a Promise that resolves to a boolean, indicating, whether the sound was played (based on user settings).

Starting from Firefox 56, an extension can just add the following code to the top level of its background page to send the message whenever it shows a notification:

browser.notifications.onShown.addListener(() => {
    browser.runtime.sendMessage("@notification-sound", "new-notification");
});

Notification tester

ServiceWorker tests don't work, since JSFiddle has no ServiceWorker.

JSFiddle Notification Tester

Support and FAQ

https://discourse.mozilla.org/t/support-notification-sound/23758

License

The code that makes up this project is licensed under the MPL-2.0

The pop.flac sound is licensed under the CC-3.0-BY license and was created by Tobiasz 'unfa' Karoń, original available on freesound.org

The icon was created by @elioqoshi via request on http://opensourcedesign.net/.

You can’t perform that action at this time.