-
Notifications
You must be signed in to change notification settings - Fork 409
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
Support for custom actions #38
Comments
Thanks for the question! Yes, AndroidX Media3 will support custom actions. In general, AndroidX Media3 needs to support Notifications, Auto, Automotive OS, WearOS like all the features you can do with androidx.media. We will migrate UAMP to Media3 which includes all these features but we are not there yet. I will update this issue when we have created a first version of UAMP that will probably be released in a branch of the project on GitHub first. |
This landed with this commit in the main branch and will be part of the next release 8d03fdfe3464f073bd6b24ef3b5d2b42f6d49a39. Supporting custom actions for Android Auto, Wear OS and the System UI media notification involves three steps:
If handling a custom commands requires to change the actions, you need to update the custom layout and send it to the controllers with |
Thanks for the implementation and the detailed steps! I've created a simple custom action following the steps and have a question and some feedback. If I control my app with the I've noticed that For now I'm calling I would like to know if my call to About the implementation, I find the step of defining the sessionCommands inside In my opinion, the On the other hand, it would be helpful if we were able to access the I hope that my comment didn't come across as ungrateful or whiny, I'm very very happy to have this feature, it's just that CustomActions are going to be important in Android 13 and I think some small changes could help developers, especially after seeing how media3 made everything media related intuitive for me. Thanks again for adding the support for custom actions! |
Totally not! Thanks for the feedback please keep it coming! I have added the required steps to the demo app and this will be synced start of next week so you can see everything in detail (you got it right though already). What you describe is pretty much the plan for a future version. We need to have the public API ready for Beta, so that is how we go for now. We can make things easier later by keeping the same API by sending the custom layout with the initial state as you describe. The basic asymmetry this comes from is that Media3 controllers have a state on it's own while all legacy controller share the same state (stored in the platform session). It is possible to send different custom layouts to different Media3 controllers, while all legacy controllers share the same custom actions of the legacy session. The current solution is sending the custom layout to Media3 controllers in a fire-and-forget way, because the custom layout is not yet part of the state of a Media3 controller. There are plans to do this in a future version. If we integrate the custom layout into the Media3 controller state, the step in Some details: You need to call
This send the custom layout to all connected Media3 controllers at that moment (probably none right after session creation) and it sends it to the legacy session. Later you need to send the custom layout to all connecting Media3 controllers. The legacy controllers get their custom actions from the legacy session, so in
Strictly speaking you should only send to a specific controller in
|
In
androidx.media
we could add custom actions (action + name + icon) to thePlaybackStateCompat
, and the actions added were displayed in UIs like Android Auto.I've seen references to custom
SessionCommands
, butPlayerWrapper.createPlaybackStateCompat
doesn't use them to create thePlaybackStateCompat
, so I assume they serve a different purpose.Are custom actions supported in media3?
The text was updated successfully, but these errors were encountered: