Search in sources :

Example 6 with SinglePeriodTimeline

use of com.google.android.exoplayer2.source.SinglePeriodTimeline in project ExoPlayer by google.

the class ClippingMediaSourceTest method testClippingUnseekableWindowThrows.

public void testClippingUnseekableWindowThrows() {
    Timeline timeline = new SinglePeriodTimeline(C.msToUs(TEST_PERIOD_DURATION_US), false);
    // 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 (IllegalArgumentException e) {
    // Expected.
    }
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

Example 7 with SinglePeriodTimeline

use of com.google.android.exoplayer2.source.SinglePeriodTimeline in project ExoPlayer by google.

the class ClippingMediaSourceTest method testNoClipping.

public void testNoClipping() {
    Timeline timeline = new SinglePeriodTimeline(C.msToUs(TEST_PERIOD_DURATION_US), true);
    Timeline clippedTimeline = getClippedTimeline(timeline, 0, TEST_PERIOD_DURATION_US);
    assertEquals(1, clippedTimeline.getWindowCount());
    assertEquals(1, clippedTimeline.getPeriodCount());
    assertEquals(TEST_PERIOD_DURATION_US, clippedTimeline.getWindow(0, window).getDurationUs());
    assertEquals(TEST_PERIOD_DURATION_US, clippedTimeline.getPeriod(0, period).getDurationUs());
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

Example 8 with SinglePeriodTimeline

use of com.google.android.exoplayer2.source.SinglePeriodTimeline in project ExoPlayer by google.

the class ClippingMediaSourceTest method testClippingStart.

public void testClippingStart() {
    Timeline timeline = new SinglePeriodTimeline(C.msToUs(TEST_PERIOD_DURATION_US), true);
    Timeline clippedTimeline = getClippedTimeline(timeline, TEST_CLIP_AMOUNT_US, TEST_PERIOD_DURATION_US);
    assertEquals(TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US, clippedTimeline.getWindow(0, window).getDurationUs());
    assertEquals(TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US, clippedTimeline.getPeriod(0, period).getDurationUs());
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

Aggregations

Timeline (com.google.android.exoplayer2.Timeline)6 SinglePeriodTimeline (com.google.android.exoplayer2.source.SinglePeriodTimeline)2 Format (com.google.android.exoplayer2.Format)1 StreamElement (com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement)1