-
-
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
Add support for Android Media Session #3080
Conversation
This Pr looks good thank you. but unfortunately, I didn't plan to make evolution on 5.2 branch. |
@freeboub I avoided using the master branch as we haven't moved over to v6 while it's in alpha. If that gets a stable release within the next few months then I'm happy to adapt this over there with some other features too |
@@ -314,6 +316,26 @@ public void setControls(final ReactExoplayerView videoView, final boolean contro | |||
videoView.setControls(controls); | |||
} | |||
|
|||
@ReactProp(name = PROP_ENABLE_MEDIA_SESSION, defaultBoolean = false) | |||
public void setEnabledMediaSession(final ReactExoplayerView videoView, final boolean enableMediaSession) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but wanted to double check just in case. Is there a spelling error here?
public void setEnabledMediaSession(final ReactExoplayerView videoView, final boolean enableMediaSession) { | |
public void setEnableMediaSession(final ReactExoplayerView videoView, final boolean enableMediaSession) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there may be a spelling error?
This is now implemented via #3723 - if I missed something please let me know |
Media Session
This adds 2 props,
enableMediaSession
andmediaSessionMetadata
. With these the video can create an Android Media Session and provide it with metadata.Simply adding a media session like this allows the video to be controlled and respond to a number of external controls. Some examples include:
Testing
Because this opens the door to many controls there are number of ways it can be tested. I've been testing 2 different ways:
Trigger pause/play event through adb
You can mimic the event of pressing a pause/play button through adb.
adb shell input keyevent 126
Key 126 is PLAY, 127 is PAUSE, 85 is PLAY/PAUSE. See more event codes in the Android docs here
Google Assistant
You can run on a device that has Google Assistant, then test instructions such as "Play"/"Pause"/"What's Playing?"
Pretty sure you can also use Google Assistant in emulators