Skip to content
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(ios): call PictureInPicture callbacks with native controls #3603

Conversation

gkueny
Copy link
Contributor

@gkueny gkueny commented Mar 24, 2024

Summary

When we enter PiP from native controls, onPictureInPictureStatusChanged is never called.
When we exit PiP after enter from native controls, onPictureInPictureStatusChanged & onRestoreUserInterfaceForPictureInPictureStop are never called.

Should fix #3602

Motivation

Be notified when PictureInPicture status changed no matter how you enter this mode.
Has onRestoreUserInterfaceForPictureInPictureStop callback fire no matter how you exit PiP mode.

Changes

We add RCTPlayerObserver as playerViewController delegate to be notified with PiP lifecycle

Test plan

yarn add react-native-video@https://github.com/gkueny/react-native-video.git#72ba955c464dc15a3db935de6fe8542c2b3cc0d3
  • Validate that onPictureInPictureStatusChanged is called if you enter PiP mode from native controls
  • Validate that onPictureInPictureStatusChanged is called if you exit PiP mode after enter it from native controls
  • Validate that onRestoreUserInterfaceForPictureInPictureStop is called if you exit PiP mode after enter it from native controls

@gkueny gkueny force-pushed the fix/pip-callback-with-native-controls branch from 55609d2 to 8db03e3 Compare March 24, 2024 16:56
@gkueny

This comment was marked as resolved.

@gkueny gkueny force-pushed the fix/pip-callback-with-native-controls branch from 8db03e3 to e5ed613 Compare March 24, 2024 17:01
@gkueny
Copy link
Contributor Author

gkueny commented Mar 25, 2024

I will test this change in our project. I will adjust this PR if needed after that

@gkueny gkueny marked this pull request as draft March 25, 2024 10:45
…trols

We add RCTPlayerObserver as playerViewController delegate to be notified with PiP lifecycle
should partially fix TheWidlarzGroup#3602
@gkueny gkueny force-pushed the fix/pip-callback-with-native-controls branch from e5ed613 to 4a18f70 Compare March 25, 2024 12:58
@gkueny gkueny marked this pull request as ready for review March 25, 2024 14:15
@gkueny gkueny force-pushed the fix/pip-callback-with-native-controls branch from b224496 to 72ba955 Compare March 26, 2024 08:31
@gkueny gkueny changed the title fix(ios): call PictureInPictureStatusChanged callback with native controls fix(ios): call PictureInPicture callbacks with native controls Mar 26, 2024
@gkueny
Copy link
Contributor Author

gkueny commented Apr 3, 2024

@freeboub @KrzysztofMoch let me know if this bug fix seems ok for you.
On our side, this has been integrated into our app and corrects the issue raised with success.

Copy link
Collaborator

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM 🙌

@KrzysztofMoch KrzysztofMoch merged commit 051e884 into TheWidlarzGroup:master Apr 4, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][PiP]: PictureInPicture callback are not called when PiP mode is entered from native controls
2 participants