I have an app where I can shoot a video and then store it in core-data with some other data. It's stored as Transformable and "Store in External Record File". I get the video clip into an object called movie like this;
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
movie = [info objectForKey:UIImagePickerControllerEditedImage];
Where I get stuck is to get a thumbnail from the movie. Using MPMoviePlayerController
I have to have an URL, but the movie isn't stored anywhere yet. Plus finding the URL from the core-data is a mystery as well.
The closest help I can find here is Getting a thumbnail from a video url or data in iPhone SDK . But I get caught out on the URL issue.
I am saving it to core-data like this;
NSManagedObjectContext *context = [self managedObjectContext];
NSManagedObject *newMedia = [NSEntityDescriptioninsertNewObjectForEntityForName:@"Media" inManagedObjectContext:context];
[newMedia setValue:@"Video Clip " forKey:@"title"];
[newMedia setValue:now forKey:@"date_time"];
[newMedia setValue:movie forKey:@"movie"];
[newMedia setValue:[self generateImage] forKey:@"frame"];
I would be grateful if there is someone out there that can give me a pointer.
You can get your movie URL like this and then use this URL to get thumbnail using MPMoviePlayerController.
To get thumbnail from movie...
I used like this in my app
used like