Is there a way to play video at double speed using MPMoviePlayerController?
myMPMoviePlayerController.currentPlaybackRate = 2.f
doesn't change anything.
Is there a way to play video at double speed using MPMoviePlayerController?
myMPMoviePlayerController.currentPlaybackRate = 2.f
doesn't change anything.
Play the movie first, then set the playback rate.
You have to use the setCurrentPlaybackRate method, like this:
[myMPMoviePlayerController setCurrentPlaybackRate:2.f];
Even it's bit old question now but I would like to share if someone having same problem.
Here is the code sample I am using and its working with me
-(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];
}
}];
}
Hope this will help someone.