Iphone 在解除UIImagePicker后获取视频长度?
我想获得用户选择的视频长度。我在用苹果采摘器 以下是我目前的代码:Iphone 在解除UIImagePicker后获取视频长度?,iphone,objective-c,ios,nsdata,Iphone,Objective C,Ios,Nsdata,我想获得用户选择的视频长度。我在用苹果采摘器 以下是我目前的代码: [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:UIImagePickerController
[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];
谢谢:你能做到的
AVAsset *movie = [AVAsset assetWithURL:[info objectForKey:UIImagePickerControllerMediaURL]];
CMTime movieLength = movie.duration;
这个链接可能会对你有所帮助,我该怎么做呢?我把它记为%i,一个19秒的视频得到了600。我还尝试将其记录为%@并崩溃。我想把它转换成秒。谢谢你的回答,顺便说一句。看看这里: