Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pax-k committed Apr 19, 2024
1 parent a080476 commit b7665cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ios/ExpoAudioStreamModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
}
}

Expand Down Expand Up @@ -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)")
}


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit b7665cb

Please sign in to comment.