google / google/ExoPlayer

How to: Override exo_styled_controls_play in a downstream Android library (not app)

Open
#10,008 3 comments 4 reactions 1 assignee Assigned to @icbaker View on GitHub
enhancement
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

In trying to move to ExoPlayer 2.17.0 I discover that PlayerView is now deprecated in favor of StyledPlayerView.

Okay, so I switched all usages of PlayerView to StyledPlayerView in my code and layouts. The app built and ran. But the play/pause buttons were broken.

So I dug in and replaced the separate play and pause buttons with the combined play/pause button. That button's logic is hardwired to use exo_styled_controls_play and exo_styled_controls_pause drawables for its play and pause icons.

Okay, so great. I'll just override them in the downstream library module where I use ExoPlayer. That doesn't work in testing when I build my test app. I don't want to have every app where I use this library to separately have to perform this override. I want the override done by the library.

On a larger note, ideally I don't want to override this for the entire app. Rather I'd like to tell StyledPlayerView the DrawableRes ids that I want it to use.

Help would be appreciated here -- as I'm about to just stick with PlayerView as it doesn't have these issues.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.