앨범에 동영상 저장하는 방법
// 앨범에 파일 복사
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
NSString *plistPath;
NSString *rootPath;
rootPath= [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
plistPath = [rootPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mov", filenameNow]];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:plistPath];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:fileURL]) {
[library writeVideoAtPathToSavedPhotosAlbum:fileURL completionBlock:^(NSURL *assetURL, NSError *error){
if (error) {
// TODO: error handling
NSLog(@"error: %@", error);
} else {
// TODO: success handling
NSLog(@"movie file saved album");
[self.btnRecord setTitle:@"Start" forState:UIControlStateNormal];
[self.btnRecord setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// updateRecodingValue 취소
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(updateRecodingValue) object:nil];
// 데이터베이스파일 생성 및 백업
//[self createDataBaseFile];
}
}];
}
댓글
댓글 쓰기