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): fix playback status with lifecycle #3819

Merged
merged 3 commits into from
May 28, 2024

Conversation

YangJonghun
Copy link
Collaborator

@YangJonghun YangJonghun commented May 22, 2024

Summary

fix(ios): fix playback status with lifecycle

Motivation

  • Modify it to ignore playInBackground because people can use AppleTV, airplay, etc.

Changes

  • check external playback active state with iOS lifecycle

  • check playback status via "_isPlaying" instead of "_paused"

    • "_paused" is not exactly synchronized with the player's current state. this change is important because the introduction of the "showNotificationControls" prop makes it possible for external controls to control the video.
  • resolve [Feature]: detect airplay(or mirroring) playback within iOS native side #3790

Memo

Since the "showNotificationControls" prop allows people to control the video with external controls, I think we need to clarify the behavior of props like playInBackground, playWhenInactive. Currently, we can only control the entry point of lifecycle, and it can be played at any time while not in the foreground.

@freeboub
Copy link
Collaborator

fully agree with your memo ...

@freeboub freeboub requested a review from KrzysztofMoch May 23, 2024 09:54
@freeboub
Copy link
Collaborator

@YangJonghun will it also fix #3770 ?

@YangJonghun
Copy link
Collaborator Author

@freeboub
I don't think so, that issue is about audio control. this PR simply changes state of the player.

@KrzysztofMoch KrzysztofMoch merged commit 1b51c15 into TheWidlarzGroup:master May 28, 2024
6 checks passed
@YangJonghun YangJonghun deleted the fix/ios-lifecycle branch May 30, 2024 12:27
@KrzysztofMoch
Copy link
Member

@YangJonghun After this change when we set playInBackground to true when app going background, playback is pausing even if there is no external playback active

@YangJonghun
Copy link
Collaborator Author

@KrzysztofMoch
I'll check it out. Thanks for letting me know:)

@YangJonghun
Copy link
Collaborator Author

@KrzysztofMoch
The modified code works as intended, and the issue is reproduced in commits before this PR was merged.
FYI) Commit before this PR was merged - https://github.com/TheWidlarzGroup/react-native-video#d072aeb451f515b84b821367bfa3c12cfbeeb725
Probably other code is the cause.

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.

[Feature]: detect airplay(or mirroring) playback within iOS native side
3 participants