diff --git a/ios/ExpoAudioStreamModule.swift b/ios/ExpoAudioStreamModule.swift index 329120e..5a9dab6 100644 --- a/ios/ExpoAudioStreamModule.swift +++ b/ios/ExpoAudioStreamModule.swift @@ -28,11 +28,11 @@ public class ExpoAudioStreamModule: Module { private func configureAudioSession() { do { - let audioSession = AVAudioSession.sharedInstance() - try audioSession.setCategory(.playAndRecord, mode: .default, options: [.allowBluetooth, .mixWithOthers]) - try audioSession.setActive(true) + let audioSession = AVAudioSession.sharedInstance() + try audioSession.setCategory(.playAndRecord, mode: .voicePrompt, options: [.duckOthers, .defaultToSpeaker, .allowBluetooth, .allowBluetoothA2DP, .allowAirPlay]) + // try audioSession.setActive(true, options: .notifyOthersOnDeactivation) } catch { - print("Error configuring audio session: \(error)") + print("Error configuring audio session: \(error)") } } @@ -209,9 +209,9 @@ public class ExpoAudioStreamModule: Module { private func updateAudioRoute() { let audioSession = AVAudioSession.sharedInstance() let headphonesConnected = audioSession.currentRoute.outputs.contains { $0.portType == .headphones || $0.portType == .bluetoothA2DP } - try? audioSession.setPreferredInput(nil) try? audioSession.overrideOutputAudioPort(headphonesConnected ? .none : .speaker) print("updateAudioRoute: \(headphonesConnected)") + print("audioSession.currentRoute.outputs: \(audioSession.currentRoute.outputs)") } diff --git a/package.json b/package.json index ba509f7..92152e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mykin-ai/expo-audio-stream", - "version": "0.1.8", + "version": "0.1.9", "description": "Expo Audio Stream module", "main": "build/index.js", "types": "build/index.d.ts",