I have strange MPMoviePlayerController behavior. It don't want to play movies just chosen from UIImagePickerController's Camera Roll. But when I capture movie with UIImagePickerController - sometimes it plays in MPMoviePlayerController fine.
This is UIImagePickerController initialization:
mediaPickerController = [[[UIImagePickerController alloc] init] autorelease];
NSArray *types = [UIImagePickerController availableMediaTypesForSourceType:sourceType];
mediaPickerController.sourceType = sourceType;
mediaPickerController.mediaTypes = types;
mediaPickerController.videoQuality = qualityType;
mediaPickerController.delegate = self;
[self presentModalViewController:mediaPickerController animated:YES];
This is - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info delegate method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSURL *fileURL = [info objectForKey:UIImagePickerControllerMediaURL];
playerView = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[playerView.view setFrame:mediaPreview.bounds];
[playerView setScalingMode:MPMovieScalingModeAspectFit];
[playerView setControlStyle:MPMovieControlStyleEmbedded];
[playerView setShouldAutoplay:NO];
[playerView prepareToPlay];
[mediaPreview addSubview:playerView.view];
}
Another strange issue - when I use UIImagePickerController's sourceType = Camera, then delegate return next path and plays fine:
UIImagePickerControllerMediaURL = "file://localhost/private/var/mobile/Applications/XXXXX-XXXXX/tmp/capture-T0x127bb0.tmp.5gFkOo/capturedvideo.MOV"
but when sourceType = Library, path looks incorrect and movie appears at half second and disappears:
UIImagePickerControllerMediaURL = "file://localhost/private/var/mobile/Applications/XXXXX-XXXXX/tmp//trim.ZPeyTU.MOV"
Have any ideas?