[ https://issues.apache.org/jira/browse/CB-6495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13980462#comment-13980462 ]
Shazron Abdullah commented on CB-6495: -------------------------------------- Note for devs: https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html see section "Audio Session Categories" Probably only use a subset of these. Don't forget to update the docs. > Media plugin : Need way to set session category for iOS > ------------------------------------------------------- > > Key: CB-6495 > URL: https://issues.apache.org/jira/browse/CB-6495 > Project: Apache Cordova > Issue Type: Improvement > Components: Plugin Media > Environment: iOS, all > Reporter: Paul Kane > Priority: Critical > > I need a way to play a sound effect (the occasional "beep") in my Cordova app > without it shutting down any other Audio Sessions. Currently any sound from > my app will cancel iTunes/Spotify/etc background music. > Apple has a bunch of "Audio Session" categories which determine how an app's > audio will mix with other audio streams. The documentation is here : > https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html > Anyway, the only 2 audio session categories mentioned in the Media plugin are > hard-wired in there and not configurable. It should probably be more of an > option, the way that playAudioWhenScreenIsLocked and numberOfLoops are > options. The category I needed was AVAudioSessionCategoryAmbient. For now > I've simply hard-wired it in for my project, but I'm going to need to patch > the plugin after every plugin upgrade, etc. > Also worth noting, the setCategory function should probably be called before > the prepareToPlay function (it's not, currently). Without doing that, setting > the category wasn't having any effect for me. Found the solution here : > http://stackoverflow.com/questions/10377959/on-ipad-why-does-avaudiosessioncategoryambient-stop-the-music-playing-in-ipod > I'm not an iOS programmer, and Objective-C and github both confuse the hell > out of me so you probably don't want me contributing my code to the plugin, > but hopefully these notes can be of help to someone better qualified. -- This message was sent by Atlassian JIRA (v6.2#6252)