如何录制视频并使用当前播放速度减慢?

时间:2013-07-03 10:51:39

标签: iphone ios objective-c mpmovieplayercontroller avfoundation

我可以从临时网址获取视频并将视频保存在照片库中。

如何使用渐变慢动作制作视频?我知道这可以通过currentplayrate来完成。我不确定如何应用它。

如何在将速度保存到照片库之前调整速度?

注意:我使用MPMoviePlayerViewController播放/修剪并保存视频。

参考代码:

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

         theMovie.moviePlayer.currentPlaybackRate = 4.0f;

        [self presentMoviePlayerViewControllerAnimated:theMovie];
        // 4 - Register for the playback finished notification
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:)
            name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
    }
}

0 个答案:

没有答案