0
我试图确定PHAsset视频磁盘上的文件大小。如何获得视频PHAsset磁盘文件大小?
以下代码返回错误“无法打开文件”IMG_0188.mov“,因为您无权查看它。”
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
options.version = PHVideoRequestOptionsVersionOriginal;
[[PHImageManager defaultManager] requestAVAssetForVideo:asset options:options resultHandler:^(AVAsset *avAsset, AVAudioMix *audioMix, NSDictionary *info) {
videoURL = [(AVURLAsset*)avAsset URL];
NSNumber *videoDiskFileSize;
NSError *error;
[videoURL getResourceValue:&videoDiskFileSize forKey:NSURLFileSizeKey error:&error];
if(error){
NSLog(@"ERROR %@", error.localizedDescription);
}
NSLog(@"size is %f",[videoDiskFileSize floatValue]/(1024.0*1024.0));
}];