-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PiP inconsistencies on Android #424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice simplifications/improvements! Just some NIT from my side.
CHANGELOG.md
Outdated
|
||
### Fixed | ||
|
||
- Android: Entering Picture-in-Picture automatically from all screens when navigating the app to the background (after navigating to Basic Picture-in-Picture screen once) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entry is very specific for our samples, is this something that only happens in our samples? If so we should make this clear. Otherwise, can we make it a bit more generic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kind of both, I would suppose that it should happen to other single activity apps. I'll write it in a more generic way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Explicitly call `exitPictureInPicture()` on PlayerView when exiting PiP state, otherwise | ||
// the `PictureInPictureExit` event won't get dispatched. | ||
playerView?.exitPictureInPicture() | ||
private fun isInPictureInPictureMode(): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has a very similar name to the property isPictureInPictureMode
which makes it quite confusing. Should we rename to e.g. isCurrentActivityInPictureInPictureMode
or convert it to an extension function on the activity
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Lukas Knoch-Girstmair <strangesource@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS still works :)
I can't judge the Android part.
Could you also update the guide here?
https://developer.bitmovin.com/playback/docs/enabling-picture-in-picture-mode
For the record: I also tested Android and it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving but please still update the guide!
Added a section in the guide here: https://developer.bitmovin.com/playback/docs/enabling-picture-in-picture-mode#adjust-the-ui-for-picture-in-picture-mode-on-android |
Description
The PiP implementation on Android was very complex and made some wrong assumptions, which caused a few bugs. Most notably:
Note that we do have
PictureInPictureConfig.shouldEnterOnBackground
, but it works on iOS only and implementing it carries some lifecycle handling complexity (this bug), so implementing this should be considered as a feature request.Reference: https://github.com/bitmovin/bitmovin-player-react-native/pull/424/files#diff-884e35b040de326e767bfbc98ce73c052358fe2319d57d4716e044dbe68b6aa1L176
RNPictureInPictureHandler
did toolbar hiding from the native side which is a wrong layer to do that. This caused the app to be without a toolbar after: Going into PiP mode -> Dismissing PiP window (stopping the app) -> Opening the app again.Reference: https://github.com/bitmovin/bitmovin-player-react-native/pull/424/files#diff-884e35b040de326e767bfbc98ce73c052358fe2319d57d4716e044dbe68b6aa1L115
Changes
RNPictureInPictureHandler
, aligning it with the Flutter implementation: Introduce Picture in Picture bitmovin-player-flutter#87Checklist
CHANGELOG
entry