# androidx.core.pip

*** ** * ** ***

The PiP Jetpack library addresses several challenges in Android's Picture-in-Picture (PiP) mode:

- OS Fragmentation: The library handles differences in PiP API calls across Android versions, such as [`Activity#enterPictureInPictureMode`](https://developer.android.com/reference/android/app/Activity#enterPictureInPictureMode(android.app.PictureInPictureParams)) before Android S and [`PictureInPictureParams#isAutoEnterEnabled`](https://developer.android.com/reference/android/app/PictureInPictureParams) after.

- Incorrect PiP Parameters: It provides a unified solution for setting correct `PictureInPictureParams`, especially for playback, to ensure smooth animations (e.g., source rect hint).

- Unified PiP State Callbacks: The library consolidates [`Activity#onPictureInPictureModeChanged`](https://developer.android.com/reference/android/app/Activity.html#onPictureInPictureModeChanged(kotlin.Boolean)) and [`Activity#onPictureInPictureUiStateChanged`](https://developer.android.com/reference/android/app/Activity#onPictureInPictureUiStateChanged(android.app.PictureInPictureUiState)) into a single, unified callback interface via `PictureInPictureDelegate.OnPictureInPictureEventListener` for simplified state management.

Furthermore, all new PiP features will be delivered through the Jetpack library, ensuring that library adopters can access these features with minimal to no effort.

For developer guidance, check out the following guide:

https://developer.android.com/develop/ui/views/pip-jetpack

## Interfaces

|---|---|
| `https://developer.android.com/reference/androidx/core/pip/PictureInPictureDelegate.OnPictureInPictureEventListener` | Unified listener interface for `https://developer.android.com/reference/android/app/Activity.html#onPictureInPictureModeChanged(boolean)` and `https://developer.android.com/reference/android/app/Activity.html#onPictureInPictureUiStateChanged(android.app.PictureInPictureUiState)` callbacks. |

## Classes

|---|---|
| `https://developer.android.com/reference/androidx/core/pip/BasicPictureInPicture` | Basic Picture-in-Picture implementation. |
| `https://developer.android.com/reference/androidx/core/pip/PictureInPictureDelegate` | A delegate class to help set up PiP (Picture-in-Picture) functionalities on behalf of the given `https://developer.android.com/reference/androidx/core/app/PictureInPictureProvider` instance. |
| `https://developer.android.com/reference/androidx/core/pip/PictureInPictureDelegate.Event` | Represents the PiP event emitted from the system. |
| `https://developer.android.com/reference/androidx/core/pip/VideoPlaybackPictureInPicture` | Picture-in-Picture implementation optimized for Video Playback applications. |