获取方法如下:
使用PhotoKit框架
[[PHImageManager defaultManager] requestPlayerItemForVideo:videoAsset options:nil resultHandler:^(AVPlayerItem * _Nullable playerItem, NSDictionary * _Nullable info) {
NSString *filePath = [info valueForKey:@"PHImageFileSandboxExtensionTokenKey"];
if (filePath && filePath.length > 0) {
NSArray *lyricArr = [filePath componentsSeparatedByString:@";"];
NSString *privatePath = [lyricArr lastObject];
if (privatePath.length > 8) {
NSString *videoPath = [privatePath substringFromIndex:8];
NSLog(@"videoPath = %@",videoPath);
}
}
}];
网友评论