cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Kane (JIRA)" <>
Subject [jira] [Created] (CB-6495) Media plugin : Need way to set session category for iOS
Date Wed, 23 Apr 2014 03:31:15 GMT
Paul Kane created CB-6495:

             Summary: Media plugin : Need way to set session category for iOS
                 Key: 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 :

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 :

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

View raw message