O'Reilly logo

Programming iOS 4 by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

UIVideoEditorController

UIVideoEditorController is a view controller that presents an interface for trimming video. Its view and internal behavior are outside your control. You are expected to present the view controller’s view, probably modally (or, on the iPad, in a popover, though in fact I haven’t been able to get this view controller to work properly on the iPad no matter how I present it), and respond by way of its delegate.

Before summoning a UIVideoEditorController, be sure to call its class method canEditVideoAtPath:. Not every video format is editable, and not every device supports video editing. If this call returns NO, you can’t use an instance of this class. (This call can take some noticeable time to return.) You must also set the UIVideoEditorController instance’s delegate and videoPath before presenting it modally:

NSString* path = [[NSBundle mainBundle] pathForResource:@"movie" ofType:@"mov"];
BOOL can = [UIVideoEditorController canEditVideoAtPath:path];
if (!can) {
    NSLog(@"can't edit this video");
    return;
}
UIVideoEditorController* vc = [[UIVideoEditorController alloc] init];
vc.delegate = self;
vc.videoPath = path;
[self presentModalViewController:vc animated:YES];
[vc release];

The view’s interface contains Cancel and Save buttons, a trimming box displaying thumbnails from the movie, a Play/Pause button, and the movie itself. The user slides the ends of the trimming box to set the beginning and end of the saved movie. The Cancel and Save buttons do not dismiss the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required