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.
您可以使用UIImagePickerControllerReferenceURL
键获取资产的URL。
[[AVURLAsset alloc] initWithURL:[info objectForKey:UIImagePickerControllerReferenceURL]]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.