use of androidx.media3.exoplayer.source.ClippingMediaSource.IllegalClippingException in project media by androidx.
the class ClippingMediaSourceTest method clippingUnseekableWindowThrows.
@Test
public void clippingUnseekableWindowThrows() throws IOException {
Timeline timeline = new SinglePeriodTimeline(TEST_PERIOD_DURATION_US, /* isSeekable= */
false, /* isDynamic= */
false, /* useLiveConfiguration= */
false, /* manifest= */
null, MediaItem.fromUri(Uri.EMPTY));
// If the unseekable window isn't clipped, clipping succeeds.
getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US);
try {
// If the unseekable window is clipped, clipping fails.
getClippedTimeline(timeline, 1, TEST_PERIOD_DURATION_US);
fail("Expected clipping to fail.");
} catch (IllegalClippingException e) {
assertThat(e.reason).isEqualTo(IllegalClippingException.REASON_NOT_SEEKABLE_TO_START);
}
}
use of androidx.media3.exoplayer.source.ClippingMediaSource.IllegalClippingException in project media by androidx.
the class ClippingMediaSourceTest method clippingUnseekableWindowWithUnknownDurationThrows.
@Test
public void clippingUnseekableWindowWithUnknownDurationThrows() throws IOException {
Timeline timeline = new SinglePeriodTimeline(/* durationUs= */
C.TIME_UNSET, /* isSeekable= */
false, /* isDynamic= */
false, /* useLiveConfiguration= */
false, /* manifest= */
null, MediaItem.fromUri(Uri.EMPTY));
// If the unseekable window isn't clipped, clipping succeeds.
getClippedTimeline(timeline, /* startUs= */
0, TEST_PERIOD_DURATION_US);
try {
// If the unseekable window is clipped, clipping fails.
getClippedTimeline(timeline, /* startUs= */
1, TEST_PERIOD_DURATION_US);
fail("Expected clipping to fail.");
} catch (IllegalClippingException e) {
assertThat(e.reason).isEqualTo(IllegalClippingException.REASON_NOT_SEEKABLE_TO_START);
}
}
Aggregations