Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int timestamp = [[NSDate date] timeIntervalSince1970];
- NSURL *videoURL = _movieURL;
- NSData *videoData = [NSData dataWithContentsOfFile: videoURL];
- NSString *videoString = [NSString stringWithFormat:@"%d.MOV", timestamp];
- NSString *videoPath = [documentsPath stringByAppendingPathComponent: videoString]; //Add the file name
- [videoData writeToFile:videoPath atomically:NO];
- -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
- self.movieURL = info[UIImagePickerControllerMediaURL];
- // NSLOg("MOVIE URL: %@", _movieURL);
- [picker dismissViewControllerAnimated:YES completion:NULL];
- }
- NSURL *videoURL = _movieURL;
- NSData *videoData = [NSData dataWithContentsOfFile: videoURL];
- NSData *videoData = [NSData dataWithContentsOfURL: videoURL];
- UISaveVideoAtPathToSavedPhotosAlbum (
- moviePath, nil, nil, nil);
- - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; {
- // Handle a movie capture
- if (CFStringCompare ((CFStringRef) mediaType, kUTTypeMovie, 0)
- == kCFCompareEqualTo) {
- NSString *moviePath = [[info objectForKey:
- UIImagePickerControllerMediaURL] path];
- if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
- UISaveVideoAtPathToSavedPhotosAlbum (
- moviePath, nil, nil, nil);
- }
- }
- }
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- NSString *documentsDirectory = [paths objectAtIndex:0];
- NSDate *aDate = [NSDate date];
- NSTimeInterval interval = [aDate timeIntervalSince1970];
- NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%d.mov",(int)interval]];
- [vidData writeToFile:localFilePath atomically:YES];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement