mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Camera and editor improvements
This commit is contained in:
@@ -219,6 +219,8 @@ public func fetchVideoLibraryMediaResource(account: Account, resource: VideoLibr
|
||||
|
||||
let alreadyReceivedAsset = Atomic<Bool>(value: false)
|
||||
if asset.mediaType == .image {
|
||||
Logger.shared.log("FetchVideoResource", "Getting asset image \(asset.localIdentifier)")
|
||||
|
||||
let options = PHImageRequestOptions()
|
||||
options.isNetworkAccessAllowed = true
|
||||
options.deliveryMode = .highQualityFormat
|
||||
@@ -230,6 +232,8 @@ public func fetchVideoLibraryMediaResource(account: Account, resource: VideoLibr
|
||||
return
|
||||
}
|
||||
|
||||
Logger.shared.log("FetchVideoResource", "Got asset image \(asset.localIdentifier)")
|
||||
|
||||
var mediaEditorValues: MediaEditorValues?
|
||||
if case let .compress(adjustmentsValue) = resource.conversion, let adjustmentsValue, adjustmentsValue.isStory {
|
||||
if let values = try? JSONDecoder().decode(MediaEditorValues.self, from: adjustmentsValue.data.makeData()) {
|
||||
@@ -241,10 +245,12 @@ public func fetchVideoLibraryMediaResource(account: Account, resource: VideoLibr
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "video.mp4")
|
||||
let updatedSize = Atomic<Int64>(value: 0)
|
||||
if let mediaEditorValues {
|
||||
Logger.shared.log("FetchVideoResource", "Requesting video export")
|
||||
|
||||
let configuration = recommendedVideoExportConfiguration(values: mediaEditorValues, frameRate: 30.0)
|
||||
let videoExport = MediaEditorVideoExport(account: account, subject: .image(image), configuration: configuration, outputPath: tempFile.path)
|
||||
videoExport.start()
|
||||
|
||||
|
||||
let statusDisposable = videoExport.status.start(next: { status in
|
||||
switch status {
|
||||
case .completed:
|
||||
|
||||
Reference in New Issue
Block a user