如何像在 Vine 应用程序中一样将录制的视频显示为重复 n 次。
在这里,我使用 MPMoviePlayerViewController,可以很好地显示录制的视频。但问题是,它不会重复。
这里当前使用的代码是,
NSURL *url = [NSURL fileURLWithPath:videoPath];
playerController = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:playerController];
[playerController.moviePlayer prepareToPlay];
playerController.view.frame = CGRectMake(200, 402, 300, 200);
playerController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
playerController.moviePlayer.controlStyle = MPMovieControlStyleNone;
playerController.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
playerController.moviePlayer.repeatMode = MPMovieRepeatModeOne;
[self.view addSubview: playerController.view];
[playerController.moviePlayer play];
NSLog(@"repeatMode: %d",playerController.moviePlayer.repeatMode);
[playerController.view addSubview:customview];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerController moviePlayer]];
和 NSNotification 代码,
- (void) movieFinishedCallback:(NSNotification*) aNotification
{
NSLog( @"myMovieFinishedCallback: %@", aNotification );
MPMoviePlayerController *movieController = aNotification.object;
NSLog( @"player.playbackState = %d", movieController.playbackState );
}
任何人都可以请给出解决方案..
注意:我使用的是 XCode 4.5.2 工具和 ios 模拟器 6.0