TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.14k stars 2.88k forks source link

Prevent video player from entering "pop out" mode when switching apps #4048

Open seanmaisch opened 1 month ago

seanmaisch commented 1 month ago

When a user navigates away from our app, whether it be by switching apps manually or externally linking to the web, the video player enters "pop out" mode, which can be construed by some as pictureInPicture.

Simply setting pictureInPicture={false} does not rectify this issue. We would really like to prevent iOS from popping the player out when leaving the application. One solution I considered, but would like to avoid due to performance issues and poor user experience, would be to completely unload the player when the app loses focus or is inactive, but that seems like a nuclear option.

Is there any way to prevent this behavior, or any plan on adding support for a feature like this?

Referenced as well by @jcksncllwy in https://github.com/TheWidlarzGroup/react-native-video/issues/2373#issuecomment-1537235603

KrzysztofMoch commented 1 month ago

So player is going into Picture in Picture even if pictureInPicture is set to false? - this is unexpected

seanmaisch commented 1 month ago

Correct. In the example mentioned by @jcksncllwy in https://github.com/TheWidlarzGroup/react-native-video/issues/2373#issuecomment-1537235603, they are attempting to use the video player as a background element and when switching the application, it opens the video player in PIP.

My use-case where the issue is presenting itself is as follows:

We have a "preview" video for users who are not paid users. They are only allowed to watch for a certain amount of time, but if they switch away from the application (via ExternalLink) to convert to a paid user, the video follows them outside of the application and they are able to continue to watch in the "pop out" / "picture-in-picture" mode indefinitely, which is problematic for us.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 30 days with no activity. If there won't be any activity in the next 14 days, this issue will be closed automatically.