Re: Question about Audio for iOS (SessionCategory?)
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TZDmf/GNsN7Vp7MGuPNhZ39NFjx+hwYLL8+hbA71Aog=; b=rNNGRLFAfugWQ3qH/+cTAkG7OAhJRnGlspguzaEwpvVcK2VCwnSf70EVWih0+2I0Av 8z6GKTP7x6xEqDvaH3zPzpP3tN31BDVu6+f7PNBTox0NhO6zAWeESvwevWtdYPB3aziC RaWtbsdGGq6bqmdZPl8M3TmVtY1wecgagf+492Dxq101AuRRrCoE79SKjE0yFYFhoTbG sb8cBFfxbQIcFCnI1SWJ6mvoTPihj4LlTiGJsu4Rn9DZEn85FUu7ZHvnZyZJ4qtuFEBd ehblaDujahSh8fiS6FwthJyg7T7gOUIJ2EKGzP/nziWTLO+hWe0n2PaJhHh47mXlP7Rs fyjQ== 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 <edolecki@gmail.com> 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 <edolecki@gmail.com> 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 <zav@mac.com> 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 < quinceymorris@rivergatesoftware.com> wrote:
On Aug 18, 2017, at 10:47 , Eric E. Dolecki <edolecki@gmail.com> 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 (Cocoa-dev@lists.apple.com)
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: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
This email sent to zav@mac.com
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Eric E. Dolecki