π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Fix video metadata rotation for rotation-only and rotation+trim operations
Prateek Sunaldc34a163b28e
diff --git a/mobile/packages/native_video_editor/ios/Classes/NativeVideoEditorPlugin.swift b/mobile/packages/native_video_editor/ios/Classes/NativeVideoEditorPlugin.swiftindex 6b2c903c59..53abb8bf87 100644--- a/mobile/packages/native_video_editor/ios/Classes/NativeVideoEditorPlugin.swift+++ b/mobile/packages/native_video_editor/ios/Classes/NativeVideoEditorPlugin.swift@@ -269,11 +269,19 @@ public class NativeVideoEditorPlugin: NSObject, FlutterPlugin {let naturalSize = videoTrack.naturalSizelet preferredTransform = videoTrack.preferredTransform- // Calculate oriented size by applying preferredTransform to handle existing metadata rotation- var orientedSize = naturalSize.applying(preferredTransform)- orientedSize = CGSize(width: abs(orientedSize.width), height: abs(orientedSize.height))+ // Apply orientation adjustment to handle existing metadata rotation properly+ let naturalBounds = CGRect(origin: .zero, size: naturalSize)+ let preferredBounds = naturalBounds.applying(preferredTransform)+ let orientationAdjustment = CGAffineTransform(+ translationX: -preferredBounds.minX,+ y: -preferredBounds.minY+ )+ let orientationTransform = preferredTransform.concatenating(orientationAdjustment)++ // Calculate oriented size for render calculations+ var orientedSize = CGSize(width: abs(preferredBounds.width), height: abs(preferredBounds.height))- var transform = preferredTransform+ var transform = orientationTransform// iOS CGAffineTransform rotates counter-clockwise for positive angles// To match Android behavior (positive = clockwise), we negate the radians@@ -663,10 +671,19 @@ public class NativeVideoEditorPlugin: NSObject, FlutterPlugin {} else if let rotateDegrees = args["rotateDegrees"] as? Int, rotateDegrees != 0 {isReEncoded = true- var orientedSize = naturalSize.applying(preferredTransform)- orientedSize = CGSize(width: abs(orientedSize.width), height: abs(orientedSize.height))+ // Apply orientation adjustment to handle existing metadata rotation properly+ let naturalBounds = CGRect(origin: .zero, size: naturalSize)+ let preferredBounds = naturalBounds.applying(preferredTransform)+ let orientationAdjustment = CGAffineTransform(+ translationX: -preferredBounds.minX,+ y: -preferredBounds.minY+ )+ let orientationTransform = preferredTransform.concatenating(orientationAdjustment)++ // Calculate oriented size for render calculations+ var orientedSize = CGSize(width: abs(preferredBounds.width), height: abs(preferredBounds.height))- var transform = preferredTransform+ var transform = orientationTransform// iOS CGAffineTransform rotates counter-clockwise for positive angles// To match Android behavior (positive = clockwise), we negate the radians