HI朋友们, 我希望在我的应用程序中重复播放视频文件,并使用以下代码播放视频文件
NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];
player.view.frame = CGRectMake(0, 0, 867, 1008);
player.scalingMode = MPMovieScalingModeFill;
[self.view addSubview:player.view];
[player play];
我是否可以使用可以为视频文件提供警报的Delegate方法结束播放 谢谢你提前
答案 0 :(得分:3)
您可以使用属性“repeatMode”并将其设置为MPMovieRepeatModeOne
//Determines how the movie player repeats the playback of the movie.
@property(nonatomic) MPMovieRepeatMode repeatMode
//Discussion The default value of this property is MPMovieRepeatModeNone.
// For a list of available repeat modes, see “MPMovieRepeatMode.”
// Availability Available in iOS 3.2 and later.Declared In MPMoviePlayerController.h
NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];
player.view.frame = CGRectMake(0, 0, 867, 1008);
player.scalingMode = MPMovieScalingModeFill;
player.repeatMode = MPMovieRepeatModeOne;
[self.view addSubview:player.view];
[player play];