From 6b8d19620c05cb067b59b48084f5b85a6713299d Mon Sep 17 00:00:00 2001 From: Andrew Walz Date: Wed, 6 Sep 2017 13:24:22 -0600 Subject: [PATCH] Fixed issue with Bluetooth audio being forced onto device --- Source/SwiftyCamViewController.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/SwiftyCamViewController.swift b/Source/SwiftyCamViewController.swift index 1c1a8b5..7d337de 100644 --- a/Source/SwiftyCamViewController.swift +++ b/Source/SwiftyCamViewController.swift @@ -1016,9 +1016,13 @@ open class SwiftyCamViewController: UIViewController { } do{ - try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, - with: [.duckOthers, .defaultToSpeaker]) - + if #available(iOS 10.0, *) { + try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, + with: [.mixWithOthers, .allowBluetooth, .allowAirPlay, .allowBluetoothA2DP]) + } else { + try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, + with: [.mixWithOthers, .allowBluetooth]) + } session.automaticallyConfiguresApplicationAudioSession = false } catch {