ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

SimpleExoPlayer getWindow(windowIndex, window) throws IndexOutOfBoundsException

Open PavelGP opened this issue 9 years ago • 1 comments

  • A description of the issue: Tried to play broken stream and found that ExoPLayer crashed. I have only Crashlytics bug report and my code. My code:
if (player != null && player.getCurrentTimeline() != null) {
            Timeline.Window window = new Timeline.Window();
            player.getCurrentTimeline().getWindow(player.getCurrentWindowIndex(), window);
            return window.windowStartTimeMs;
        }

where player is SimpleExoPlayer class;

  • A link to content: streams are under VPN, and when crash happened it was broken stream which did not play.
  • The version of ExoPlayer being used: seems that this issue is related to ExoPLayer 2.1.1 and is not reprodeced on ExoPLayer 2.0.3, but I'm not sure.
  • The device(s) and version(s) of Android on which the issue can be reproduced: GT-I9300 android 4.3, SM-G920F android 6.0;
  • A bug report: from Crashlytics:
Fatal Exception: java.lang.IndexOutOfBoundsException	
com.google.android.exoplayer2.Timeline$1.getWindow (Timeline.java:107)
com.google.android.exoplayer2.Timeline.getWindow (Timeline.java:161)
com.google.android.exoplayer2.Timeline.getWindow (Timeline.java:148)

PavelGP avatar Jan 23 '17 12:01 PavelGP

If the timeline is empty any index you pass to getWindow() will result in an out of bounds exception. You should check whether the timeline is empty before you query it, by calling Timeline.isEmpty.

ojw28 avatar Jan 23 '17 13:01 ojw28