opentok-react-native icon indicating copy to clipboard operation
opentok-react-native copied to clipboard

Picture-in-picture support for backgrounded Android app

Open sunweiyang opened this issue 5 years ago • 6 comments

Feature Request

Description Android picture-in-picture (PIP) multi-window mode lets the user continue to have an OpenTok video chat (most likely only the subscriber view is visible) pinned to a corner of the screen while navigating between different other apps.

Proposal The opentok-react-native package's Android implementation can support picture-in-picture as an option. App backgrounding and app switching is an extremely common user behavior for video calling apps, and users' expectations are typically to continue the video call throughout these switches (i.e. checking their calendar/email for a quick item to tell their video call partner, etc.)

Links / references https://developer.android.com/guide/topics/ui/picture-in-picture https://tokbox.com/blog/android-picture-in-picture/

sunweiyang avatar Sep 17 '18 22:09 sunweiyang

@sunweiyang We should be able to add this in. Can you propose an API and how you would expect it to work? For example, should it be the publisher or the subscriber that we see when it goes into background mode. What happens when there are multiple subscribers?

msach22 avatar Mar 05 '19 00:03 msach22

Here is a proposal: by default, the PIP would show the first subscriber (if it exists), and if no subscribers exist, then the first publisher (if it exists). Otherwise, developers can also manually choose which publisher or subscriber to show, via an optional prop.

If no stream exists, or if no publisher or subscriber exists, or if the optional prop is null, then PIP would not be enabled.

sunweiyang avatar Mar 13 '19 20:03 sunweiyang

@sunweiyang Since PIP is not the default, I think it should be an opt in API.

pip={true} // default would be false
by default, the PIP would show the first subscriber (if it exists), and if no subscribers exist, then the first publisher (if it exists). 

This may get a bit confusing because what if you publish and also immediately subscribe then we would see some sort of. How about specifying explicitly which view you want to see in background mode?

msach22 avatar Mar 19 '19 11:03 msach22

@msach22 Yes, opt-in PIP and explicitly specifying the view to show in PIP both sound good, and is simpler.

sunweiyang avatar Mar 19 '19 20:03 sunweiyang

@sunweiyang To continue on this, do you think it should be a session level setting (like using a prop for OTSession)? This way we can always make sure they know if it's the publisher or the subscriber?

msach22 avatar Mar 31 '19 18:03 msach22

@msach22 I think you're right; an OTSession prop for defining the PIP view would make things more explicit, and it's something we would expect as a developer experience.

sunweiyang avatar Apr 02 '19 00:04 sunweiyang