WebAPI/AudioChannels: Difference between revisions

no edit summary
No edit summary
Line 52: Line 52:
   attribute EventTarget onmozchannelunpaused;
   attribute EventTarget onmozchannelunpaused;
  }
  }
For apps that want to keep being able to play audio when the user leaves the app, the app can call requestWakeLock("audio") to grab an "audio" wakelock. As long as the app holds the "audio" wakelock its mozchannelpaused property won't change due to the user leaving the app.


The mozchannelpaused property can change both as a result of an app being put in the background, or as a result of the channel being paused due to a higher priority channel being used.
The mozchannelpaused property can change both as a result of an app being put in the background, or as a result of the channel being paused due to a higher priority channel being used.
=== Open questions ===
Do we need the ability to mute a channel without actually playing audio in it? It might be nice to enable muting a channel half a second before starting to use it. Not a v1 feature most likely.
Should we use canceling of events rather than a wakelock to allow audio to keep playing in the background?


== System and Browser API changes ==
== System and Browser API changes ==
Line 72: Line 63:
If headphones or a headset is plugged in, the volume buttons should always change the volume of the "headphones" channel.
If headphones or a headset is plugged in, the volume buttons should always change the volume of the "headphones" channel.


In order to support a "audio" wakelock we should extend the browser API with two things. First off, we should add the ability to enumerate the set of locks that are being held by any page inside the <iframe mozbrowser>. As well as an event that is fired whenever that list changes.
== Settings ==
 
There's multiple different settings for audio volume:


Second, we should add an API to pause/ununpause the contents of the <iframe mozbrowser>. When a <iframe mozbrowser> is paused or unpaused, we'd change the mozchannelpaused property on all media elements inside the browser.
* '''audio.volume.content''': Affects the "content" and "normal" audio channels. It's an integer between 0 and 15 where 0 means muted.
* '''audio.volume.notification''': Affects the "notification" channel. It's an integer between 0 and 7.
* '''audio.volume.alarm''': Affects the "alarm" channel. It's an integer between 0 and 7.
* '''audio.volume.telephony''': Affects the "telephony" channel. It's an integer between 0 and 5.


== Security model ==
== Security model ==
Confirmed users
716

edits