Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[Deprecated] Gaia Audio Stream Proposal for Fx OS

Avatar for Alive.Kuo Alive.Kuo
November 02, 2012

[Deprecated] Gaia Audio Stream Proposal for Fx OS

An initial version of multi-channel audio proposal for FirefoxOS in gaia side.

Avatar for Alive.Kuo

Alive.Kuo

November 02, 2012
Tweet

More Decks by Alive.Kuo

Other Decks in Technology

Transcript

  1. l  Story l  A new entry in manifest l  System

    app change l  Examples l  UI change l  Audio stream types l  Summary Outline
  2. User story/developer story 1.  As a user, I’d like to

    distinguish the settings about several stream types, like system, ringtone(could be combined with system), FM, voicecall, alarm… 2.  As a user, I’d like to use hardware volumeup/volumedown buttons to control the focused stream. But we couldn’t n  Deliver hardware key events to all web applications. n  Just let gecko manipulate settings. Gecko doesn’t know the current foreground app is. --- Related bugs n  http://bugzil.la/796658 - Audio settings should be separated n  http://bugzil.la/796259 - [clock] Mute the phone also mute the alarm n  http://bugzil.la/795237 - Web API for audio stream type n  https://github.com/mozilla-b2g/gaia/issues/ 2562#issuecomment-8518083
  3. A new entry in manifest n  Let’s call it mainStreamType.

    n  Defaul mainStreamType is `system`. n  In order not to abuse, an app set mainStreamType = ‘telephony’ should have telephony permission. System app would check the permission when it’d like to change the relevant setting of audio stream. n  For instance, FM app should set mainStreamType = ‘fm’ as well as having fmradio permission. n  Dialer app is a special case, study later.
  4. System app change n  System app knows which mainStreamType of

    the foreground app. n  Whenever the user presses the hardware volume buttons, Sound Manager in System app would check the mainStreamType of focused app, including attention screen, to set to the right settings. n  An app may use 2 more kind of audio streams. But we only change to its focused stream when its foreground.
  5. Case Study: FM n  FM focuses on FM stream. n 

    FM set mainStreamType = ‘fm’, permissions = ‘fmradio’ in it manifast. n  When the user opens FM and then presses the volumeup/ volumedown buttons, Sound Manager in system app changes the settings of `audio.volume.fm`.
  6. Case Study: Dialer n  Dialer is a special case. n 

    Dialer contains n  Keypad tone(system stream) n  Ringtone(system stream) n  Voice(voice stream) n  It doesn’t need to claim mainStreamType, which implies is default(system). n  Sound Manager would detect the calling state of the phone. n  On call: adjust voice volume settings. n  Not on a call: adjust system volume settings.
  7. Case Study: Music n  Music should claims mainStreamType=“system” or don’t

    claim because its default. n  Hardware volume buttons does change system volume as usual when music app is in foreground. n  For those who doesn’t set mainStreamType in their manifest, the Sound Manager works as usual, just change the volume of system stream.
  8. Case Study: Alarm n  First of all, alarm is still

    under discussion if we are going to separate it from the system stream to an individual one. n  If so, Clock app claims mainStreamType=“alarm” and should have alarm permission in its manifest. n  When an app with mainStreamType=“alarm” shows, click volumeup/volumedown changes the volume of alarm. n  This is to be defined by UX, but we could detect if the foreground app is an attention screen with mainStreamType=alarm. n  If so, we could immediately mute the device by clicking volumedown.(By settings or by stop the alarm is also to be implemented.) n  @lco defines ‘only alarm by clock’ sounds when device is muted, but ‘alarm by calendar’ doesn’t in bug 796259. This is impossible to tell now.
  9. UI change n  System volume overlay should tell the user

    which type of stream he is currently changing. n  Using an icon or a string. n  Sample
  10. Audio stream type proposal n  Current types n  System(/Music?) n 

    FM n  Ring n  Alarm n  Bug 705237 is introducing a new attribute for audio tag/object. n  Audio.mozAudioStreamType n  These two concepts could be merged. Using the same set of strings in mainStreamType of mainfest and audio’s audioStreamType.
  11. To be defined/discussed n  Merge music stream type into system

    stream type n  PROS: Less types leads to less bugs IMO. n  CONS: n  Music stream couldn’t survive when system stream is muted. (But any harmful?) n  GONK/Android defines different maximum values for different stream types. It may be UX problem if we combines two streams with different upper bound. n  If FM supports API for state of fmradio, we could treat it as Dialer case; it is, listening to the state of fmradio and then adjust the volume of fm. n  PROS: FM doesn’t use <audio>, give a mainStreamType=fm but no <audio mozAudioStreamType=fm> may confuse. n  CONS: This matches GONK settings because android does have fm stream settings.
  12. Proposal summary n  A new entry in manifest. mainStreamType n 

    Sound Manager implementation. n  Platform support about telephony change.(undergoing) n  Platform support about fm to let system app knows the state of fmradio(OPTIONAL) n  Volume overlay UI change. n  Add all stream type in Settings app. n  Any question/idea? J