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];
Above is the code , i have implemented inside didFinishPickingAssets:(NSArray *)assets
I'm picking up the video and uploading the video to server. I'm fetching uploaded video URL and converting it into NSdata and uploading it to server.
STRANGE : everytime I'm getting same video uploaded to server which i choose first time. i choose different video everytime but same videos get uplaoded. Any help !!