Comment inline.
--
Alive C. Kuo, Front-end Eng., Mozilla Corp. (Taiwan, Taipei)

Randy Lin <r...@mozilla.com> 於 2013/5/13 下午5:47 寫道:

> 3. Handle the application switch case, i.e one application want speaker on 
> with headphone pluged-in, switch to another one, but there is no option for 
> users to switch back to headphone. this object may need to tracking the 
> application usage and recover it.

If you have a speakerOn function I assume that you will also have a speakerOff 
function.
Then in those app who wants to control the state of speaker,
they should listen to 'visibilitychange' event to know the 
foreground/background state change(application switch you mean),
and then according to that, enable or disable speaker.

The only thing I wonder: there may exist one race condition, if App A is 
brought to background after App B is brought to foreground.
When that happens, the speaker(I guess it's global?) will be disabled by App A 
when it gets notified it's now background after App A enables it.

> 
> Randy
> _______________________________________________
> dev-b2g mailing list
> dev-b2g@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-b2g

_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to