Allow overriding drawables locally (only for a specific PlayerView instance)
[REQUIRED] Use case description
My app has two players: video player and podcast player. Both should look different in terms of icons, buttons' positions, and spacing. Spacing and reordering buttons is easy, but it seems that the only option to replace icons is to do it globally1, for all PlayerViews.
Proposed solution
It would be great to have attributes similar to show_timeout2 for icons/resources used in the PlayerControlView.
e.g.:
- play_resource_id
- pause_resource_id
- etc.
with the fallback to exo_styled_controls_play, exo_styled_controls_pause, .. if not present.
Alternatives considered
No alternatives were considered.
Ref.:
- [1] https://exoplayer.dev/ui-components.html#overriding-drawables
- [2] https://github.com/androidx/media/blob/release/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java#L102-L166
Please correct me if I'm wrong. Do I understand that you want:
playResourceId =
a.getResourceId(R.styleable.PlayerView_play_resource_id,
/* defValue= */ R.drawable.exo_styled_controls_play);
and then you can define various xml views
app:play_resource_id="R.drawable.personal_controls_play"
or
app:play_resource_id="R.drawable.personal_controls_play_new"
and
<drawable name="personal_controls_play">@drawable/personal_play_circle_filled</drawable>
<drawable name="personal_controls_play_new">@drawable/personal_play_square</drawable>
Yes, exactly
Do you have any updates on this ticket?
Hi @ziem, apologies, I have been away for a month. I discussed this internally within the team and I don't see any issue with the proposed solution above. I will prioritise it next week and hopefully you can test it out in 1.4.0 alpha/beta
Awesome, thank you 🙂