I have the following code which saves a UIImage or video which has been selected from the camera roll.
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
[self dismissModalViewControllerAnimated:YES];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
introImage = [info objectForKey:UIImagePickerControllerOriginalImage];
//Unhide our UIImage Preview and insert our chosen Video or Intro.
selectIntroButton.hidden = YES;
selectedIntro.hidden = NO;
cancelIntroChoiceButton.hidden = NO;
selectedIntro.image = introImage;
}
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie])
{
//Create variable for video.
AVURLAsset *asset=[[AVURLAsset alloc] initWithURL:??? options:nil];
AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
generator.appliesPreferredTrackTransform=TRUE;
[asset release];
CMTime thumbTime = CMTimeMakeWithSeconds(0,30);
My question is how do I feed the selected video into AVURLAssset initWithURL ? What type of object is [info objectForKey:UIImagePickerControllerOriginalImage] returning ?
Thank you.
You can get at the asset’s URL with the
UIImagePickerControllerReferenceURLkey.[[AVURLAsset alloc] initWithURL:[info objectForKey:UIImagePickerControllerReferenceURL]]