當前位置: 首頁>>代碼示例>>Java>>正文


Java Timeline.getWindowCount方法代碼示例

本文整理匯總了Java中com.google.android.exoplayer2.Timeline.getWindowCount方法的典型用法代碼示例。如果您正苦於以下問題:Java Timeline.getWindowCount方法的具體用法?Java Timeline.getWindowCount怎麽用?Java Timeline.getWindowCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.exoplayer2.Timeline的用法示例。


在下文中一共展示了Timeline.getWindowCount方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: seekToTimeBarPosition

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void seekToTimeBarPosition(long positionMs) {
    int windowIndex;
    Timeline timeline = player.getCurrentTimeline();
    if (multiWindowTimeBar && !timeline.isEmpty()) {
        int windowCount = timeline.getWindowCount();
        windowIndex = 0;
        while (true) {
            long windowDurationMs = timeline.getWindow(windowIndex, window).getDurationMs();
            if (positionMs < windowDurationMs) {
                break;
            } else if (windowIndex == windowCount - 1) {
                // Seeking past the end of the last window should seek to the end of the timeline.
                positionMs = windowDurationMs;
                break;
            }
            positionMs -= windowDurationMs;
            windowIndex++;
        }
    } else {
        windowIndex = player.getCurrentWindowIndex();
    }
    seekTo(windowIndex, positionMs);
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:24,代碼來源:PlaybackControlView.java

示例2: onTimelineChanged

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
  int periodCount = timeline.getPeriodCount();
  int windowCount = timeline.getWindowCount();
  Log.d(TAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getPeriod(i, period);
    Log.d(TAG, "  " +  "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getWindow(i, window);
    Log.d(TAG, "  " +  "window [" + getTimeString(window.getDurationMs()) + ", "
        + window.isSeekable + ", " + window.isDynamic + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  Log.d(TAG, "]");
}
 
開發者ID:Tubitv,項目名稱:TubiPlayer,代碼行數:23,代碼來源:EventLogger.java

示例3: onTimelineChanged

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
  if (timeline == null) {
    return;
  }
  int periodCount = timeline.getPeriodCount();
  int windowCount = timeline.getWindowCount();
  Log.d(TAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getPeriod(i, period);
    Log.d(TAG, "  " +  "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getWindow(i, window);
    Log.d(TAG, "  " +  "window [" + getTimeString(window.getDurationMs()) + ", "
        + window.isSeekable + ", " + window.isDynamic + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  Log.d(TAG, "]");
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:26,代碼來源:EventLogger.java

示例4: LoopingTimeline

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public LoopingTimeline(Timeline childTimeline, int loopCount) {
  this.childTimeline = childTimeline;
  childPeriodCount = childTimeline.getPeriodCount();
  childWindowCount = childTimeline.getWindowCount();
  // This is the maximum number of loops that can be performed without exceeding
  // MAX_EXPOSED_PERIODS periods.
  int maxLoopCount = MAX_EXPOSED_PERIODS / childPeriodCount;
  if (loopCount > maxLoopCount) {
    if (loopCount != Integer.MAX_VALUE) {
      Log.w(TAG, "Capped loops to avoid overflow: " + loopCount + " -> " + maxLoopCount);
    }
    this.loopCount = maxLoopCount;
  } else {
    this.loopCount = loopCount;
  }
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:17,代碼來源:LoopingMediaSource.java

示例5: ConcatenatedTimeline

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public ConcatenatedTimeline(Timeline[] timelines) {
  int[] sourcePeriodOffsets = new int[timelines.length];
  int[] sourceWindowOffsets = new int[timelines.length];
  long periodCount = 0;
  int windowCount = 0;
  for (int i = 0; i < timelines.length; i++) {
    Timeline timeline = timelines[i];
    periodCount += timeline.getPeriodCount();
    Assertions.checkState(periodCount <= Integer.MAX_VALUE,
        "ConcatenatingMediaSource children contain too many periods");
    sourcePeriodOffsets[i] = (int) periodCount;
    windowCount += timeline.getWindowCount();
    sourceWindowOffsets[i] = windowCount;
  }
  this.timelines = timelines;
  this.sourcePeriodOffsets = sourcePeriodOffsets;
  this.sourceWindowOffsets = sourceWindowOffsets;
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:19,代碼來源:ConcatenatingMediaSource.java

示例6: onTimelineChanged

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
  int periodCount = timeline.getPeriodCount();
  int windowCount = timeline.getWindowCount();
  Log.d(TAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getPeriod(i, period);
    Log.d(TAG, "  " +  "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getWindow(i, window);
    Log.d(TAG, "  " +  "window [" + getTimeString(window.getDurationMs()) + ", "
            + window.isSeekable + ", " + window.isDynamic + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  Log.d(TAG, "]");
}
 
開發者ID:CarGuo,項目名稱:GSYVideoPlayer,代碼行數:23,代碼來源:EventLogger.java

示例7: updateNavigation

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void updateNavigation() {

        if (!isVisible() || !isAttachedToWindow) {
            return;
        }
        Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
        boolean haveNonEmptyTimeline = currentTimeline != null && !currentTimeline.isEmpty();
        boolean enableNext = false;
        if (haveNonEmptyTimeline) {
            int currentWindowIndex = player.getCurrentWindowIndex();
            currentTimeline.getWindow(currentWindowIndex, currentWindow);
//            enablePrevious = currentWindowIndex > 0 || isSeekable || !currentWindow.isDynamic;
            enableNext = (currentWindowIndex < currentTimeline.getWindowCount() - 1)
                    || currentWindow.isDynamic;
        }


        setButtonEnabled(enableNext, nextLandscape);

    }
 
開發者ID:JarvanMo,項目名稱:ExoPlayerVideoView,代碼行數:21,代碼來源:ExoVideoPlaybackControlView.java

示例8: updateNavigation

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void updateNavigation() {
  if (!isVisible() || !isAttachedToWindow) {
    return;
  }
  Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
  boolean haveNonEmptyTimeline = currentTimeline != null && !currentTimeline.isEmpty();
  boolean isSeekable = false;
  boolean enablePrevious = false;
  boolean enableNext = false;
  if (haveNonEmptyTimeline) {
    int currentWindowIndex = player.getCurrentWindowIndex();
    currentTimeline.getWindow(currentWindowIndex, currentWindow);
    isSeekable = currentWindow.isSeekable;
    enablePrevious = currentWindowIndex > 0 || isSeekable || !currentWindow.isDynamic;
    enableNext = (currentWindowIndex < currentTimeline.getWindowCount() - 1)
        || currentWindow.isDynamic;
  }
  setButtonEnabled(enablePrevious , previousButton);
  setButtonEnabled(enableNext, nextButton);
  setButtonEnabled(fastForwardMs > 0 && isSeekable, fastForwardButton);
  setButtonEnabled(rewindMs > 0 && isSeekable, rewindButton);
  if (progressBar != null) {
    progressBar.setEnabled(isSeekable);
  }
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:26,代碼來源:PlaybackControlView.java

示例9: ConcatenatedTimeline

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
public ConcatenatedTimeline(Timeline[] timelines) {
  int[] sourcePeriodOffsets = new int[timelines.length];
  int[] sourceWindowOffsets = new int[timelines.length];
  int periodCount = 0;
  int windowCount = 0;
  for (int i = 0; i < timelines.length; i++) {
    Timeline timeline = timelines[i];
    periodCount += timeline.getPeriodCount();
    sourcePeriodOffsets[i] = periodCount;
    windowCount += timeline.getWindowCount();
    sourceWindowOffsets[i] = windowCount;
  }
  this.timelines = timelines;
  this.sourcePeriodOffsets = sourcePeriodOffsets;
  this.sourceWindowOffsets = sourceWindowOffsets;
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:17,代碼來源:ConcatenatingMediaSource.java

示例10: onTimelineChanged

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
  int periodCount = timeline.getPeriodCount();
  int windowCount = timeline.getWindowCount();
  Log.d(TAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
  for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getPeriod(i, period);
    Log.d(TAG, "  " + "period [" + getTimeString(period.getDurationMs()) + "]");
  }
  if (periodCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
    timeline.getWindow(i, window);
    Log.d(TAG, "  " + "window [" + getTimeString(window.getDurationMs()) + ", "
            + window.isSeekable + ", " + window.isDynamic + "]");
  }
  if (windowCount > MAX_TIMELINE_ITEM_LINES) {
    Log.d(TAG, "  ...");
  }
  Log.d(TAG, "]");
}
 
開發者ID:jcodeing,項目名稱:K-Sonic,代碼行數:23,代碼來源:EventLogger.java

示例11: onTimelineChanged

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
@Override
public void onTimelineChanged(Timeline timeline, Object manifest) {
    if (timeline == null) {
        return;
    }
    int periodCount = timeline.getPeriodCount();
    int windowCount = timeline.getWindowCount();
    Log.d(TAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
    for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
        timeline.getPeriod(i, period);
        Log.d(TAG, "  " + "period [" + getTimeString(period.getDurationMs()) + "]");
    }
    if (periodCount > MAX_TIMELINE_ITEM_LINES) {
        Log.d(TAG, "  ...");
    }
    for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
        timeline.getWindow(i, window);
        Log.d(TAG, "  " + "window [" + getTimeString(window.getDurationMs()) + ", "
                + window.isSeekable + ", " + window.isDynamic + "]");
    }
    if (windowCount > MAX_TIMELINE_ITEM_LINES) {
        Log.d(TAG, "  ...");
    }
    Log.d(TAG, "]");
}
 
開發者ID:AndroidTips,項目名稱:MDVideo,代碼行數:26,代碼來源:EventLogger.java

示例12: updateNavigation

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void updateNavigation() {
  if (!isVisible() || !isAttachedToWindow) {
    return;
  }
  Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
  boolean haveTimeline = currentTimeline != null;
  boolean isSeekable = false;
  boolean enablePrevious = false;
  boolean enableNext = false;
  if (haveTimeline) {
    int currentWindowIndex = player.getCurrentWindowIndex();
    currentTimeline.getWindow(currentWindowIndex, currentWindow);
    isSeekable = currentWindow.isSeekable;
    enablePrevious = currentWindowIndex > 0 || isSeekable || !currentWindow.isDynamic;
    enableNext = (currentWindowIndex < currentTimeline.getWindowCount() - 1)
        || currentWindow.isDynamic;
  }
  setButtonEnabled(enablePrevious , previousButton);
  setButtonEnabled(enableNext, nextButton);
  setButtonEnabled(fastForwardMs > 0 && isSeekable, fastForwardButton);
  setButtonEnabled(rewindMs > 0 && isSeekable, rewindButton);
  progressBar.setEnabled(isSeekable);
}
 
開發者ID:AndroidTips,項目名稱:MDVideo,代碼行數:24,代碼來源:MediaControlView.java

示例13: updateNavigation

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private void updateNavigation() {
    if (!isVisible() || !isAttachedToWindow) {
      return;
    }
    Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
    boolean haveTimeline = currentTimeline != null;
    boolean isSeekable = false;
    boolean enablePrevious = false;
    boolean enableNext = false;
    if (haveTimeline) {
      int currentWindowIndex = player.getCurrentWindowIndex();
      currentTimeline.getWindow(currentWindowIndex, currentWindow);
      isSeekable = currentWindow.isSeekable;
      enablePrevious = currentWindowIndex > 0 || isSeekable || !currentWindow.isDynamic;
      enableNext = (currentWindowIndex < currentTimeline.getWindowCount() - 1)
          || currentWindow.isDynamic;
    }
//    setButtonEnabled(enablePrevious , previousButton);
//    setButtonEnabled(enableNext, nextButton);
//    setButtonEnabled(fastForwardMs > 0 && isSeekable, fastForwardButton);
//    setButtonEnabled(rewindMs > 0 && isSeekable, rewindButton);
    progressBar.setEnabled(isSeekable);
  }
 
開發者ID:zhanglibin123488,項目名稱:videoPickPlayer,代碼行數:24,代碼來源:PlaybackControlView.java

示例14: canShowMultiWindowTimeBar

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
/**
 * Returns whether the specified {@code timeline} can be shown on a multi-window time bar.
 *
 * @param timeline The {@link Timeline} to check.
 * @param window   A scratch {@link Timeline.Window} instance.
 * @return Whether the specified timeline can be shown on a multi-window time bar.
 */
private static boolean canShowMultiWindowTimeBar(Timeline timeline, Timeline.Window window) {
    if (timeline.getWindowCount() > MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR) {
        return false;
    }
    int windowCount = timeline.getWindowCount();
    for (int i = 0; i < windowCount; i++) {
        if (timeline.getWindow(i, window).durationUs == C.TIME_UNSET) {
            return false;
        }
    }
    return true;
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:20,代碼來源:PlaybackControlView.java

示例15: checkTimelineMerges

import com.google.android.exoplayer2.Timeline; //導入方法依賴的package包/類
private IllegalMergeException checkTimelineMerges(Timeline timeline) {
  int windowCount = timeline.getWindowCount();
  for (int i = 0; i < windowCount; i++) {
    if (timeline.getWindow(i, window, false).isDynamic) {
      return new IllegalMergeException(IllegalMergeException.REASON_WINDOWS_ARE_DYNAMIC);
    }
  }
  if (periodCount == PERIOD_COUNT_UNSET) {
    periodCount = timeline.getPeriodCount();
  } else if (timeline.getPeriodCount() != periodCount) {
    return new IllegalMergeException(IllegalMergeException.REASON_PERIOD_COUNT_MISMATCH);
  }
  return null;
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:15,代碼來源:MergingMediaSource.java


注:本文中的com.google.android.exoplayer2.Timeline.getWindowCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。