iosswiftobjective-cios14picture-in-picture

How to hide system controls on AVPictureInPictureController's float window?


I want to hide these system controls on the iOS14 pip:

enter image description here

Any way I can do it?


Solution

  • You can do it with KVC:

    1. Hide forward button and back button:

    Swift:

    pipController.setValue(1, forKey: "requiresLinearPlayback")
    

    Objective-C:

    [self.pipController setValue:[NSNumber numberWithInt:1] forKey:@"requiresLinearPlayback"]
    

    2. Hide progress bar, play button, forward button and back button:

    Swift:

    pipController.setValue(1, forKey: "controlsStyle")
    

    Objective-C:

    [self.pipController setValue:[NSNumber numberWithInt:1] forKey:@"controlsStyle"];
    

    3. Hide all the controls on the pip:

    Note: iOS16+ only

    Swift:

    pipController.setValue(2, forKey: "controlsStyle")
    

    Objective-C:

    [self.pipController setValue:[NSNumber numberWithInt:2] forKey:@"controlsStyle"];