0

我有以下代码保存从相机胶卷中选择的 UIImage 或视频。

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);

我的问题是如何将所选视频输入 AVURLAssset initWithURL ?[info objectForKey:UIImagePickerControllerOriginalImage] 返回什么类型的对象?

谢谢你。

4

1 回答 1

0

UIImagePickerControllerReferenceURL您可以使用密钥获取资产的 URL 。

[[AVURLAsset alloc] initWithURL:[info objectForKey:UIImagePickerControllerReferenceURL]]

于 2012-04-18T15:23:12.377 回答