2

ビデオ タイプの ALAsset オブジェクトがあります。UIVideoEditorController を使用してこのビデオをトリミングしたいと思います。以下はコード スニペットです。

UIVideoEditorController *videoEditorController = [[UIVideoEditorController alloc] init];
videoEditorController.delegate = self;
videoEditorController.videoMaximumDuration = 0.0;
videoEditorController.videoQuality = UIImagePickerControllerQualityTypeHigh;
videoEditorController.videoPath = @"assets-library://asset/asset.MOV?id=1000000005&ext=MOV";
[inViewController presentModalViewController:videoEditorController animated:YES];
self.videoEditController = videoEditorController;
[videoEditorController release];

UIVideoEditorController の UI を押すと、「このムービーを再生できませんでした」というエラーが表示されます。ここで何が問題なのですか?

4

2 に答える 2

0

iPhone3GまたはiPhone4でビデオをテストしていますか?ビデオが3Gで再生できるように互換性があることを確認してください。これは問題だけだと確信しています。

以下はコードスニペットです...。

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

NSString *filePathString = [[NSBundle mainBundle] pathForResource:@"Don2" ofType:@"m4v"];
NSURL *filePathURL = [NSURL fileURLWithPath:filePathString isDirectory:NO];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:filePathURL]) {
    [library writeVideoAtPathToSavedPhotosAlbum:filePathURL completionBlock:^(NSURL *assetURL, NSError *error){
        if (error) {
            // TODO: error handling
            NSLog(@"Error");
        } else {
            // TODO: success handling
        }
    }];
}
[library release];
于 2011-09-22T08:21:21.787 に答える