I am using UIImagePickerController to choose video file from library. And user can upload the video.
Also I am using videoMaximumDuration p
Got the solution : I use AVPlayerItem class and AVFoundation and CoreMedia framework.
#import
#import
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
selectedVideoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:selectedVideoUrl];
CMTime duration = playerItem.duration;
float seconds = CMTimeGetSeconds(duration);
NSLog(@"duration: %.2f", seconds);
}