forked from mirrors/linphone-iphone
Fix meeting waiting room when headphone is connected
This commit is contained in:
parent
b523315e82
commit
e4c64cc4af
2 changed files with 17 additions and 7 deletions
|
|
@ -52,7 +52,9 @@ struct MeetingWaitingRoomFragment: View {
|
||||||
})
|
})
|
||||||
.onAppear {
|
.onAppear {
|
||||||
meetingWaitingRoomViewModel.enableAVAudioSession()
|
meetingWaitingRoomViewModel.enableAVAudioSession()
|
||||||
if AVAudioSession.sharedInstance().currentRoute.outputs.filter({ $0.portType.rawValue.contains("Bluetooth") }).isEmpty {
|
if AVAudioSession.sharedInstance().currentRoute.outputs.filter({
|
||||||
|
$0.portType.rawValue.contains("Bluetooth") || $0.portType.rawValue.contains("Headphones")
|
||||||
|
}).isEmpty {
|
||||||
do {
|
do {
|
||||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
|
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
|
||||||
} catch _ {
|
} catch _ {
|
||||||
|
|
@ -72,8 +74,9 @@ struct MeetingWaitingRoomFragment: View {
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
meetingWaitingRoomViewModel.enableAVAudioSession()
|
meetingWaitingRoomViewModel.enableAVAudioSession()
|
||||||
|
if AVAudioSession.sharedInstance().currentRoute.outputs.filter({
|
||||||
if AVAudioSession.sharedInstance().currentRoute.outputs.filter({ $0.portType.rawValue.contains("Bluetooth") }).isEmpty {
|
$0.portType.rawValue.contains("Bluetooth") || $0.portType.rawValue.contains("Headphones")
|
||||||
|
}).isEmpty {
|
||||||
do {
|
do {
|
||||||
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
|
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
|
||||||
} catch _ {
|
} catch _ {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
||||||
|
|
||||||
func resetMeetingRoomView() {
|
func resetMeetingRoomView() {
|
||||||
if self.telecomManager.meetingWaitingRoomSelected != nil {
|
if self.telecomManager.meetingWaitingRoomSelected != nil {
|
||||||
|
do {
|
||||||
|
try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .voiceChat, options: .allowBluetooth)
|
||||||
|
} catch _ {
|
||||||
|
|
||||||
|
}
|
||||||
coreContext.doOnCoreQueue { core in
|
coreContext.doOnCoreQueue { core in
|
||||||
|
|
||||||
let conf = core.findConferenceInformationFromUri(uri: self.telecomManager.meetingWaitingRoomSelected!)
|
let conf = core.findConferenceInformationFromUri(uri: self.telecomManager.meetingWaitingRoomSelected!)
|
||||||
|
|
@ -73,10 +78,12 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
||||||
if friend != nil && friend!.address != nil && friend!.address!.displayName != nil {
|
if friend != nil && friend!.address != nil && friend!.address!.displayName != nil {
|
||||||
userNameTmp = friend!.address!.displayName!
|
userNameTmp = friend!.address!.displayName!
|
||||||
} else {
|
} else {
|
||||||
if core.defaultAccount!.contactAddress!.displayName != nil {
|
if core.defaultAccount != nil && core.defaultAccount!.contactAddress != nil {
|
||||||
userNameTmp = core.defaultAccount!.contactAddress!.displayName!
|
if core.defaultAccount!.contactAddress!.displayName != nil {
|
||||||
} else if core.defaultAccount!.contactAddress!.username != nil {
|
userNameTmp = core.defaultAccount!.contactAddress!.displayName!
|
||||||
userNameTmp = core.defaultAccount!.contactAddress!.username!
|
} else if core.defaultAccount!.contactAddress!.username != nil {
|
||||||
|
userNameTmp = core.defaultAccount!.contactAddress!.username!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue