Search code examples
iosvideoplayback

How to hide video stop and play button in iOS?


enter image description here

In my application I want to play video in background continuously. So I don't want to play and stop video and transparent line in video.

I tried below code :

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

Solution

  • Just set the control style to MPMovieControlStyleNone like this:

        [self.videoController setControlStyle:MPMovieControlStyleNone];
    

    Here is the Apple documentation for control style: https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/#//apple_ref/c/tdef/MPMovieControlStyle