-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Feature/android media session #1780
Feature/android media session #1780
Conversation
… example pause/play in PIP window or headset buttons.
…w, or for example pause/play playback with headset HW buttons.
… example pause/play in PIP window or headset buttons.
…w, or for example pause/play playback with headset HW buttons.
…nto feature/android-media-session
android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
Outdated
Show resolved
Hide resolved
android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java
Outdated
Show resolved
Hide resolved
Hi, what is the state with this pull request? 😊 Would be very grateful if it got merged. We are using picture in picture on Android through another library, but since current version of react-native-video doesn't have media session, there are no playback buttons :( |
Just a heads up if this ever gets merged: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are having a similar problem, please open a new issue and reference this one instead of commenting on a stale or closed issue. |
Describe the changes
Added mediaSession for Android ExoPlayer to let device know about currently used player. With this in place you can use some native features like pause/play using HW buttons on any compatible headset connected to the device, displaying playback buttons in PIP window (previous, play/pause, next), etc..
Currently using the simplest solution with usage of external ExoPlayer mediaSession extension library, which takes care of all needed mediaSession callback, and the session it self. To support more advanced features, full implementation may be needed.
Since I'm not an Android expert, it's possible that some things, or additional metadata are missing. Please consider this as MVP which is currently implemented mainly to support PIP player controls. Feel free to suggest any change or pick deeper implementation if needed.
Also added
onExternalPauseToggled
event prop, which notifies client about new play/pause state, so JS can perform needed actions based on this information. For example change UI state.