禁用MPMoviePlayerController中的控件

时间:2013-12-14 17:43:52

标签: ios mpmovieplayercontroller

如何禁用MPMoviecontoller中的所有控件,以便用户甚至无法识别正在播放的视频。即使我不想在用户点按视频时显示控件。任何帮助表示赞赏。 这是我的代码:

self.myMovieController = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[self.myMovieController view] setFrame:self.view.bounds];
[self.myMovieController view].backgroundColor = [UIColor clearColor];
self.myMovieController.scalingMode = MPMovieScalingModeAspectFill;
self.myMovieController.controlStyle = MPMovieControlModeHidden;
self.myMovieController.repeatMode = MPMovieRepeatModeOne;
self.myMovieController.shouldAutoplay = YES;
[self.view addSubview: [self.myMovieController view]];
[self.myMovieController play];

控件最初可见几秒钟,而当点击视图控件时,控件再次可见。

1 个答案:

答案 0 :(得分:5)

MPMoviePlayerController具有以下控件样式

   MPMovieControlStyleNone,
   MPMovieControlStyleEmbedded,
   MPMovieControlStyleFullscreen,
   MPMovieControlStyleDefault = MPMovieControlStyleFullscreen

您可以将controlStyle的设置MPMoviePlayerController属性设置为MPMovieControlStyleNone

尝试以这种方式设置控件样式:

self.myMovieController.controlStyle = MPMovieControlStyleNone;