Simplify using the Builder in SimpleExoPlayer subclasses.

PiperOrigin-RevId: 297111999
This commit is contained in:
tonihei 2020-02-25 15:28:29 +00:00 committed by Oliver Woodman
parent a9eb086678
commit 915f66730c

View file

@ -293,16 +293,7 @@ public class SimpleExoPlayer extends BasePlayer
public SimpleExoPlayer build() {
Assertions.checkState(!buildCalled);
buildCalled = true;
return new SimpleExoPlayer(
context,
renderersFactory,
trackSelector,
loadControl,
bandwidthMeter,
analyticsCollector,
useLazyPreparation,
clock,
looper);
return new SimpleExoPlayer(/* builder= */ this);
}
}
@ -351,6 +342,20 @@ public class SimpleExoPlayer extends BasePlayer
private boolean isPriorityTaskManagerRegistered;
private boolean playerReleased;
/** @param builder The {@link Builder} to obtain all construction parameters. */
protected SimpleExoPlayer(Builder builder) {
this(
builder.context,
builder.renderersFactory,
builder.trackSelector,
builder.loadControl,
builder.bandwidthMeter,
builder.analyticsCollector,
builder.useLazyPreparation,
builder.clock,
builder.looper);
}
/**
* @param context A {@link Context}.
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.