使用ALAsset Library从库中选择视频并将该视频转换为数据类型

时间:2012-06-11 09:32:00

标签: ios4

我正在使用ALAssert库从iPhone库中选择视频,我正在设置该视频文件的属性,如。

 (void)selectedAssets:(NSArray*)_assets {

NSMutableArray *returnArray = [[[NSMutableArray alloc] init] autorelease];

for(ALAsset *asset in _assets) {


    NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];

    [workingDictionary setObject:[asset valueForProperty:ALAssetPropertyType] forKey:@"UIImagePickerControllerMediaType"];

    [workingDictionary setObject:[UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]] forKey:@"UIImagePickerControllerOriginalImage"];

    [workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:@"UIImagePickerControllerReferenceURL"];

    [workingDictionary setObject:[[asset defaultRepresentation]url] forKey:@"UIImagePickerControllerMediaURL"];

    [returnArray addObject:workingDictionary];        
    [workingDictionary release];    
}

[self popToRootViewControllerAnimated:NO];
[[self parentViewController] dismissModalViewControllerAnimated:YES];

if([delegate respondsToSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:)]) {
    [delegate performSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:) withObject:self withObject:[NSArray arrayWithArray:returnArray]];
}

}

我在这里设置UIImagePickerControllerMediaURL,但我认为不是像我做的那样设置UIImagePickerControllerMediaURL的权利。

如何为所选视频提供UIImagePickerControllerMediaURL属性。并将该视频MediaURL转换为数据类型。

0 个答案:

没有答案