1

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

如何制作带有渐变慢动作的视频?我知道这可以通过 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];
    }
}
4

0 回答 0