mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix video call headphones
This commit is contained in:
parent
1af7d86c0c
commit
e0b7e4087c
@ -58,6 +58,7 @@ private func nativeCategoryForType(_ type: ManagedAudioSessionType, headphones:
|
||||
public enum AudioSessionPortType {
|
||||
case generic
|
||||
case bluetooth
|
||||
case wired
|
||||
}
|
||||
|
||||
public struct AudioSessionPort: Equatable {
|
||||
@ -77,7 +78,14 @@ private let bluetoothPortTypes = Set<AVAudioSession.Port>([.bluetoothA2DP, .blue
|
||||
|
||||
private extension AudioSessionOutput {
|
||||
init(description: AVAudioSessionPortDescription) {
|
||||
self = .port(AudioSessionPort(uid: description.uid, name: description.portName, type: bluetoothPortTypes.contains(description.portType) ? .bluetooth : .generic))
|
||||
var type: AudioSessionPortType = .generic
|
||||
if bluetoothPortTypes.contains(description.portType) {
|
||||
type = .bluetooth
|
||||
} else if description.uid == "Wired Headphones" || description.uid == "Wired Microphone" {
|
||||
type = .wired
|
||||
}
|
||||
|
||||
self = .port(AudioSessionPort(uid: description.uid, name: description.portName, type: type))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -825,7 +825,7 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro
|
||||
switch currentOutput {
|
||||
case .headphones, .speaker:
|
||||
break
|
||||
case let .port(port) where port.type == .bluetooth:
|
||||
case let .port(port) where port.type == .bluetooth || port.type == .wired:
|
||||
break
|
||||
default:
|
||||
self.setCurrentAudioOutput?(.speaker)
|
||||
|
Loading…
x
Reference in New Issue
Block a user