mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-12 03:33:41 +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 {
|
public enum AudioSessionPortType {
|
||||||
case generic
|
case generic
|
||||||
case bluetooth
|
case bluetooth
|
||||||
|
case wired
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct AudioSessionPort: Equatable {
|
public struct AudioSessionPort: Equatable {
|
||||||
@ -77,7 +78,14 @@ private let bluetoothPortTypes = Set<AVAudioSession.Port>([.bluetoothA2DP, .blue
|
|||||||
|
|
||||||
private extension AudioSessionOutput {
|
private extension AudioSessionOutput {
|
||||||
init(description: AVAudioSessionPortDescription) {
|
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 {
|
switch currentOutput {
|
||||||
case .headphones, .speaker:
|
case .headphones, .speaker:
|
||||||
break
|
break
|
||||||
case let .port(port) where port.type == .bluetooth:
|
case let .port(port) where port.type == .bluetooth || port.type == .wired:
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
self.setCurrentAudioOutput?(.speaker)
|
self.setCurrentAudioOutput?(.speaker)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user