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

How to hide video stop and play button in iOS?

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

我尝试了以下代码:

        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];

只需像这样将控件样式设置为 MPMovieControlStyleNone:

    [self.videoController setControlStyle:MPMovieControlStyleNone];

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