如何在iOS中隐藏视频停止和播放按钮?

时间:2015-08-28 11:46:47

标签: ios video playback

enter image description here

在我的应用程序中,我想继续在后台播放视频。所以我不想在视频中播放和停止视频和透明线。

我尝试了以下代码:

        self.videoController = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:@"/Volumes/Data/Monika/Projects/Salon/Salon/Salon/Images/video/salon.mp4"]];
        [self.videoController setControlStyle:MPMovieControlStyleDefault];
        self.videoController.view.frame=CGRectMake(0,0, 320, 202);
        [self.videoplayview addSubview:self.videoController.view];
        [self.videoController play];

1 个答案:

答案 0 :(得分:4)

只需将控件样式设置为MPMovieControlStyleNone,如下所示:

    [self.videoController setControlStyle:MPMovieControlStyleNone];

以下是控件样式的Apple文档:https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/#//apple_ref/c/tdef/MPMovieControlStyle