Search in sources :

Example 6 with Window

use of com.google.android.exoplayer2.Timeline.Window in project LeafPic by HoraApps.

the class CustomPlayBackController method next.

private void next() {
    Timeline currentTimeline = player.getCurrentTimeline();
    if (currentTimeline == null) {
        return;
    }
    int currentWindowIndex = player.getCurrentWindowIndex();
    if (currentWindowIndex < currentTimeline.getWindowCount() - 1) {
        player.seekToDefaultPosition(currentWindowIndex + 1);
    } else if (currentTimeline.getWindow(currentWindowIndex, window, false).isDynamic) {
        player.seekToDefaultPosition();
    }
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

Example 7 with Window

use of com.google.android.exoplayer2.Timeline.Window 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 8 with Window

use of com.google.android.exoplayer2.Timeline.Window 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 9 with Window

use of com.google.android.exoplayer2.Timeline.Window 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)

Example 10 with Window

use of com.google.android.exoplayer2.Timeline.Window in project ExoPlayer by google.

the class ClippingMediaSourceTest method setUp.

@Override
protected void setUp() throws Exception {
    TestUtil.setUpMockito(this);
    window = new Timeline.Window();
    period = new Timeline.Period();
}
Also used : Window(com.google.android.exoplayer2.Timeline.Window) Timeline(com.google.android.exoplayer2.Timeline) Period(com.google.android.exoplayer2.Timeline.Period)

Aggregations

Timeline (com.google.android.exoplayer2.Timeline)12 Uri (android.net.Uri)1 Handler (android.os.Handler)1 Period (com.google.android.exoplayer2.Timeline.Period)1 Window (com.google.android.exoplayer2.Timeline.Window)1 BehindLiveWindowException (com.google.android.exoplayer2.source.BehindLiveWindowException)1 SinglePeriodTimeline (com.google.android.exoplayer2.source.SinglePeriodTimeline)1 HlsUrl (com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist.HlsUrl)1 HlsMediaPlaylist (com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist)1 Segment (com.google.android.exoplayer2.source.hls.playlist.HlsMediaPlaylist.Segment)1 StreamElement (com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement)1 DataSpec (com.google.android.exoplayer2.upstream.DataSpec)1 TimestampAdjuster (com.google.android.exoplayer2.util.TimestampAdjuster)1 CookieHandler (java.net.CookieHandler)1