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

chore(android): video player play/pause during incoming calling #3924

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

seyedmostafahasani
Copy link
Collaborator

Summary

Handle video player play/pause during incoming calling

Motivation

close this issue

Changes

Add a new listener to handle different situations.

Test plan

You can play the video during an incoming call the video will pause automatically, and after the call ends, the video will resume.

@YangJonghun
Copy link
Collaborator

External interruptions, including incoming calls, are typically controlled by listening for audio focus events.
fyi) https://developer.android.com/media/optimize/audio-focus

@seyedmostafahasani
Copy link
Collaborator Author

@YangJonghun thanks for sharing your knowledge with me.
Which way do you prefer to use it?

@freeboub
Copy link
Collaborator

I agree with @YangJonghun it wouldbe better to handle the change only with audio focus management if possible.
@seyedmostafahasani I am also wondering if the listener you added need some specific permissions, for my general knowledge ?

@seyedmostafahasani
Copy link
Collaborator Author

Sure, I agree with you. Let me change the code.
@freeboub, we need specific permissions for protected information. In this case, we don't need any permissions. For example, if we want to listen the phone state, we must add the READ_PHONE_STATE permission.

@YangJonghun
Copy link
Collaborator

@seyedmostafahasani
Already onAudioFocusChanged prop exposed. If we need pausing, we can implement within onAudioFocusChanged.
Some requirements may simply want the sound to go away during a call, while others may want a pause.
However, this implementation enforces the pause behavior internally.

@seyedmostafahasani
Copy link
Collaborator Author

@YangJonghun, The user can handle it with this prop, but as you said earlier, I want to implement it internally specifically for incoming calls. We have quite a few users who are trying to learn RN recently, so they can’t work with these props well.

@freeboub
Copy link
Collaborator

I have a major issue with the requested permission here!
We need at least to put in the default manifest
But putting this permission by default in the manifest will request new requierment to push the app on the store, see: https://stackoverflow.com/questions/41234205/warnings-your-apk-is-using-permissions-that-require-a-privacy-policy-android-p

To be able to merge this PR, we need:

  • document the new permission requierment and indicates this is optional
  • ensure that an without the permission the app still work correctly

according to @YangJonghun I think this phone call handling shall be done only with the onAudioFocusChanged callback...

And regarding to the expected behavior (pause / mute / stop playback) a new prop should be added to indicate the expected behavior.
for exemple:
audioFocusBehavior={'pause'}
Notice that pause may not a possible behavior for live content.

In a second step this audioFocusBehavior shall be integrated with ios to have a unified api !

@seyedmostafahasani seyedmostafahasani marked this pull request as draft July 18, 2024 15:47
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.

3 participants