On most platforms, there is some sort of “no” sound when some sort of exceptional thing or alert occurs.
On Windows, we had the classic ding sound, with now a more friendly sound accompanying the notification bar. On OS X, we have the donk sound, that goes with alert boxes. Even on mobile with the speakers muted, we typically end up a short vibration motor pulse.
Is there a browser API for triggering this sort of “default” attention-seeking sound or vibration without popping up an alert box or notification?
(Note: I realize we can play sounds with the audio element and Web Audio API, and I also realize there is an experimental API for buzzing the vibration motor. I’m not interested in managing those behaviors myself. I want to trigger the default alert sound/buzz action on whatever device/platform is in use.)
Advertisement
Answer
There is no way to do this in any browser as of the time of writing (except for vibration on supported devices/browsers). An alternative approach is to serve a sound to the user, based on the user-agent (used for detecting the device) using the audio api (though if you don’t want to manage this behaviour yourself, this is obviously a straight no unless there is a pre-existing library somehwere).