@@ -189,23 +189,18 @@ - (instancetype)initWithURL:(NSURL *)url
189
189
190
190
- (CGAffineTransform )fixTransform : (AVAssetTrack *)videoTrack {
191
191
CGAffineTransform transform = videoTrack.preferredTransform ;
192
- // TODO(@recastrodiaz): why do we need to do this? Why is the preferredTransform incorrect?
193
- // At least 2 user videos show a black screen when in portrait mode if we directly use the
194
- // videoTrack.preferredTransform Setting tx to the height of the video instead of 0, properly
195
- // displays the video https://github.com/flutter/flutter/issues/17606#issuecomment-413473181
196
- if (transform.tx == 0 && transform.ty == 0 ) {
197
- NSInteger rotationDegrees = (NSInteger )round (radiansToDegrees (atan2 (transform.b , transform.a )));
198
- NSLog (@" TX and TY are 0. Rotation: %ld . Natural width,height: %f , %f " , (long )rotationDegrees,
199
- videoTrack.naturalSize .width , videoTrack.naturalSize .height );
200
- if (rotationDegrees == 90 ) {
201
- NSLog (@" Setting transform tx" );
202
- transform.tx = videoTrack.naturalSize .height ;
203
- transform.ty = 0 ;
204
- } else if (rotationDegrees == 270 ) {
205
- NSLog (@" Setting transform ty" );
206
- transform.tx = 0 ;
207
- transform.ty = videoTrack.naturalSize .width ;
208
- }
192
+ NSInteger rotationDegrees = (NSInteger )round (radiansToDegrees (atan2 (transform.b , transform.a )));
193
+ CGSize size = videoTrack.naturalSize ;
194
+ NSLog (@" TX and TY: %f , %f . Rotation: %ld . Natural width and height: %f , %f " , transform.tx ,
195
+ transform.ty , (long )rotationDegrees, size.width , size.height );
196
+ if (rotationDegrees == 90 ) {
197
+ NSLog (@" Setting transform tx" );
198
+ transform.tx = size.height ;
199
+ transform.ty = 0 ;
200
+ } else if (rotationDegrees == 270 ) {
201
+ NSLog (@" Setting transform ty" );
202
+ transform.tx = 0 ;
203
+ transform.ty = size.width ;
209
204
}
210
205
return transform;
211
206
}
0 commit comments