Re: Question about Audio for iOS (SessionCategory?)
Re: Question about Audio for iOS (SessionCategory?)
- Subject: Re: Question about Audio for iOS (SessionCategory?)
- From: "Eric E. Dolecki" <email@hidden>
- Date: Thu, 24 Aug 2017 12:52:20 +0000
Quick question.
Am I supposed to set the category, then set a different category while my
audio plays, then when complete go back to the original category? Is that
how I should approach - or are you supposed to set the category one time?
Eric
On Fri, Aug 18, 2017 at 3:02 PM Eric E. Dolecki <email@hidden> wrote:
> Where I am at currently.
>
> let audioSession = AVAudioSession.sharedInstance()
> do {
> try
> audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with:
> [.duckOthers, .allowBluetoothA2DP, .allowAirPlay, .defaultToSpeaker])
> try audioSession.setActive(true)
> } catch {
> print("Error. \(error.localizedDescription)")
> }
>
> This doesn't stop Apple Music. This allows me to record audio in the app.
> This ducks Apple Music when I set the category. The defaultToSpeaker allows
> my recorded audio to sound full volume instead of sounding like 0.6 of
> volume (which is weird). The ducking DOES NOT duck Apple Music as needed,
> it seems to duck the audio while my app is running. It also seems to
> degrade the audio somewhat coming to my headphones.
>
> I haven't been banging on iOS 11 beta yet (been holding off). I should
> look to see if they added anything here or not.
>
> Have a great weekend!
>
> On Fri, Aug 18, 2017 at 2:04 PM Eric E. Dolecki <email@hidden>
> wrote:
>
>> I moved stuff to AppDelegate and it seems a little better. However, when
>> my audio plays, I get Apple Music to duck, and it doesn't come back up in
>> volume. I got a notification during this, and when IT'S audio ping was done
>> playing, Apple Music returned to normal volume.
>>
>> Still playing around...
>>
>> On Fri, Aug 18, 2017 at 1:58 PM Alex Zavatone <email@hidden> wrote:
>>
>>> There are 4 options you the audio category mode that you can test.
>>>
>>> Apple’s docs suck badly on this topic. I suggest you create the 4
>>> possible test cases and try them out.
>>>
>>> Also note that one of them will support the silent/mute switch. This is
>>> an item that is worth testing to know what you are getting.
>>>
>>> Cheers,
>>> Alex Zavatone
>>>
>>> > On Aug 18, 2017, at 12:55 PM, Quincey Morris <
>>> email@hidden> wrote:
>>> >
>>> > On Aug 18, 2017, at 10:47 , Eric E. Dolecki <email@hidden>
>>> wrote:
>>> >>
>>> >> I would assume that the audio would come back up. And wouldn't think
>>> my app would pause Apple Music when it starts up...
>>> >
>>> > Unless someone else jumps in with the answer, I’d say it’s TSI time!
>>> >
>>> > _______________________________________________
>>> >
>>> > Cocoa-dev mailing list (email@hidden)
>>> >
>>> > Please do not post admin requests or moderator comments to the list.
>>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> >
>>> > Help/Unsubscribe/Update your Subscription:
>>> >
>>> > This email sent to email@hidden
>>>
>>>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden