Remove ExoPlayer.Builder#buildExoPlayer

We no longer need separate methods to build Player and ExoPlayer.

PiperOrigin-RevId: 401751761
This commit is contained in:
ibaker 2021-10-08 13:57:38 +01:00 committed by bachinger
parent d45cf6028d
commit ce66b01ee2

View File

@ -501,8 +501,7 @@ public interface ExoPlayer extends Player {
*
* @param trackSelector A {@link TrackSelector}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setTrackSelector(TrackSelector trackSelector) {
wrappedBuilder.setTrackSelector(trackSelector);
@ -514,8 +513,7 @@ public interface ExoPlayer extends Player {
*
* @param mediaSourceFactory A {@link MediaSourceFactory}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setMediaSourceFactory(MediaSourceFactory mediaSourceFactory) {
wrappedBuilder.setMediaSourceFactory(mediaSourceFactory);
@ -527,8 +525,7 @@ public interface ExoPlayer extends Player {
*
* @param loadControl A {@link LoadControl}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setLoadControl(LoadControl loadControl) {
wrappedBuilder.setLoadControl(loadControl);
@ -540,8 +537,7 @@ public interface ExoPlayer extends Player {
*
* @param bandwidthMeter A {@link BandwidthMeter}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) {
wrappedBuilder.setBandwidthMeter(bandwidthMeter);
@ -554,8 +550,7 @@ public interface ExoPlayer extends Player {
*
* @param looper A {@link Looper}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setLooper(Looper looper) {
wrappedBuilder.setLooper(looper);
@ -567,8 +562,7 @@ public interface ExoPlayer extends Player {
*
* @param analyticsCollector An {@link AnalyticsCollector}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector) {
wrappedBuilder.setAnalyticsCollector(analyticsCollector);
@ -582,8 +576,7 @@ public interface ExoPlayer extends Player {
*
* @param priorityTaskManager A {@link PriorityTaskManager}, or null to not use one.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
wrappedBuilder.setPriorityTaskManager(priorityTaskManager);
@ -601,8 +594,7 @@ public interface ExoPlayer extends Player {
* @param audioAttributes {@link AudioAttributes}.
* @param handleAudioFocus Whether the player should handle audio focus.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
wrappedBuilder.setAudioAttributes(audioAttributes, handleAudioFocus);
@ -624,8 +616,7 @@ public interface ExoPlayer extends Player {
*
* @param wakeMode A {@link C.WakeMode}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setWakeMode(@C.WakeMode int wakeMode) {
wrappedBuilder.setWakeMode(wakeMode);
@ -641,8 +632,7 @@ public interface ExoPlayer extends Player {
* @param handleAudioBecomingNoisy Whether the player should pause automatically when audio is
* rerouted from a headset to device speakers.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
wrappedBuilder.setHandleAudioBecomingNoisy(handleAudioBecomingNoisy);
@ -654,8 +644,7 @@ public interface ExoPlayer extends Player {
*
* @param skipSilenceEnabled Whether skipping silences is enabled.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setSkipSilenceEnabled(boolean skipSilenceEnabled) {
wrappedBuilder.setSkipSilenceEnabled(skipSilenceEnabled);
@ -670,8 +659,7 @@ public interface ExoPlayer extends Player {
*
* @param videoScalingMode A {@link C.VideoScalingMode}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
wrappedBuilder.setVideoScalingMode(videoScalingMode);
@ -690,8 +678,7 @@ public interface ExoPlayer extends Player {
*
* @param videoChangeFrameRateStrategy A {@link C.VideoChangeFrameRateStrategy}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setVideoChangeFrameRateStrategy(
@C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy) {
@ -708,8 +695,7 @@ public interface ExoPlayer extends Player {
*
* @param useLazyPreparation Whether to use lazy preparation.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setUseLazyPreparation(boolean useLazyPreparation) {
wrappedBuilder.setUseLazyPreparation(useLazyPreparation);
@ -721,8 +707,7 @@ public interface ExoPlayer extends Player {
*
* @param seekParameters The {@link SeekParameters}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setSeekParameters(SeekParameters seekParameters) {
wrappedBuilder.setSeekParameters(seekParameters);
@ -735,8 +720,7 @@ public interface ExoPlayer extends Player {
* @param seekBackIncrementMs The seek back increment, in milliseconds.
* @return This builder.
* @throws IllegalArgumentException If {@code seekBackIncrementMs} is non-positive.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setSeekBackIncrementMs(@IntRange(from = 1) long seekBackIncrementMs) {
wrappedBuilder.setSeekBackIncrementMs(seekBackIncrementMs);
@ -749,8 +733,7 @@ public interface ExoPlayer extends Player {
* @param seekForwardIncrementMs The seek forward increment, in milliseconds.
* @return This builder.
* @throws IllegalArgumentException If {@code seekForwardIncrementMs} is non-positive.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setSeekForwardIncrementMs(@IntRange(from = 1) long seekForwardIncrementMs) {
wrappedBuilder.setSeekForwardIncrementMs(seekForwardIncrementMs);
@ -766,8 +749,7 @@ public interface ExoPlayer extends Player {
*
* @param releaseTimeoutMs The release timeout, in milliseconds.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setReleaseTimeoutMs(long releaseTimeoutMs) {
wrappedBuilder.setReleaseTimeoutMs(releaseTimeoutMs);
@ -783,8 +765,7 @@ public interface ExoPlayer extends Player {
*
* @param detachSurfaceTimeoutMs The timeout for detaching a surface, in milliseconds.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setDetachSurfaceTimeoutMs(long detachSurfaceTimeoutMs) {
wrappedBuilder.setDetachSurfaceTimeoutMs(detachSurfaceTimeoutMs);
@ -801,8 +782,7 @@ public interface ExoPlayer extends Player {
*
* @param pauseAtEndOfMediaItems Whether to pause playback at the end of each media item.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) {
wrappedBuilder.setPauseAtEndOfMediaItems(pauseAtEndOfMediaItems);
@ -815,8 +795,7 @@ public interface ExoPlayer extends Player {
*
* @param livePlaybackSpeedControl The {@link LivePlaybackSpeedControl}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
public Builder setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl) {
wrappedBuilder.setLivePlaybackSpeedControl(livePlaybackSpeedControl);
@ -829,8 +808,7 @@ public interface ExoPlayer extends Player {
*
* @param clock A {@link Clock}.
* @return This builder.
* @throws IllegalStateException If {@link #build()} or {@link #buildExoPlayer()} has already
* been called.
* @throws IllegalStateException If {@link #build()} has already been called.
*/
@VisibleForTesting
public Builder setClock(Clock clock) {
@ -841,19 +819,9 @@ public interface ExoPlayer extends Player {
/**
* Builds a {@link SimpleExoPlayer} instance.
*
* @throws IllegalStateException If this method or {@link #buildExoPlayer()} has already been
* called.
* @throws IllegalStateException If this method has already been called.
*/
public SimpleExoPlayer build() {
return buildExoPlayer();
}
/**
* Builds a {@link SimpleExoPlayer} instance.
*
* @throws IllegalStateException If this method or {@link #build()} has already been called.
*/
public SimpleExoPlayer buildExoPlayer() {
return wrappedBuilder.build();
}
}