参考链接:
http://www.raywenderlich.com/13418/how-to-play-record-edit-videos-in-ios
我选择视频帧并使用以下代理(didFinishPickingMediaWithInfo)方法存储视频,
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
// 1 - Get media type
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
// 2 - Dismiss image picker
[self dismissModalViewControllerAnimated:NO];
// Handle a movie capture
if (CFStringCompare ((__bridge_retained CFStringRef)mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo) {
// 3 - Play the video
MPMoviePlayerViewController *theMovie = [[MPMoviePlayerViewController alloc]
initWithContentURL:[info objectForKey:UIImagePickerControllerMediaURL]];
[self presentMoviePlayerViewControllerAnimated:theMovie];
// 4 - Register for the playback finished notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
UISaveVideoAtPathToSavedPhotosAlbum (moviePath,self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
}
}
}
我想知道视频是如何修剪并存储在移动本地的。在以下路径中文件正在存储。我在NSDictionary媒体网址中获取这些值。
Path ::: {
UIImagePickerControllerMediaType = "public.movie";
UIImagePickerControllerMediaURL = "file://localhost/private/var/mobile/Applications/3175A4BD-F24F-4745-B7AE-FBA4B9EBE90D/tmp//trim.zuyfI0.MOV";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.MOV?id=740204CB-EE25-4A83-992A-F46115FC5B9F&ext=MOV";
}
在存储视频之前,我想更改currentPlaybackRate吗?任何人都可以提供一些实施的想法吗?
答案 0 :(得分:1)
如果您只想在播放期间更改时间刻度,则可以theMovie.currentPlaybackRate = /* your value */;
。如果您想以不同的时间尺度实际保存视频,那么您将不得不深入研究AV Foundation。