Reputation: 2134
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?
Upvotes: 2
Views: 2183
Reputation: 7644
videoEditorController.videoMaximumDuration = 0.0;
? Did you mean - videoEditorController.videoMaximumDuration = 1000.0;
?
Upvotes: 0
Reputation: 9
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];
Upvotes: 0