我正在开发一个需要反转视频播放的 iPhone 应用程序。我目前正在使用 XCode 4.2。我正在尝试使用 MPMoviePlayerController 反向播放电影。但是当它反向播放时,它并不像向前播放那么流畅。它变得有点波涛汹涌,一点也不光滑。以下是我的代码。
- (void)viewDidLoad{
//code for initializing the movie player
MPMoviePlayerController videoPlayer =
[[MPMoviePlayerController alloc] initWithContentURL:"URL"];
self.videoPlayer = videoPlayer;
[videoPlayer release];
self.videoPlayer.view.userInteractionEnabled = NO;
self.videoPlayer.initialPlaybackTime = -1;
self.videoPlayer.shouldAutoplay=NO;
[self.videoPlayer prepareToPlay];
//code for initializing the button
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Reverse" forState:UIControlStateNormal];
[button addTarget:self
action:@selector(reverseMovie) forControlEvents:UIControlEventTouchDown];
button.frame = CGRectMake(0, 0, 50, 40);
[self.view addSubview:button];
}
-(void)reverseMovie{
[self.videoPlayer setCurrentPlaybackRate:-1.0];
}
可能的解决方案是什么?