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
This commit is contained in:
tonihei 2018-03-07 01:38:37 -08:00 committed by Oliver Woodman
parent e9f36f06ec
commit b37773c5d6

View File

@ -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