Open
Bug 1105222
Opened 9 years ago
Updated 8 months ago
[meta] Support custom sound files for Web Notifications
Categories
(Toolkit :: Notifications and Alerts, defect)
Toolkit
Notifications and Alerts
Tracking
()
NEW
People
(Reporter: mikedeboer, Unassigned)
References
(Depends on 4 open bugs, )
Details
(Keywords: meta)
Attachments
(1 file)
22.82 KB,
patch
|
Details | Diff | Splinter Review |
DOM Web Notifications in Gecko sports a NotificationBehavior dictionary, which allow to specify a custom sound file to be played when the Notification is triggered. See https://mxr.mozilla.org/mozilla-central/source/dom/webidl/Notification.webidl?rev=9712d6370c3f&mark=65,72,75#58 for the IDL definition. Please note that this is out of date with the current state of the WHATWG spec at http://notifications.spec.whatwg.org/. We're using a proprietary `mozbehavior` object to specify sound and vibration pattern for B2G/ Gaia. Example: ```js new Notification("title", { mozbehavior: { soundFile: "chrome://url/to/soundFile.ogg" } }); ``` As such, this works for FirefoxOS, but not on the major desktop platforms. This bug tracks that work.
Flags: qe-verify+
Flags: firefox-backlog+
Updated•9 years ago
|
Component: Widget → Notifications and Alerts
Product: Core → Toolkit
Reporter | ||
Comment 1•9 years ago
|
||
:karlt actually proposed an awesome alternative in https://bugzilla.mozilla.org/show_bug.cgi?id=1105230#c1... For ease of implementation, I suggest to support _not_ playing a sound - which all desktop notification agents support - at first, so that Notification API consumers can start with playing a sound of their own via the <audio> element. How does that 'sound'? (no pun intended ;) )
Reporter | ||
Comment 2•9 years ago
|
||
This patch does the following: 1) adds an optional `sound` String argument to the `showAlertNotification` function for nsIAlertService. 2) Supports passing sound names to OSX Notification Manager to allow playing built-in sounds or the 'default' one. 3) Implements the behavior in Notification.cpp to see if the sound passed along with `mozBehavior.soundFile` contains a file that might be playable by the <audio> element. a) Tries to play the sound using a HTMLAudioElement instance, which crashes the browser atm. Dunno why, my skill is limited here atm. b) If no file is detected, pass the raw string to the alert service OS implementation. It may play a built-in sound. c) Pass the ASCII string 'default' to the alert service and let OS specific implementation fall back to its default behavior.
Comment 3•8 years ago
|
||
This is standardized, so we should use that API rather than invent a proprietary method: https://notifications.spec.whatwg.org/#sound-url
Updated•4 years ago
|
Summary: Support custom sound files for Web Notifications → [meta] Support custom sound files for Web Notifications
Updated•8 months ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•