I use until now this code for saving video that i get from UIImagePickerController:
NSURL *url = [info objectForKey:UIImagePickerControllerMediaURL];
NSData *videoData = [NSData dataWithContentsOfURL:url];
path = [kFilesSaveDirectory stringByAppendingFormat:@"%@/Vid%d.mov",album.albumName,album.lastfile];
path2 = [kFilesSaveDirectory stringByAppendingFormat:@"%@/VidImg%d.png",album.albumName,album.lastfile];
[videoData writeToFile:path atomically:NO];
[[videoPlayer moviePlayer] setContentURL:[NSURL URLWithString:path]];
UIImage *image = [[videoPlayer moviePlayer] thumbnailImageAtTime:1.0 timeOption: MPMovieTimeOptionNearestKeyFrame];
[[videoPlayer moviePlayer] setContentURL:nil];
[UIImagePNGRepresentation(image) writeToFile:path2 atomically:YES];
Until now in ios 4 it work without any problems, but when i try to use it now in ios 5 ,it do two problems:
- it give me nil for the img.
2.it not show me the video when i want to show it with this code :
[[videoPlayer moviePlayer] setContentURL:[NSURL URLWithString:choosen.bigpath]];
[self presentModalViewController:videoPlayer animated:YES];
[[videoPlayer moviePlayer] play];
This is working for me –
I added this code to this delegate
Hope it works for you also 🙂