开发者

Trimming ALAsset video using UIVideoEditorController

I am having an ALAsset object of type video. I would like to trim this video using UIVideoEditorController. Following is the code snippet:

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

When the UI of UIVideoEditorController is pushed I get an error 'This movie could not be played'. What is the problem here?


Are you testing the video on iPhone 3Gs or iPhone 4? Make sure video is compatible to play on 3Gs. I'm sure this is the problem only.

Below is code snippet ....

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


videoEditorController.videoMaximumDuration = 0.0; ? Did you mean - videoEditorController.videoMaximumDuration = 1000.0;?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜