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