mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Fix camera selection
This commit is contained in:
parent
a886d60f89
commit
9ca6a1a4a5
@ -58,7 +58,7 @@ final class CameraDeviceContext {
|
|||||||
|
|
||||||
self.previewView = previewView
|
self.previewView = previewView
|
||||||
|
|
||||||
self.device.configure(for: session, position: position)
|
self.device.configure(for: session, position: position, dual: !exclusive || additional)
|
||||||
self.input.configure(for: session, device: self.device, audio: audio)
|
self.input.configure(for: session, device: self.device, audio: audio)
|
||||||
self.output.configure(for: session, device: self.device, input: self.input, previewView: previewView, audio: audio, photo: photo, metadata: metadata)
|
self.output.configure(for: session, device: self.device, input: self.input, previewView: previewView, audio: audio, photo: photo, metadata: metadata)
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ final class CameraDevice {
|
|||||||
|
|
||||||
public private(set) var audioDevice: AVCaptureDevice? = nil
|
public private(set) var audioDevice: AVCaptureDevice? = nil
|
||||||
|
|
||||||
func configure(for session: CameraSession, position: Camera.Position) {
|
func configure(for session: CameraSession, position: Camera.Position, dual: Bool) {
|
||||||
self.position = position
|
self.position = position
|
||||||
|
|
||||||
var selectedDevice: AVCaptureDevice?
|
var selectedDevice: AVCaptureDevice?
|
||||||
if #available(iOS 13.0, *), position != .front {
|
if #available(iOS 13.0, *), position != .front && !dual {
|
||||||
if let device = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position) {
|
if let device = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position) {
|
||||||
selectedDevice = device
|
selectedDevice = device
|
||||||
} else if let device = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: position) {
|
} else if let device = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: position) {
|
||||||
|
@ -660,6 +660,7 @@ final class VideoInputScalePass: RenderPass {
|
|||||||
width = Int(scaledSize.width)
|
width = Int(scaledSize.width)
|
||||||
height = Int(scaledSize.height)
|
height = Int(scaledSize.height)
|
||||||
}
|
}
|
||||||
|
self.mainPosition = VideoPosition(position: CGPoint(x: width / 2, y: height / 2), size: CGSize(width: width, height: height), scale: 1.0, rotation: 0.0)
|
||||||
|
|
||||||
let containerSize = CGSize(width: width, height: height)
|
let containerSize = CGSize(width: width, height: height)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user