Video: Increase compression when in extension

This commit is contained in:
Thomas Ricouard 2024-01-24 16:56:35 +01:00
parent c7bd5a1d94
commit 096996c242

View file

@ -87,7 +87,12 @@ extension StatusEditor {
func compressVideo(_ url: URL) async -> URL? {
await withCheckedContinuation { continuation in
let urlAsset = AVURLAsset(url: url, options: nil)
guard let exportSession = AVAssetExportSession(asset: urlAsset, presetName: AVAssetExportPreset1920x1080) else {
let presetName: String = if Bundle.main.bundlePath.hasSuffix(".appex") {
AVAssetExportPreset1280x720
} else {
AVAssetExportPreset1920x1080
}
guard let exportSession = AVAssetExportSession(asset: urlAsset, presetName: presetName) else {
continuation.resume(returning: nil)
return
}