Open simranthakkar1996 opened 1 week ago
It might have been a part of solving this issue https://github.com/androidx/media/issues/1200 with commits https://github.com/androidx/media/commit/f3444aee5f8b983429f5386a33377e3ccb55a715 and https://github.com/androidx/media/commit/d35bc176fff7d3cb8826be0d86ef8e6c6d8e8a62
int rewindDrawableResId = R.drawable.exo_styled_controls_simple_rewind;
rewindDrawableResId = a.getResourceId(R.styleable.PlayerControlView_rewind_icon, rewindDrawableResId);
ImageView rewButton = findViewById(R.id.exo_rew);
TextView rewButtonWithAmount = findViewById(R.id.exo_rew_with_amount);
if (rewButton != null) {
// For a simple rewind button without seek-back increment value
rewButton.setImageDrawable(getDrawable(context, resources, rewindDrawableResId));
rewindButton = rewButton;
rewindButtonTextView = null;
} else if (rewButtonWithAmount != null) {
// For a circular rewind button with the amount in the middle
rewButtonWithAmount.setTypeface(typeface);
rewindButtonTextView = rewButtonWithAmount;
rewindButton = rewindButtonTextView;
}
Are you trying to override the icon by having a local drawable?
Thanks for your solution, @oceanjules . I was able to override the drawables successfully, but now the rewind and fast-forward functionality is not working after the override.
@oceanjules Hi thanks for your reply but when I try to use exo_styled_controls_simple_rewind as you mentioned its different icon and I wanna override it with the custom one that I created on my side.
This is what I updated to use my custom drawables to override the default ones But its crashing the app with inflating error
Xml files
<ImageButton
android:id="@id/exo_rew_with_amount"
style="@style/PlayerControlButtonBaseStyle.RewButton" />
<ImageButton
android:id="@id/exo_ffwd_with_amount"
style="@style/PlayerControlButtonBaseStyle.FfwdButton" />
Styles.xml
<style name="PlayerControlButtonBaseStyle.RewButton">
<item name="android:src">@drawable/exo_styled_controls_simple_rewind</item>
</style>
<style name="PlayerControlButtonBaseStyle.FfwdButton">
<item name="android:src">@drawable/exo_styled_controls_simple_fastforward</item>
</style>
exo_rew_with_amoun
@simranthakkar1996 The resource ids, which you have used is not correct, try replacing them with "exo_styled_controls_rewind", "exo_styled_controls_fastforward".
@akshaysuryaprakash As @oceanjules mentioned they changed the drawables so I changed it as asked
On side note I was able to override with my custom drawable I hade to use new drawable names exo_styled_controls_simple_rewind exo_styled_controls_simple_fastforward
And the xml ids remains same as before Below is the updated version that worked for me to replace my drawables with the default exoplayer ones
Xml File
<ImageButton
android:id="@id/exo_rew"
style="@style/PlayerControlButtonBaseStyle.RewButton" />
<ImageButton
android:id="@id/exo_ffwd"
style="@style/PlayerControlButtonBaseStyle.FfwdButton" />
Styles.xml
<style name="PlayerControlButtonBaseStyle.RewButton">
<item name="android:src">@drawable/exo_styled_controls_simple_rewind</item>
</style>
<style name="PlayerControlButtonBaseStyle.FfwdButton">
<item name="android:src">@drawable/exo_styled_controls_simple_fastforward</item>
</style>
Also just one request @oceanjules It would be much better if id change details are added to the release notes that way its easier to find the solution
Thank You.
I updated media3 from 1.3.1 to 1.4.1 recently and it changed my rewind and forward buttons to the original ones.
I am guessing some ids might be changed as I am using my custom buttons but the id is not matching with the exoplayer ids
I was not able to find anything releated to this in the release notes for 1.4.1 so if we have anything documented that I can refer so that the ids are correct on our side that would be really helpful.
Thank You.