每次上传相同的视频+资产库

时间:2015-05-20 08:56:43

标签: objective-c nsdata assetslibrary avurlasset

    ImgVidData =[[NSData alloc]init];

    ALAssetRepresentation *representation = alAsset.defaultRepresentation;
    NSURL *movieURL = representation.url;
    NSURL *uploadURL = [NSURL fileURLWithPath:[[NSTemporaryDirectory() stringByAppendingPathComponent:@"test"] stringByAppendingString:@".mov"]];

  //  ImgVidData = [NSData dataWithContentsOfFile: [[NSTemporaryDirectory() stringByAppendingPathComponent:@"test"] stringByAppendingString:@".mp4"]];

    AVAsset *asset      = [AVURLAsset URLAssetWithURL:movieURL options:nil];
    AVAssetExportSession *session =
    [AVAssetExportSession exportSessionWithAsset:asset presetName:AVAssetExportPresetMediumQuality];

    session.outputFileType  = AVFileTypeQuickTimeMovie;
    session.outputURL       = uploadURL;
    videoURL=uploadURL;
          [session exportAsynchronouslyWithCompletionHandler:^{

        if (session.status == AVAssetExportSessionStatusCompleted)
        {
            NSLog(@"output Video URL %@",uploadURL);

        }



    }];
    ImgVidData    = [NSData dataWithContentsOfURL:session.outputURL];

以上是代码,我在didFinishPickingAssets中实现了:(NSArray *)资产

我正在拿起视频并将视频上传到服务器。我正在获取上传的视频网址并将其转换为NSdata并将其上传到服务器。

STRANGE:每当我将相同的视频上传到我第一次选择的服务器时。我每次都选择不同的视频,但相同的视频上传。 任何帮助!!

0 个答案:

没有答案