【发布时间】:2015-10-29 10:35:29
【问题描述】:
我想将 PHAsset 视频从 iCloud 下载到应用程序的临时目录。如果可能的话,该怎么做?
【问题讨论】:
标签: ios download icloud phasset
我想将 PHAsset 视频从 iCloud 下载到应用程序的临时目录。如果可能的话,该怎么做?
【问题讨论】:
标签: ios download icloud phasset
此代码应该可以帮助您入门:
PHImageManager* manager = [PHImageManager defaultManager];
PHVideoRequestOptions* requestOptions = [PHVideoRequestOptions new];
requestOptions.networkAccessAllowed = YES;
requestOptions.progressHandler = ^(double progress, NSError* error, BOOL* stop, NSDictionary* info) {
NSLog(@"cacheAsset: %f", progress);
};
[manager requestExportSessionForVideo:inAsset
options:requestOptions
exportPreset:AVAssetExportPresetPassthrough resultHandler:^(AVAssetExportSession* exportSession, NSDictionary* info) {
exportSession.outputURL = url;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
// Do something here with the result. Make sure to check the info dictionary for additional status.
}];
}];
【讨论】: