[ 
https://issues.apache.org/jira/browse/CB-906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295892#comment-13295892
 ] 

Shazron Abdullah commented on CB-906:
-------------------------------------

re: 
http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html

Cordova sets the Audio session category to:
 * *AVAudioSessionCategoryPlayback* or the equivalent 
kAudioSessionCategory_MediaPlayback—Use this category for an application whose 
audio playback is of primary importance. Your audio plays even with the screen 
locked and with the Ring/Silent switch set to silent.

That's why it still plays when the mute button is toggled on. To respect the 
mute button, we have to use either of the "ambient" categories:

 * *AVAudioSessionCategoryAmbient* or the equivalent 
kAudioSessionCategory_AmbientSound—Use this category for an application that 
plays sounds that add polish or interest but are not essential to the 
application’s use. Using this category, your audio is silenced by the 
Ring/Silent switch and when the screen locks.
This category allows audio from the iPod, Safari, and other built-in 
applications to play while your application is playing audio. You could, for 
example, use this category for an application that provides a virtual musical 
instrument that a user plays along to iPod audio.
 * *AVAudioSessionCategorySoloAmbient* or the equivalent 
kAudioSessionCategory_SoloAmbientSound—Use this category for an application 
whose audio you want silenced when the user switches the Ring/Silent switch to 
the “silent” position and when the screen locks. This is the default category. 
It differs from the AVAudioSessionCategoryAmbient category only in that it 
silences other audio.

So, just by changing the audio session category we can't get what we want, that 
is:
1. play when screen is locked
2. honor the mute button

These two things are mutually exclusive. My proposal is to not break existing 
implementations, and add something like the override parameter to "play" as 
suggested. Details forthcoming...

                
> Hardware mute button doesn't effect Media API playback
> ------------------------------------------------------
>
>                 Key: CB-906
>                 URL: https://issues.apache.org/jira/browse/CB-906
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.8.0
>         Environment: iPad 2/iOS 5.1.1
> iPhone 4/iOS 5.1.1
>            Reporter: Nathan Demick
>            Assignee: Shazron Abdullah
>             Fix For: 1.9.0
>
>
> When using the Media API, audio is played even if hardware mute button is 
> switched on. There is no way to override this setting.
> Expected behavior: Media API respects hardware mute button; optionally an 
> "override" argument could be passed to the play() method which ignores the 
> mute button.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to