PlayerNotificationManager: customizeable icons
See original GitHub issueUse case description
I’d like to customize the icons currently statically fixed in PlayerNotificationManager
, more specifically I’d customize ACTION_REWIND
and ACTION_FAST_FORWARD
but I believe that all icons should be customizable.
I’d be happy to contribute and create a PR with a proposed solution from below or any other proposed solution. I also wanted to write some documentation for [PlayerNotificationManager] for https://exoplayer.dev/ since I struggled reading through issues and code but couldn’t find where that was possible.
Proposed solution
- Accept a POJO or
Map<String, NotificationCompat.Action>
in the constructor to specifyresId
Alternative solutions
- Allow
CustomActionReceiver
to override the default actions. related code. - Elaborate
CustomActionReceiver
to include the default actions, this way the user can take over control over the actions completely if necessary while maintaining the same defaults.
Alternatives considered
- I looked at the source code and there is currently no way to work around this because the actions are
private final
fields and thecreatePlaybackActions
function is static. Additionally, I think this should stay in the constructor.
Thanks for this great lib!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
PlayerNotificationManager (ExoPlayer library)
The actions included in the notification can be customized along with their ... Instead, the large icon is obtained from the PlayerNotificationManager.
Read more >Change action icon of playerNotificationManager like play ...
You can override the icons used by PlayerNotificationManager by redefining the resources in your app's resources.
Read more >PlayerNotificationManager | Android Developers
The actions included in the notification can be customized along ... Unlike the drawables above, the large icon (i.e. the icon passed to ......
Read more >com.google.android.exoplayer2.ui.PlayerNotificationManager ...
Defines and handles custom actions. Most used methods. createCustomActions. Gets the actions handled by this receiver.If multiple PlayerNotificationManager ...
Read more >PlayerNotificationManager (library-ui API) - javadoc.io
Defines and handles custom actions. static interface, PlayerNotificationManager.MediaDescriptionAdapter. An adapter to provide content assets of the media ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s definitely dismiss-able when paused for me. If you’re setting it as the notification for a foreground service then that might change things because displaying a notification is a requirement for a foreground service (you’d probably need to have the service exit the foreground for it to become dismiss-able again).
We fixed some notification flicker issues in 2.10.0, but they only affected fairly old devices (KitKat), so that’s probably not what you’re seeing.
For documentation, I think any additions would go into https://exoplayer.dev/ui-components.html. Notification manager could be a section similar to the
PlayerView
andPlayerControlView
sections. The ability to override drawables is similar to the ability to override layout files (it’s just a different resource type), and applies toPlayerView
andPlayerControlView
as well. Documentation goes into thegh-pages
branch here. There’s aREADME.md
that points to the resources needed to get started.Thanks for the quick reply.
That’s great, I already shared my solution in the issue. It’s working very well for me at the moment, and it already works based on existing callbacks provided by
ExoPlayer
.