Version: Smart Feature Phone 3.0



General Use Cases: Allow application can control acoustic sound output through speaker.



* SpeakerPolicy is used to configure the force speaker policy of a SpeakerManager.
* - "foreground-or-playing" (default value):
* SpeakerManagerService will try to respect our "forcespeaker" setting when our
* SpeakerManager is in the foreground, or our APP is playing. Note that foreground
* state has a higher priority than playing state. If we are in the foreground and
* not playing, but some other background APP is playing, then SpeakerManagerService
* will respect our "forcespeaker" setting.
* - "playing":
* SpeakerManagerService will try to respect our "forcespeaker" setting only when
* our APP is playing.
* - "query":
* Configure SpeakerManager as query mode. In this mode, SpeakerManager can only be
* used to query "speakerforced" status, but our "forcespeaker" setting is never
* applied. The event "onspeakerforcedchange" is still effective.
enum SpeakerPolicy {


interface MozSpeakerManager : EventTarget {
constructor(optional SpeakerPolicy policy);
/* query the speaker status */
readonly attribute boolean speakerforced;
/* force device device's acoustic sound output through speaker */
attribute boolean forcespeaker;
/* this event will be fired when device's speaker forced status change */
attribute EventHandler onspeakerforcedchange;


var sm = new navigator.SpeakerManager();
// fired anytime when device's speaker status changed
sm.onspeakerforcedchange = function() {
bool enabled = sm.speakerforced;
// Refresh UI
if (sm.speakerforced) {
// device's speaker is on
} else {
sm.forcespeaker = true;