Skip to content
Snippets Groups Projects
Commit f914d982 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

audio: update audio route only after daemon initialized

Change-Id: Ib2e3f54c5a91a473d9b983415584ef2c33f57d60
parent cfa0d9b6
No related branches found
No related tags found
No related merge requests found
......@@ -119,6 +119,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// will enumerate and add devices once permission has been granted
self.videoService.setupInputs()
self.audioService.connectAudioSignal()
// start monitoring for network changes
self.networkService.monitorNetworkType()
......
......@@ -44,16 +44,6 @@ class AudioService {
init(withAudioAdapter audioAdapter: AudioAdapter) {
self.audioAdapter = audioAdapter
let bluetoothConnected = bluetoothAudioConnected()
let headphonesConnected = headphoneAudioConnected()
isHeadsetConnected.value = bluetoothConnected || headphonesConnected
// Listen for audio route changes
NotificationCenter.default.addObserver(
self,
selector: #selector(audioRouteChangeListener(_:)),
name: AVAudioSession.routeChangeNotification,
object: nil)
}
@objc private func audioRouteChangeListener(_ notification: Notification) {
......@@ -68,6 +58,19 @@ class AudioService {
overrideAudioRoute()
}
func connectAudioSignal() {
let bluetoothConnected = bluetoothAudioConnected()
let headphonesConnected = headphoneAudioConnected()
isHeadsetConnected.value = bluetoothConnected || headphonesConnected
// Listen for audio route changes
NotificationCenter.default.addObserver(
self,
selector: #selector(audioRouteChangeListener(_:)),
name: AVAudioSession.routeChangeNotification,
object: nil)
}
func overrideAudioRoute() {
let bluetoothConnected = bluetoothAudioConnected()
let headphonesConnected = headphoneAudioConnected()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment