views:

404

answers:

2

I have seen this question pop up a few times but the authors see to be satisfied with the wrong answer, so I will ask again.

When picking a movie out of the user's gallery, I am given a MOV in the tmp directory but I am not given the thumbnail for the movie now in the 3.1+ sdk. In sdk 3.0, you get a jpg in the tmp folder but this behavior has stopped.

Is there an answer to get the thumb besides ffmpeg? Anything supported by the sdk?

I get a thumb when they shoot a video directly.

This answer is wrong: http://stackoverflow.com/questions/1259316/iphone-sdk-3-0-video-thumbnail

A: 

Hi,

Have you had any luck with this yet? I've seeing the same results as you - ie: the new MOV in the tmp folder but no thumbnail.

Out of interest where are you finding the thumbnail after shooting a video? I've been up all night trying to get one to show ;)

Kosso
No, in fact it is worse with sdk 3.2+. There is a community bug report with this issue on it. Sorry, we are SOL until apple opens some magic api for this.
deoryp
A: 

Found the answer, but I had to wait until iOS4 (the feature came out in 3.2)

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    if ([mediaType compare:(NSString*)kUTTypeMovie] == NSOrderedSame) {
        // deal with the movie
        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
        NSURL *mediaUrl = [info objectForKey:UIImagePickerControllerMediaURL];
        NSLog(@"media Url = %@, path %@", mediaUrl, [mediaUrl path]);
        MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:mediaUrl];
        UIImage *thumbnail = [[moviePlayer thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame] retain];
        [moviePlayer release];
        NSLog(@"thumbnail = %@", thumbnail);
        [thumbnail release];
    }
}
deoryp