androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.59k stars 377 forks source link

Rewind and Forward buttons ids changed with media3 update from 1.3.1 to 1.4.1 #1747

Open simranthakkar1996 opened 1 week ago

simranthakkar1996 commented 1 week ago

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

Xml buttons
<ImageButton
            android:id="@id/exo_rew"
            style="@style/PlayerControlButtonBaseStyle.RewButton" />

<ImageButton
            android:id="@id/exo_ffwd"
            style="@style/PlayerControlButtonBaseStyle.FfwdButton" />

Style File
<style name="PlayerControlButtonBaseStyle.RewButton">
        <item name="android:src">@drawable/exo_styled_controls_rewind</item>
    </style>

<style name="PlayerControlButtonBaseStyle.FfwdButton">
        <item name="android:src">@drawable/exo_styled_controls_fastforward</item>
</style>

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.

oceanjules commented 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

Are you trying to override the icon by having a local drawable?

akshaysuryaprakash commented 1 week ago

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.

simranthakkar1996 commented 1 week ago

@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.

simranthakkar1996 commented 1 week ago

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>
akshaysuryaprakash commented 5 days ago

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".

simranthakkar1996 commented 5 days ago

@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.