From 840c80546fe562f53471bbca2af7d054ead7ce5f Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Thu, 29 Feb 2024 02:31:14 +0400 Subject: [PATCH] Various fixes --- .../Sources/VideoMessageCameraScreen.swift | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/submodules/TelegramUI/Components/VideoMessageCameraScreen/Sources/VideoMessageCameraScreen.swift b/submodules/TelegramUI/Components/VideoMessageCameraScreen/Sources/VideoMessageCameraScreen.swift index 7f8af9e065..79f6fd787b 100644 --- a/submodules/TelegramUI/Components/VideoMessageCameraScreen/Sources/VideoMessageCameraScreen.swift +++ b/submodules/TelegramUI/Components/VideoMessageCameraScreen/Sources/VideoMessageCameraScreen.swift @@ -260,23 +260,25 @@ private final class VideoMessageCameraScreenComponent: CombinedComponent { controller.updateCameraState({ $0.updatedRecording(pressing ? .holding : .handsFree).updatedDuration(initialDuration) }, transition: .spring(duration: 0.4)) controller.node.withReadyCamera(isFirstTime: !controller.node.cameraIsActive) { - self.resultDisposable.set((camera.startRecording() - |> deliverOnMainQueue).start(next: { [weak self] recordingData in - let duration = initialDuration + recordingData.duration - if let self, let controller = self.getController() { - controller.updateCameraState({ $0.updatedDuration(duration) }, transition: .easeInOut(duration: 0.1)) - if isFirstRecording { - controller.node.setupLiveUpload(filePath: recordingData.filePath) + Queue.mainQueue().after(0.15) { + self.resultDisposable.set((camera.startRecording() + |> deliverOnMainQueue).start(next: { [weak self] recordingData in + let duration = initialDuration + recordingData.duration + if let self, let controller = self.getController() { + controller.updateCameraState({ $0.updatedDuration(duration) }, transition: .easeInOut(duration: 0.1)) + if isFirstRecording { + controller.node.setupLiveUpload(filePath: recordingData.filePath) + } + if duration > 59.5 { + controller.onStop() + } } - if duration > 59.5 { - controller.onStop() + }, error: { [weak self] _ in + if let self, let controller = self.getController() { + controller.completion(nil, nil, nil) } - } - }, error: { [weak self] _ in - if let self, let controller = self.getController() { - controller.completion(nil, nil, nil) - } - })) + })) + } } if initialDuration > 0.0 {