Refactor SEP prepare to clarify that it is equivalent to EPI prepare.

Before this change:
- SimpleExoPlayer.prepare(mediaSource) ended up calling
  ExoPlayerImpl.setMediaSourcesInternal() with startWindowIndex=0 and
  resetToDefaultPosition=false.
- ExoPlayerImpl.prepare(mediaSource) ended up calling
  ExoPlayerImpl.setMediaSourcesInternal() with
  startWindowIndex=C.INDEX_UNSET and resetToDefaultPosition=true.

This was functionaly equivalent but a bit confusing.

#minor-release

PiperOrigin-RevId: 368818143
This commit is contained in:
kimvde 2021-04-16 12:02:18 +01:00 committed by Oliver Woodman
parent fff7b8079a
commit 2cc51db54a

View file

@ -1354,10 +1354,7 @@ public class SimpleExoPlayer extends BasePlayer
@Override
public void prepare(MediaSource mediaSource, boolean resetPosition, boolean resetState) {
verifyApplicationThread();
setMediaSources(
Collections.singletonList(mediaSource),
/* startWindowIndex= */ resetPosition ? 0 : C.INDEX_UNSET,
/* startPositionMs= */ C.TIME_UNSET);
setMediaSources(Collections.singletonList(mediaSource), resetPosition);
prepare();
}