-
Notifications
You must be signed in to change notification settings - Fork 644
Description
What's the matter?
I am using a forked version of the media3 library for my app to work around a specific issue. The problem is that some apps maybe use their own extended definition of repeat mode.
At least, the app I can find that causes the problem is Stellio. This app has two special repeat modes that cannot be handled by MediaUtils.convertToRepeatMode()
- Jump to a next list - Stop on last track
- 👉 representation code in decimal:
100
- 👉 representation code in decimal:
- Jump to a next list - Stop from first list
- 👉 representation code in decimal:
101
- 👉 representation code in decimal:

Proposed solution
Wrap the MediaUtils.convertToRepeatMode()
call with a try-catch block and fallback to an alternative repeat mode like this.
media/libraries/session/src/main/java/androidx/media3/session/MediaControllerImplLegacy.java
Line 1869 in 2fc189d
repeatMode = MediaUtils.convertToRepeatMode(newLegacyPlayerInfo.repeatMode); |
- repeatMode = MediaUtils.convertToRepeatMode(newLegacyPlayerInfo.repeatMode);
+ try {
+ repeatMode = MediaUtils.convertToRepeatMode(newLegacyPlayerInfo.repeatMode);
+ } catch (IllegalArgumentException e) {
+ repeatMode = Player.REPEAT_MODE_OFF;
+ }
I think calling MediaUtils.convertToShuffleModeEnabled()
is somewhat dangerous too due to the same reason, but I don't find the app that causes the error in the real world for now.