Search code examples
iphoneiosuiviewmpmovieplayercontroller

I want to play video in iPhone, at 2x speed


I used MPMoviePlayerController, to play video. But there are no method/property to play video in 2x speed.

Is there any other way to play video at 2x speed?

I used this method to play Video.

-(void)playMovie:(NSString *)fileName

{

NSLog(@" File name :: %@",fileName);

NSBundle *bundle = [NSBundle mainBundle];

NSString *moviePath = [bundle pathForResource:fileName ofType:@"mp4"];

NSLog(@"\n\n  moviePath :: %@",moviePath);

NSURL *url = [[NSURL fileURLWithPath:moviePath] retain];

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

moviePlayer.controlStyle = MPMovieControlStyleDefault;

moviePlayer.shouldAutoplay = YES;

moviePlayer.view.frame = [[UIScreen mainScreen] applicationFrame];

[moviePlayer.view setFrame:playVideoView.bounds];

[playVideoView addSubview:moviePlayer.view];

[moviePlayer setFullscreen:YES animated:YES];

}

Solution

  • MPMoviePlayerController conforms to the MPMediaPlayback protocol, which has the following property:

    @property(nonatomic) float currentPlaybackRate