forked from mirrors/linphone-iphone
Disable AVAudioSession at application startup
This commit is contained in:
parent
9ef28d00f6
commit
dedd68326a
2 changed files with 22 additions and 2 deletions
|
|
@ -76,6 +76,12 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
callViewModel.enableAVAudioSession()
|
||||
}
|
||||
.onDisappear {
|
||||
callViewModel.disableAVAudioSession()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,12 +53,26 @@ class CallViewModel: ObservableObject {
|
|||
init() {
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .voiceChat, options: .allowBluetooth)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
resetCallView()
|
||||
}
|
||||
|
||||
func enableAVAudioSession(){
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setActive(true)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
|
||||
resetCallView()
|
||||
}
|
||||
|
||||
func disableAVAudioSession(){
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setActive(false)
|
||||
} catch _ {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func resetCallView() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue