timeline.getPeriod(periodIndex, period) at ExoPlayerImplInternal.java#L1474 always gives an ArrayIndexOutOfBoundsException as periodIndex == -1 at this point.
I think timeline.getPeriodByUid(periodUid, period) should be called instead to get the position of the subsequent period.
Thank you.