无法将视频加载到UIVideoEditorController中

时间:2014-09-16 12:53:40

标签: ios objective-c iphone ios7

我收到错误,UIVideoEditorController无法找到使用URL加载并存储在字典中的视频UIImagePicker

我正在使用以下内容,但是对于以下网址,canEditVideoAtPath返回false:

file:///private/var/mobile/Containers/Data/Application/83449852-2DC2-42AB-9FFA-C2C7931380C4/tmp/trim.28F7EE00-9F2E-4421-8E2B-8A70789CAFDE.MOV

知道为什么以下代码不起作用?

NSLog(@"%@",[[self.movieArray objectAtIndex:[sender tag]] objectForKey:@"MovieURL"]);

NSString *videoPath = [NSString stringWithFormat:@"%@",[[self.movieArray objectAtIndex:[sender tag]] objectForKey:@"MovieURL"]];

UIVideoEditorController *editorController = [[UIVideoEditorController alloc] init];

if([UIVideoEditorController canEditVideoAtPath:videoPath]){

    editorController.videoPath = [NSString stringWithFormat:@"%@",[[self.movieArray objectAtIndex:[sender tag]] objectForKey:@"MovieURL"]];
    editorController.delegate = self;
    editorController.videoQuality = UIImagePickerControllerQualityTypeHigh;

    self.popoverController = [[UIPopoverController alloc] initWithContentViewController:editorController];
    self.popoverController.delegate = self;
    [self.popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}

我收到错误消息

The requested URL was not found on this server

2 个答案:

答案 0 :(得分:2)

从路径字符串中删除file://

答案 1 :(得分:1)

尝试使用 - (NSString *)路径。绝对URL不起作用。

[[[self.movieArray objectAtIndex:[sender tag]] objectForKey:@"MovieURL"] path]