NSLog(@”%ld”,videoData.length);
if (!self.data) {
self.data = [[NSMutableData alloc] initWithData:videoData];
}else {
//NSMutableData *newData = [NSMutableData dataWithData:videoData];
[self.data appendBytes:videoData.bytes length:videoData.length];
//[self.data appendData:videoData];
NSLog(@”self.newdata= %ld”,self.data.length);
NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:
[NSString stringWithFormat:@”%@.%@”,
@”video”,@”mp4″]];
[self.data writeToFile:path atomically:NO];
NSURL *viedeoUrl = [NSURL fileURLWithPath:path];
// [self.data writeToURL:viedeoUrl atomically:NO];
NSLog(@”%ld”,[NSData dataWithContentsOfURL:viedeoUrl].length);
NSLog(@”path = %@”,viedeoUrl);
ALAssetsLibrary * library = [[ALAssetsLibrary alloc]init];
[library writeVideoAtPathToSavedPhotosAlbum:viedeoUrl completionBlock:^(NSURL *assetURL, NSError *error) {
NSLog(@”%@”,assetURL);
NSLog(@”%ld”,[NSData dataWithContentsOfURL:assetURL].length);
NSLog(@”error:%@”,error);
}];
20
20
UIImageWriteToSavedPhotosAlbum(image, self, @selector(savedPhotoImage:didFinishSavingWithError:contextInfo:), nil);
好吧,吧图片保存到相册,试试这个方法