## Overview

Bitmovin introduced the ability to configure Picture-in-Picture mode within our Bitmovin Player as part of our V3 SDK. However, since enabling Picture-in-Picture requires listening to a AVKit level Delegate, the BitmovinPlayer is only able to support Picture-in-Picture within our own [HTML-based Player UI](🔗). Luckily though, there is a very simple way to utilize that same `AVPictureInPictureControllerDelegate` if you instead prefer to create and use your own custom Native UI for iOS.

To implement Picture-in-Picture within a Native UI, the overall process is pretty simple actually and consists of using iOS' AVKit protocol [AVPictureInPictureControllerDelegate](🔗) along with just a couple of it’s built-in methods to control Picture-in-Picture

## Player Configuration

When using your Native UI, the first thing you will want to do is to let the Bitmovin Player know that you do not want to use the Bitmovin UI within the [StyleConfig](🔗).

Optionally, if you also want PiP to work with Background Playback mode, you will need to enable BackgroundPlayback in the Bitmovin [PlaybackConfig](🔗):

## Native UI Class

When creating a Native Swift-based UI it is important that this class inherits from the following 2 classes/protocols

`PlayerView` - The core Bitmovin Player View class that holds the Player instance.

`AVPictureInPictureControllerDelegate` - Protocol that will allow your UI to handle Picture-in-Picture events.

In our newly created `CustomPipView` class we can now initialize the PlayerView and then initialize the `AvPictureInPictureController` to a stored variable like so:

Finally we can create two methods for entering and exiting Picture-in-Picture using the `AvPictureInPictureController`’s built-in methods `startPictureInPicture` and `stopPictureInPicture`.

There are also some additional available Picture-in-Picture event listeners and additional capabilities(i.e. state callers, image customizations, etc.) which can found in the `AvPictureInPictureController`’s docs here → [Apple Developer Documentation](🔗).

#### Full Example Class:

## Using The Native UI

Now that our Player is configured and our Native UI class is configured for Picture-in-Picture functionality we can create an instance of this Native UI to be used with the Bitmovin Player form our ViewController: