<img src="https://img.shields.io/badge/%20-ENTERPRISE-%23B10031" style="float:left"/><br /> <img src="https://img.shields.io/badge/Android-V4-009727?logo=android" style="float:left"/><br />
With Picture in Picture mode, users can watch video while using other apps. For example, one of your users can continue watching one of your videos while writing an email. <br />


Captions are displayed for only tablets, but disabled for Mobile view.
<br /> <hr />
## Requirement
Android: Oreo 8.0+ (API level 26+)
<br /> <hr />
## Implementation
The following steps will enable the Picture in Picture icon on the player and auto-enable Picture in Picture to work on the _UserHint_ Button click. When a viewer clicks on the Picture in Picture icon or hits the home button, the Picture in Picture mode will be enabled.
<br />
Add the Picture in Picture support in the manifest file for the activity that hosts the JW Player.
Please note that to manually control multi-window configuration changes, such as resizing, you must add the <a href="https://developer.android.com/guide/topics/large-screens/multi-window-support#supportsPictureInPicture" target="_blank">android:configChanges</a> attribute to the activity tag.
Register the activity with the JWPlayer instance for Picture in Picture. The following example shows registering Picture in Picture at `
onCreate()
`.
Notify the player instance about the Picture in Picture feature.
Now that you have successfully implemented the Picture in Picture functionality, you can use the following sections to customize the implementation and listen for events.
<br /> <hr />
## Customizations
METHOD | DESCRIPTION |
`JWPlayer.deregisterActivityForPip() ` | Manually disable the Picture in Picture feature
The SDK automatically deregisters activity for Picture in Picture on activity `onDestroy() `. |
`JWPlayer.enterPictureInPictureMode() ` | Manually enter Picture in Picture mode by associating the feature to a customized external button |
`JWPlayer.exitPictureInPictureMode() ` | Manually exit Picture in Picture mode by associating the feature to a customized external button |
`JWPlayer.setPipOnBackground(boolean value) ` | Enable or disable entering Picture in Picture mode when the Home button has been clicked
Default: `JWPlayer.setPipOnBackground(true) ` |
`JWPlayer.setPipAspectRatio(Rational pipAspectRatio) ` | Set the Picture in Picture aspect ratio Read <a href="https://developer.android.com/reference/android/app/PictureInPictureParams.Builder#setAspectRatio(android.util.Rational)" target="_blank">setAspectRatio</a> to learn more about this natively supported Android OS customization. |
`mPlayer.setPipSourceRectHint(Rect pipSourceRectHint) ` | Set the source bounds hint Read <a href="https://developer.android.com/reference/android/app/PictureInPictureParams.Builder#setSourceRectHint(android.graphics.Rect)" target="_blank">setSourceRectHint </a> to learn more about this natively supported Android OS customization. |
<br /> <hr />
## Event Listening
Whenever a user enters or exits Picture in Picture mode, an event is fired from the SDK. The following code sample demonstrates how to listen for these events.
<br />