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#enterPictureInPictureModebefore Android S andPictureInPictureParams#isAutoEnterEnabledafter. -
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#onPictureInPictureModeChangedandActivity#onPictureInPictureUiStateChangedinto a single, unified callback interface viaPictureInPictureDelegate.OnPictureInPictureEventListenerfor 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
PictureInPictureDelegate.OnPictureInPictureEventListener |
Unified listener interface for |
Classes
BasicPictureInPicture |
Basic Picture-in-Picture implementation. |
PictureInPictureDelegate |
A delegate class to help set up PiP (Picture-in-Picture) functionalities on behalf of the given |
PictureInPictureDelegate.Event |
Represents the PiP event emitted from the system. |
VideoPlaybackPictureInPicture |
Picture-in-Picture implementation optimized for Video Playback applications. |