I have tow views in two different Xib, View1 and View2. In View2 I edit the video. What I need is to pass the video in View2 to View1 after I do some edit.
I have no idea how to make it. I know to pass (string or Image) but I do not know how to do it with video.
This is the code after I select Or record video in View2:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:nil];
NSString *mediaType = info[UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) // Media is a video
{
videoUrl = info[UIImagePickerControllerMediaURL];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
[self loadMoviePlayer:videoUrl];
}
}
Thanks
Use NSData to fetch content from video file or url of video and then pass this data object to view you want to pass. example:
NSData *videoData = [NSData dataWithContentsOfFile:videofilePath];
or
NSData *videoData = [NSData dataWithContentsOfURL:videoURL];