【问题标题】:Download iCloud video to the temporary directory将 iCloud 视频下载到临时目录
【发布时间】:2015-10-29 10:35:29
【问题描述】:

我想将 PHAsset 视频从 iCloud 下载到应用程序的临时目录。如果可能的话,该怎么做?

【问题讨论】:

    标签: ios download icloud phasset


    【解决方案1】:

    此代码应该可以帮助您入门:

     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.
                                     }];
                                 }];
    

    【讨论】:

    • 谢谢!我们一直在使用 requestAsset 版本,它大部分都能正常工作,但一些 icloud 视频存在问题,共享 icloud 视频通常会完全失败。
    猜你喜欢
    • 2017-04-04
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    • 2013-08-04
    • 1970-01-01
    • 2017-07-10
    • 2021-06-09
    • 2020-07-02
    相关资源
    最近更新 更多