V
V
Vitaly Arkhipov2013-12-23 12:57:51
Browser extensions
Vitaly Arkhipov, 2013-12-23 12:57:51

Is it possible to add sound to notification for chrome extension?

If I understand correctly, it is no longer possible to use webkitNotifications.createHTMLNotification when writing a chrome extension.
Is there another way to add a sound when a notification appears?
Here: developer.chrome.com/extensions/notifications.html
And here: www.chromium.org/developers/design-documents/deskt...
There is nothing about it.
However, I think I have seen extensions with sound.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Vasilchuk, 2013-12-23
@arvitaly

Something like this:

var audio = new Audio();
audio.preload = 'auto';
audio.src = 'notify.mp3';

var notification = new Notification(title, {icon: 'icon.png', body: bodyText});
notification.onshow = function() {
    audio.play();
};

V
Vitaly Arkhipov, 2013-12-23
@arvitaly

So far I did it through chrome.windows.create, but the question remains open :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question