mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various improvements
This commit is contained in:
@@ -903,7 +903,6 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate {
|
||||
|
||||
private let context: AccountContext
|
||||
private let collage: CameraCollage
|
||||
private weak var camera: Camera?
|
||||
private weak var cameraContainerView: UIView?
|
||||
|
||||
private var cameraVideoSource: CameraVideoSource?
|
||||
@@ -934,9 +933,10 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate {
|
||||
return self.collage.result(itemViews: self.itemViews)
|
||||
}
|
||||
|
||||
init(context: AccountContext, collage: CameraCollage, camera: Camera?, cameraContainerView: UIView?) {
|
||||
init(context: AccountContext, collage: CameraCollage, cameraVideoSource: CameraVideoSource, cameraContainerView: UIView?) {
|
||||
self.context = context
|
||||
self.collage = collage
|
||||
self.cameraVideoSource = cameraVideoSource
|
||||
self.cameraContainerView = cameraContainerView
|
||||
|
||||
self.cloneLayers = (0 ..< 6).map { _ in MetalEngineSubjectLayer() }
|
||||
@@ -1009,17 +1009,12 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate {
|
||||
self.tapRecognizer = tapRecognizer
|
||||
self.addGestureRecognizer(tapRecognizer)
|
||||
|
||||
if let cameraVideoSource = CameraVideoSource() {
|
||||
self.cameraVideoLayer.video = cameraVideoSource.currentOutput
|
||||
camera?.setPreviewOutput(cameraVideoSource.cameraVideoOutput)
|
||||
self.cameraVideoSource = cameraVideoSource
|
||||
|
||||
self.cameraVideoDisposable = cameraVideoSource.addOnUpdated { [weak self] in
|
||||
guard let self, let videoSource = self.cameraVideoSource, self.isEnabled else {
|
||||
return
|
||||
}
|
||||
self.cameraVideoLayer.video = videoSource.currentOutput
|
||||
self.cameraVideoLayer.video = cameraVideoSource.currentOutput
|
||||
self.cameraVideoDisposable = cameraVideoSource.addOnUpdated { [weak self] in
|
||||
guard let self, let videoSource = self.cameraVideoSource, self.isEnabled else {
|
||||
return
|
||||
}
|
||||
self.cameraVideoLayer.video = videoSource.currentOutput
|
||||
}
|
||||
|
||||
let videoSize = CGSize(width: 160.0 * 2.0, height: 284.0 * 2.0)
|
||||
@@ -1035,7 +1030,6 @@ final class CameraCollageView: UIView, UIGestureRecognizerDelegate {
|
||||
deinit {
|
||||
self.disposable?.dispose()
|
||||
self.cameraVideoDisposable?.dispose()
|
||||
self.camera?.setPreviewOutput(nil)
|
||||
}
|
||||
|
||||
func getPreviewLayer() -> PreviewLayer {
|
||||
|
||||
Reference in New Issue
Block a user