Make ExoPlayerImpl an ExoPlayer implementation

All the functionality of SimpleExoPlayer has moved to ExoPlayerImpl.
Hence, ExoPlayerImpl can fulfil its own name and become an ExoPlayer
implementation. As a result, ExoPlayer.Builder can return ExoPlayerImpl
directly without using SimpleExoPlayer at all.

PiperOrigin-RevId: 427947028
This commit is contained in:
tonihei 2022-02-11 09:28:34 +00:00 committed by Ian Baker
parent b271469fd0
commit 66dfb7361f
2 changed files with 208 additions and 142 deletions

View File

@ -958,7 +958,9 @@ public interface ExoPlayer extends Player {
* @throws IllegalStateException If this method has already been called. * @throws IllegalStateException If this method has already been called.
*/ */
public ExoPlayer build() { public ExoPlayer build() {
return buildSimpleExoPlayer(); checkState(!buildCalled);
buildCalled = true;
return new ExoPlayerImpl(/* builder= */ this, /* wrappingPlayer= */ null);
} }
/* package */ SimpleExoPlayer buildSimpleExoPlayer() { /* package */ SimpleExoPlayer buildSimpleExoPlayer() {