From b37773c5d60ba2e225c7d2cd7a4fc39665051a03 Mon Sep 17 00:00:00 2001 From: tonihei Date: Wed, 7 Mar 2018 01:38:37 -0800 Subject: [PATCH] Keep ExtractorMediaSource duration for repreparation. This allows to know the duration immediately and fixes the temporary unknown duration in the UI when repreparing the same extractor media source. The isSeekable property is still reset to false as we can't actually seek until the seek map has been reloaded. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=188145860 --- .../google/android/exoplayer2/source/ExtractorMediaSource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java index 20e789821d..288bc011a4 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java @@ -319,11 +319,12 @@ public final class ExtractorMediaSource extends BaseMediaSource this.eventDispatcher = new EventDispatcher(eventHandler, eventListener); this.customCacheKey = customCacheKey; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; + this.timelineDurationUs = C.TIME_UNSET; } @Override public void prepareSourceInternal(ExoPlayer player, boolean isTopLevelSource) { - notifySourceInfoRefreshed(C.TIME_UNSET, false); + notifySourceInfoRefreshed(timelineDurationUs, /* isSeekable= */ false); } @Override