Reputation: 19418
I want to know How can I get the size of the video that is taken from iPhone camera (recording) ?
I want to set maximum video size for uploading videos on our server.
Example: Each user is subject to limits on the size of the video files they can upload.
Is it possible to get size of video after recording and if size is more then maximum size, then video can not be upload ??? and proper message get displayed ?
Thanks...
Upvotes: 1
Views: 3592
Reputation: 4879
In your UIImagePickerControllerDelegate
:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSURL * mediaURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSDictionary * properties = [[NSFileManager defaultManager] attributesOfItemAtPath:mediaURL.path error:&error];
NSNumber * size = [properties objectForKey: NSFileSize];
// Do your check here
}
size is a NSNumber that contains a unsigned long long.
Upvotes: 2