onPictureInPictureModeChanged

abstract fun onPictureInPictureModeChanged(isPictureInPictureMode: Boolean)

This is something you have to call in the Activity that should host the NewPlayerUI. See the example app's main activity to find out how to use this.

Long story short your activity should handle the onPictureInPictureModeChanged event. You can do this by adding this code to your Activity's onCreate() function:

addOnPictureInPictureModeChangedListener { mode ->
    newPlayerViewModel.onPictureInPictureModeChanged(mode.isInPictureInPictureMode)
}