Skip to content

Commit

Permalink
update pip.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kot331107 authored and tvanlaerhoven committed Sep 11, 2024
1 parent a30270d commit d9c8e9d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/pip.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ override fun onPictureInPictureModeChanged(
}
```

### Enabling early transitioning to PiP event

You might want to enable [transitioning to PiP](<https://developer.android.com/reference/android/app/PictureInPictureUiState#isTransitioningToPip()>) event for Android 15+ (API 35+). To enable it make sure that
the compile SDK version is set to 35 in your build.gradle `compileSdkVersion = 35`. Also the appropriate intent should be sent from the `MainActivity` to let react-native know when the app starts the PiP animation:

```kotlin
override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) {
super.onPictureInPictureUiStateChanged(pipState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM &&
pipState.isTransitioningToPip
) {
Intent("onPictureInPictureModeChanged").also {
it.putExtra("isTransitioningToPip", true)
sendBroadcast(it)
}
}
}
```

### PiP controls

The PiP window will show the default controls to configure, maximize and close the PiP window.
Expand Down

0 comments on commit d9c8e9d

Please sign in to comment.