window = new Timeline.Window(); formatBuilder = new StringBuilder(); formatter = new Formatter(formatBuilder, Locale.getDefault());
@Override public void onTimelineChanged(Timeline timeline, Object manifest, int reason) { 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, "]"); }
long windowStartPositionUs = window.getDefaultPositionUs(); if (deferredMediaPeriod != null) { long periodPreparePositionUs = deferredMediaPeriod.getPreparePositionUs();
window = new Timeline.Window(); formatBuilder = new StringBuilder(); formatter = new Formatter(formatBuilder, Locale.getDefault());
window = new Timeline.Window();
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); }
public EventLogger(MappingTrackSelector trackSelector) { this.trackSelector = trackSelector; window = new Timeline.Window(); period = new Timeline.Period(); startTimeMs = SystemClock.elapsedRealtime(); }
public VideoGesture(Context context, OnVideoGestureChangeListener onVideoGestureChangeListener, @NonNull ExoVideoPlaybackControlView.PlayerAccessor playerAccessor) { this.context = context; this.onVideoGestureChangeListener = onVideoGestureChangeListener; mAudioManager = (AudioManager) context.getSystemService(AUDIO_SERVICE); this.playerAccessor = playerAccessor; window = new Timeline.Window(); initVol(); }
Timeline.Window window = new Timeline.Window(); long windowDurationMs = window.getDurationMs(); if (cumulativePositionMs < positionMs && positionMs <= (cumulativePositionMs + windowDurationMs)) { player.seekTo(index, positionMs - cumulativePositionMs);
/** * TODO: Expose this * Returns the position in the media. If <code>limitToCurrentWindow</code> is <code>true</code> then the position * in the current window will be returned, otherwise the total position across all windows will be returned. * These should only be different if the media in playback has multiple windows (e.g. in the case of using a * <code>ConcatenatingMediaSource</code> with more than 1 source) * * @param limitToCurrentWindow If <code>true</code> the position within the current window will be returned * @return The current position in the media */ public long getCurrentPosition(boolean limitToCurrentWindow) { long positionInCurrentWindow = player.getCurrentPosition(); if (limitToCurrentWindow) { return positionInCurrentWindow; } // TODO cache the total time at the start of each window (e.g. Map<WindowIndex, cumulativeStartTimeMs>) // Adds the preceding window durations Timeline timeline = player.getCurrentTimeline(); int maxWindowIndex = Math.min(timeline.getWindowCount() - 1, player.getCurrentWindowIndex()); long cumulativePositionMs = 0; Timeline.Window window = new Timeline.Window(); for (int index = 0; index < maxWindowIndex; index++) { timeline.getWindow(index, window); cumulativePositionMs += window.getDurationMs(); } return cumulativePositionMs + positionInCurrentWindow; }
@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, "]"); }
@Nullable public WindowInfo getWindowInfo() { Timeline timeline = player.getCurrentTimeline(); if (timeline.isEmpty()) { return null; } int currentWindowIndex = player.getCurrentWindowIndex(); Timeline.Window currentWindow = timeline.getWindow(currentWindowIndex, new Timeline.Window(), true); return new WindowInfo( player.getPreviousWindowIndex(), currentWindowIndex, player.getNextWindowIndex(), currentWindow ); }
public EventLogger(MappingTrackSelector trackSelector) { this.trackSelector = trackSelector; window = new Timeline.Window(); period = new Timeline.Period(); startTimeMs = SystemClock.elapsedRealtime(); }
Builder.AUDIO_FORMAT)); long periodDurationMs = SINGLE_PERIOD_TIMELINE.getWindow(/* windowIndex= */ 0, new Window()).getDurationMs(); ActionSchedule actionSchedule = new ActionSchedule.Builder("AnalyticsCollectorTest")
new ConcatenatingMediaSource(childMediaSource, childMediaSource); long periodDurationMs = SINGLE_PERIOD_TIMELINE.getWindow(/* windowIndex= */ 0, new Window()).getDurationMs(); ActionSchedule actionSchedule = new ActionSchedule.Builder("AnalyticsCollectorTest")
this.relativeToDefaultPosition = relativeToDefaultPosition; mediaPeriods = new ArrayList<>(); window = new Timeline.Window();
pendingMessages = new ArrayList<>(); enabledRenderers = new Renderer[0]; window = new Timeline.Window(); period = new Timeline.Period(); trackSelector.init(/* listener= */ this, bandwidthMeter);
timeline1, timeline2); assertThat(clippedTimelines[0].getWindow(0, window).getDurationUs()) .isEqualTo(TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[0].getWindow(0, window).getDefaultPositionUs()).isEqualTo(0); assertThat(clippedTimelines[0].getWindow(0, window).isDynamic).isTrue(); assertThat(clippedTimelines[0].getWindow(0, window).getPositionInFirstPeriodUs()) .isEqualTo(TEST_PERIOD_DURATION_US + TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[0].getPeriod(0, period).getDurationUs()) .isEqualTo(2 * TEST_PERIOD_DURATION_US); assertThat(clippedTimelines[1].getWindow(0, window).getDurationUs()) .isEqualTo(TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[1].getWindow(0, window).getDefaultPositionUs()).isEqualTo(0); assertThat(clippedTimelines[1].getWindow(0, window).isDynamic).isTrue(); assertThat(clippedTimelines[1].getWindow(0, window).getPositionInFirstPeriodUs()) .isEqualTo(3 * TEST_PERIOD_DURATION_US + TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[1].getPeriod(0, period).getDurationUs())
timeline1, timeline2); assertThat(clippedTimelines[0].getWindow(0, window).getDurationUs()) .isEqualTo(TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[0].getWindow(0, window).getDefaultPositionUs()).isEqualTo(0); assertThat(clippedTimelines[0].getWindow(0, window).isDynamic).isTrue(); assertThat(clippedTimelines[0].getWindow(0, window).getPositionInFirstPeriodUs()) .isEqualTo(TEST_PERIOD_DURATION_US + TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[0].getPeriod(0, period).getDurationUs()) .isEqualTo(2 * TEST_PERIOD_DURATION_US); assertThat(clippedTimelines[1].getWindow(0, window).getDurationUs()) .isEqualTo(TEST_PERIOD_DURATION_US - TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[1].getWindow(0, window).getDefaultPositionUs()).isEqualTo(0); assertThat(clippedTimelines[1].getWindow(0, window).isDynamic).isTrue(); assertThat(clippedTimelines[1].getWindow(0, window).getPositionInFirstPeriodUs()) .isEqualTo(2 * TEST_PERIOD_DURATION_US + TEST_CLIP_AMOUNT_US); assertThat(clippedTimelines[1].getPeriod(0, period).getDurationUs())
Window window = new Window(); Period period = new Period(); for (int i = 0; i < windowCount; i++) {