IOS 6: AVPlayerItem PresentationSize returns zero - (naturalSize method is deprecated on iOS 5)

Got this code:

videoSize = [[AVPlayerItem playerItemWithAsset:asset] presentationSize]; 

      

// nslogs -> height: 000 width 000

And this is deprecated:

videoSize = [asset naturalSize];

      

// nslogs -> height: 360 width 480

Why is this happening? I do not understand.

+3


source to share


1 answer


Solved:

NSArray* allVideoTracks = [movieAsset tracksWithMediaType:AVMediaTypeVideo];
if ([allVideoTracks count] > 0) {
AVAssetTrack* track = [[movieAsset tracksWithMediaType:AVMediaTypeVideo]objectAtIndex:0];
CGSize size = [track naturalSize];
}

      



this made my day, hope it works for someone else ...

+10


source







All Articles