Reputation: 1459
i want to get the length of a video that the user picks. Im using apples UIImagePicker,
here is my code so far:
[self dismissModalViewControllerAnimated:YES];
//assign the mediatype to a string
//check the media type string so we can determine if its a video
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
webData = [[NSData alloc]init];
webData = [NSData dataWithContentsOfURL:videoURL];
//[self post:webData];
video = 1;
upload.hidden = NO;
ImagesCopy = [[NSMutableArray alloc]initWithObjects:@"1", nil];
[tableview reloadData];
Thanks :D
Upvotes: 2
Views: 1580
Reputation: 6557
You can do this
AVAsset *movie = [AVAsset assetWithURL:[info objectForKey:UIImagePickerControllerMediaURL]];
CMTime movieLength = movie.duration;
Upvotes: 7