Skip to content

IndexOutOfBoundsException is occasionally raised in MediaControllerImplLegacy.initializeLegacyPlaylist() #241

Closed
@h6ah4i

Description

@h6ah4i

Media3 Version

1.0.0-beta03

Devices that reproduce the issue

from Crashlytics error reports:

  • OPPO Reno7 Z 5G running Android 13
  • Galaxy A13 running Android 12
  • moto g(9) power running Android 11
  • Redmi Note 8T running Android 10
  • moto e6 play running Android 9
  • Galaxy J7(2016) running Android 8.1.0
  • etc...

Devices that do not reproduce the issue

I think this issue is not device-specific.

Reproducible in the demo app?

No

Reproduction steps

Sorry, I have not been able to reproduce it myself. I can see crash reports on the Crashlytics dashboard for this issue.

  1. Create a MediaController that is connected to the other app like YouTube, Spotify, etc...
  2. Call MediaController#prepare()
  3. Sometimes it gets IndexOutOfBoundsException

Expected result

The MediaController#prepare() should not raise an IndexOutOfBoundsException.

Actual result

Gets IndexOutOfBoundsException on MediaController#prepare() sometimes.

Example 1

Target MediaSession app package: com.google.android.youtube.

Caused by java.lang.IndexOutOfBoundsException: index (0) must be less than size (0)
       at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1355)
       at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1337)
       at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:82)
       at androidx.media3.session.QueueTimeline.getQueueId(QueueTimeline.java:124)
       at androidx.media3.session.MediaControllerImplLegacy.initializeLegacyPlaylist(MediaControllerImplLegacy.java:1286)
       at androidx.media3.session.MediaControllerImplLegacy.prepare(MediaControllerImplLegacy.java:291)
       at androidx.media3.session.MediaController.prepare(MediaController.java:552)
    ...

Example 2

Target MediaSession app package: in.krosbits.musicolet

Fatal Exception: java.lang.IndexOutOfBoundsException: index (147) must be less than size (147)
       at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1355)
       at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1337)
       at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:82)
       at androidx.media3.session.QueueTimeline.getQueueId(QueueTimeline.java:124)
       at androidx.media3.session.MediaControllerImplLegacy.initializeLegacyPlaylist(MediaControllerImplLegacy.java:1286)
       at androidx.media3.session.MediaControllerImplLegacy.prepare(MediaControllerImplLegacy.java:291)
       at androidx.media3.session.MediaController.prepare(MediaController.java:552)
    ...

I can see the same issue for other apps like:

  • com.spotify.music
  • deezer.android.app
  • com.musixmatch.android.lyrify
  • com.audiomack
  • etc...

Media

n/a

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions