Search in sources :

Example 21 with Timeline

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

the class CustomPlayBackController method updateNavigation.

private void updateNavigation() {
    if (!isVisible() || !isAttachedToWindow) {
        return;
    }
    Timeline timeline = player != null ? player.getCurrentTimeline() : null;
    boolean haveNonEmptyTimeline = timeline != null && !timeline.isEmpty();
    boolean isSeekable = false;
    boolean enablePrevious = false;
    boolean enableNext = false;
    if (haveNonEmptyTimeline && !player.isPlayingAd()) {
        int windowIndex = player.getCurrentWindowIndex();
        timeline.getWindow(windowIndex, window);
        isSeekable = window.isSeekable;
        enablePrevious = isSeekable || !window.isDynamic || player.getPreviousWindowIndex() != C.INDEX_UNSET;
        enableNext = window.isDynamic || player.getNextWindowIndex() != C.INDEX_UNSET;
    }
    // TODO: 12/16/17
    setButtonEnabled(enablePrevious && false, previousButton, true);
    setButtonEnabled(enableNext && false, nextButton, true);
    setButtonEnabled(fastForwardMs > 0 && isSeekable, fastForwardButton, false);
    setButtonEnabled(rewindMs > 0 && isSeekable, rewindButton, false);
    progressBar.setEnabled(isSeekable);
}
Also used : Timeline(com.google.android.exoplayer2.Timeline)

Aggregations

Timeline (com.google.android.exoplayer2.Timeline)15 MediaSource (com.google.android.exoplayer2.source.MediaSource)4 SinglePeriodTimeline (com.google.android.exoplayer2.source.SinglePeriodTimeline)2 Listener (com.google.android.exoplayer2.source.MediaSource.Listener)1 SampleStream (com.google.android.exoplayer2.source.SampleStream)1 TrackGroup (com.google.android.exoplayer2.source.TrackGroup)1 TrackGroupArray (com.google.android.exoplayer2.source.TrackGroupArray)1 StreamElement (com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement)1 TrackSelection (com.google.android.exoplayer2.trackselection.TrackSelection)1 TrackSelectorResult (com.google.android.exoplayer2.trackselection.TrackSelectorResult)1