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 e85f068 commit 0e863b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ios/ExpoAudioStreamModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ExpoAudioStreamModule: Module {
private func configureAudioSession() {
do {
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playback, mode: .voicePrompt, options: [.duckOthers ,.defaultToSpeaker, .allowBluetooth, .allowBluetoothA2DP, .allowAirPlay])
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)")
Expand Down Expand Up @@ -185,8 +185,9 @@ public class ExpoAudioStreamModule: Module {
}

private func monitorAudioRouteChanges() {
NotificationCenter.default.removeObserver(self)
NotificationCenter.default.addObserver(self, selector: #selector(handleAudioSessionRouteChange), name: AVAudioSession.routeChangeNotification, object: nil)
NotificationCenter.default.addObserver(forName: AVAudioSession.routeChangeNotification, object: AVAudioSession.sharedInstance(), queue: nil) { [weak self] notification in
self?.handleAudioSessionRouteChange(notification: notification)
}
}

@objc private func handleAudioSessionRouteChange(notification: Notification) {
Expand Down

0 comments on commit 0e863b5

Please sign in to comment.