0

The movie plays just fine in MPMoviePlayerController. But when i press the button, then video have to change in Black & White or Vintage effects.

- (IBAction)videoCameraRoll:(id)sender
{
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie,      nil];
    [self presentViewController:imagePicker animated:YES completion:NULL];

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSURL *movieURL;
    NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
    if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo)
    {
        movieURL=(NSURL*)[info objectForKey:UIImagePickerControllerMediaURL];
    }
    movieController =  [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    movieController.view.frame = CGRectMake(0, 56, 320, 200);
    movieController.controlStyle = MPMovieControlStyleEmbedded;
    movieController.shouldAutoplay = YES;
    movieController.scalingMode=MPMovieScalingModeFill;
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:self.movieController];

    [self.view addSubview:movieController.view];
    [movieController prepareToPlay];
    [movieController setFullscreen:NO animated:NO];


    [picker dismissViewControllerAnimated:YES completion:NULL];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [picker dismissViewControllerAnimated:YES completion:NULL];
}

// Video Play Back Did Finish
- (void)moviePlayBackDidFinish:(NSNotification *)notification {

    [[NSNotificationCenter defaultCenter]removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
    [self.movieController stop];
    [self.movieController.view removeFromSuperview];
    self.movieController = nil;
}
Muthu Sabarinathan
  • 1,198
  • 2
  • 21
  • 49
  • 1
    for the video to change into b&w or vintage you need to use filters, the famous one is GPUImage(https://github.com/BradLarson/GPUImage) – savana Mar 27 '14 at 10:29
  • @savana - Thanks for your comment. please answer this comment for this questions. i have to upvote this answers. because it is useful for me. – Muthu Sabarinathan Mar 27 '14 at 11:24

0 Answers0