gpt4 book ai didi

iphone - 关闭 UIImagePicker 后获取视频长度?

转载 作者:行者123 更新时间:2023-12-03 20:25:36 25 4
gpt4 key购买 nike

我想获取用户选择的视频的长度。我使用苹果 UIImagePicker,

这是到目前为止我的代码:

    [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];

谢谢:D

最佳答案

你可以这样做

AVAsset *movie = [AVAsset assetWithURL:[info objectForKey:UIImagePickerControllerMediaURL]];
CMTime movieLength = movie.duration;

关于iphone - 关闭 UIImagePicker 后获取视频长度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8025587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com