MPMoviePlayerController video speed change

Is there a way to play video at double speed using MPMoviePlayerController?

myMPMoviePlayerController.currentPlaybackRate = 2.f

nothing changes.

+5
source share
3 answers

Play the movie first, then set the playback speed.

+12
source

You need to use the setCurrentPlaybackRate method, for example:

[myMPMoviePlayerController setCurrentPlaybackRate:2.f];
+4
source

, , - .

, ,

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];

    [self dismissViewControllerAnimated:YES completion:^{

    if (CFStringCompare ((__bridge_retained CFStringRef)mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo) {

        MPMoviePlayerViewController *theMovie = [[MPMoviePlayerViewController alloc]
                                                 initWithContentURL:[info objectForKey:UIImagePickerControllerMediaURL]];
        [theMovie.moviePlayer play];
        theMovie.moviePlayer.currentPlaybackRate = 2.00f;//here we can set speed
        theMovie.moviePlayer.fullscreen = YES;

        [self presentMoviePlayerViewControllerAnimated:theMovie];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
    }
    }];
}

, -.

0

All Articles