Remove ExoPlayer components

They have been deprecated since ExoPlayer 2.16.0 and can be easily
replaced by the exact same call in ExoPlayer directly.

PiperOrigin-RevId: 715755105
This commit is contained in:
tonihei 2025-01-15 05:08:44 -08:00 committed by Copybara-Service
parent ee4a0ea3df
commit a2016f03c6
6 changed files with 10 additions and 441 deletions

View File

@ -98,6 +98,8 @@
Composable depending on the ContentScale type and cover it with a
shutter-overlay before the first frame is rendered.
* Remove deprecated symbols:
* Removed `ExoPlayer.VideoComponent`, `ExoPlayer.AudioComponent`,
`ExoPlayer.TextComponent` and `ExoPlayer.DeviceComponent`.
## 1.6

View File

@ -39,7 +39,6 @@ import androidx.annotation.VisibleForTesting;
import androidx.media3.common.AudioAttributes;
import androidx.media3.common.AuxEffectInfo;
import androidx.media3.common.C;
import androidx.media3.common.DeviceInfo;
import androidx.media3.common.Effect;
import androidx.media3.common.Format;
import androidx.media3.common.MediaItem;
@ -48,8 +47,6 @@ import androidx.media3.common.PriorityTaskManager;
import androidx.media3.common.Timeline;
import androidx.media3.common.TrackSelectionParameters;
import androidx.media3.common.Tracks;
import androidx.media3.common.VideoSize;
import androidx.media3.common.text.CueGroup;
import androidx.media3.common.util.Clock;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
@ -167,259 +164,6 @@ import java.util.List;
*/
public interface ExoPlayer extends Player {
/**
* @deprecated Use {@link ExoPlayer}, as all methods are defined by that interface.
*/
@UnstableApi
@Deprecated
interface AudioComponent {
/**
* @deprecated Use {@link Player#setAudioAttributes(AudioAttributes, boolean)} instead.
*/
@Deprecated
void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus);
/**
* @deprecated Use {@link Player#getAudioAttributes()} instead.
*/
@Deprecated
AudioAttributes getAudioAttributes();
/**
* @deprecated Use {@link ExoPlayer#setAudioSessionId(int)} instead.
*/
@Deprecated
void setAudioSessionId(int audioSessionId);
/**
* @deprecated Use {@link ExoPlayer#getAudioSessionId()} instead.
*/
@Deprecated
int getAudioSessionId();
/**
* @deprecated Use {@link ExoPlayer#setAuxEffectInfo(AuxEffectInfo)} instead.
*/
@Deprecated
void setAuxEffectInfo(AuxEffectInfo auxEffectInfo);
/**
* @deprecated Use {@link ExoPlayer#clearAuxEffectInfo()} instead.
*/
@Deprecated
void clearAuxEffectInfo();
/**
* @deprecated Use {@link Player#setVolume(float)} instead.
*/
@Deprecated
void setVolume(float audioVolume);
/**
* @deprecated Use {@link Player#getVolume()} instead.
*/
@Deprecated
float getVolume();
/**
* @deprecated Use {@link ExoPlayer#setSkipSilenceEnabled(boolean)} instead.
*/
@Deprecated
void setSkipSilenceEnabled(boolean skipSilenceEnabled);
/**
* @deprecated Use {@link ExoPlayer#getSkipSilenceEnabled()} instead.
*/
@Deprecated
boolean getSkipSilenceEnabled();
}
/**
* @deprecated Use {@link ExoPlayer}, as all methods are defined by that interface.
*/
@UnstableApi
@Deprecated
interface VideoComponent {
/**
* @deprecated Use {@link ExoPlayer#setVideoScalingMode(int)} instead.
*/
@Deprecated
void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode);
/**
* @deprecated Use {@link ExoPlayer#getVideoScalingMode()} instead.
*/
@Deprecated
@C.VideoScalingMode
int getVideoScalingMode();
/**
* @deprecated Use {@link ExoPlayer#setVideoChangeFrameRateStrategy(int)} instead.
*/
@Deprecated
void setVideoChangeFrameRateStrategy(
@C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy);
/**
* @deprecated Use {@link ExoPlayer#getVideoChangeFrameRateStrategy()} instead.
*/
@Deprecated
@C.VideoChangeFrameRateStrategy
int getVideoChangeFrameRateStrategy();
/**
* @deprecated Use {@link ExoPlayer#setVideoFrameMetadataListener(VideoFrameMetadataListener)}
* instead.
*/
@Deprecated
void setVideoFrameMetadataListener(VideoFrameMetadataListener listener);
/**
* @deprecated Use {@link ExoPlayer#clearVideoFrameMetadataListener(VideoFrameMetadataListener)}
* instead.
*/
@Deprecated
void clearVideoFrameMetadataListener(VideoFrameMetadataListener listener);
/**
* @deprecated Use {@link ExoPlayer#setCameraMotionListener(CameraMotionListener)} instead.
*/
@Deprecated
void setCameraMotionListener(CameraMotionListener listener);
/**
* @deprecated Use {@link ExoPlayer#clearCameraMotionListener(CameraMotionListener)} instead.
*/
@Deprecated
void clearCameraMotionListener(CameraMotionListener listener);
/**
* @deprecated Use {@link Player#clearVideoSurface()} instead.
*/
@Deprecated
void clearVideoSurface();
/**
* @deprecated Use {@link Player#clearVideoSurface(Surface)} instead.
*/
@Deprecated
void clearVideoSurface(@Nullable Surface surface);
/**
* @deprecated Use {@link Player#setVideoSurface(Surface)} instead.
*/
@Deprecated
void setVideoSurface(@Nullable Surface surface);
/**
* @deprecated Use {@link Player#setVideoSurfaceHolder(SurfaceHolder)} instead.
*/
@Deprecated
void setVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder);
/**
* @deprecated Use {@link Player#clearVideoSurfaceHolder(SurfaceHolder)} instead.
*/
@Deprecated
void clearVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder);
/**
* @deprecated Use {@link Player#setVideoSurfaceView(SurfaceView)} instead.
*/
@Deprecated
void setVideoSurfaceView(@Nullable SurfaceView surfaceView);
/**
* @deprecated Use {@link Player#clearVideoSurfaceView(SurfaceView)} instead.
*/
@Deprecated
void clearVideoSurfaceView(@Nullable SurfaceView surfaceView);
/**
* @deprecated Use {@link Player#setVideoTextureView(TextureView)} instead.
*/
@Deprecated
void setVideoTextureView(@Nullable TextureView textureView);
/**
* @deprecated Use {@link Player#clearVideoTextureView(TextureView)} instead.
*/
@Deprecated
void clearVideoTextureView(@Nullable TextureView textureView);
/**
* @deprecated Use {@link Player#getVideoSize()} instead.
*/
@Deprecated
VideoSize getVideoSize();
}
/**
* @deprecated Use {@link Player}, as all methods are defined by that interface.
*/
@UnstableApi
@Deprecated
interface TextComponent {
/**
* @deprecated Use {@link Player#getCurrentCues()} instead.
*/
@Deprecated
CueGroup getCurrentCues();
}
/**
* @deprecated Use {@link Player}, as all methods are defined by that interface.
*/
@UnstableApi
@Deprecated
interface DeviceComponent {
/**
* @deprecated Use {@link Player#getDeviceInfo()} instead.
*/
@Deprecated
DeviceInfo getDeviceInfo();
/**
* @deprecated Use {@link Player#getDeviceVolume()} instead.
*/
@Deprecated
int getDeviceVolume();
/**
* @deprecated Use {@link Player#isDeviceMuted()} instead.
*/
@Deprecated
boolean isDeviceMuted();
/**
* @deprecated Use {@link Player#setDeviceVolume(int)} instead.
*/
@Deprecated
void setDeviceVolume(int volume);
/**
* @deprecated Use {@link Player#increaseDeviceVolume()} instead.
*/
@Deprecated
void increaseDeviceVolume();
/**
* @deprecated Use {@link Player#decreaseDeviceVolume()} instead.
*/
@Deprecated
void decreaseDeviceVolume();
/**
* @deprecated Use {@link Player#setDeviceMuted(boolean)} instead.
*/
@Deprecated
void setDeviceMuted(boolean muted);
}
/** A listener for audio offload events. */
@UnstableApi
interface AudioOffloadListener {
@ -470,7 +214,6 @@ public interface ExoPlayer extends Player {
*
* <p>See {@link #Builder(Context)} for the list of default values.
*/
@SuppressWarnings("deprecation")
final class Builder {
/* package */ final Context context;
@ -1353,6 +1096,7 @@ public interface ExoPlayer extends Player {
return new ExoPlayerImpl(/* builder= */ this, /* wrappingPlayer= */ null);
}
@SuppressWarnings("deprecation") // Building deprecated class.
/* package */ SimpleExoPlayer buildSimpleExoPlayer() {
checkState(!buildCalled);
buildCalled = true;
@ -1377,46 +1121,6 @@ public interface ExoPlayer extends Player {
@Nullable
ExoPlaybackException getPlayerError();
/**
* @deprecated Use {@link ExoPlayer}, as the {@link AudioComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Intentionally returning deprecated type
@UnstableApi
@Nullable
@Deprecated
AudioComponent getAudioComponent();
/**
* @deprecated Use {@link ExoPlayer}, as the {@link VideoComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Intentionally returning deprecated type
@UnstableApi
@Nullable
@Deprecated
VideoComponent getVideoComponent();
/**
* @deprecated Use {@link Player}, as the {@link TextComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Intentionally returning deprecated type
@UnstableApi
@Nullable
@Deprecated
TextComponent getTextComponent();
/**
* @deprecated Use {@link Player}, as the {@link DeviceComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Intentionally returning deprecated type
@UnstableApi
@Nullable
@Deprecated
DeviceComponent getDeviceComponent();
/**
* Adds a listener to receive audio offload events.
*

View File

@ -119,19 +119,13 @@ import androidx.media3.exoplayer.video.VideoRendererEventListener;
import androidx.media3.exoplayer.video.spherical.CameraMotionListener;
import androidx.media3.exoplayer.video.spherical.SphericalGLSurfaceView;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;
/** The default implementation of {@link ExoPlayer}. */
/* package */ final class ExoPlayerImpl extends BasePlayer
implements ExoPlayer,
ExoPlayer.AudioComponent,
ExoPlayer.VideoComponent,
ExoPlayer.TextComponent,
ExoPlayer.DeviceComponent {
/* package */ final class ExoPlayerImpl extends BasePlayer implements ExoPlayer {
static {
MediaLibraryInfo.registerModule("media3.exoplayer");
@ -456,42 +450,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
}
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class.
@Override
@Deprecated
public AudioComponent getAudioComponent() {
verifyApplicationThread();
return this;
}
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class.
@Override
@Deprecated
public VideoComponent getVideoComponent() {
verifyApplicationThread();
return this;
}
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class.
@Override
@Deprecated
public TextComponent getTextComponent() {
verifyApplicationThread();
return this;
}
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class.
@Override
@Deprecated
public DeviceComponent getDeviceComponent() {
verifyApplicationThread();
return this;
}
@Override
public boolean isSleepingForOffload() {
verifyApplicationThread();

View File

@ -68,13 +68,7 @@ import java.util.List;
*/
@UnstableApi
@Deprecated
@SuppressWarnings("deprecation") // Supporting deprecated base classes
public class SimpleExoPlayer extends BasePlayer
implements ExoPlayer,
ExoPlayer.AudioComponent,
ExoPlayer.VideoComponent,
ExoPlayer.TextComponent,
ExoPlayer.DeviceComponent {
public class SimpleExoPlayer extends BasePlayer implements ExoPlayer {
/**
* @deprecated Use {@link ExoPlayer.Builder} instead.
@ -429,6 +423,7 @@ public class SimpleExoPlayer extends BasePlayer
/**
* @param builder The {@link Builder} to obtain all construction parameters.
*/
@SuppressWarnings("deprecation") // Supporting deprecated builder.
protected SimpleExoPlayer(Builder builder) {
this(builder.wrappedBuilder);
}
@ -451,50 +446,6 @@ public class SimpleExoPlayer extends BasePlayer
return player.isSleepingForOffload();
}
/**
* @deprecated Use {@link ExoPlayer}, as the {@link AudioComponent} methods are defined by that
* interface.
*/
@Deprecated
@Override
@Nullable
public AudioComponent getAudioComponent() {
return this;
}
/**
* @deprecated Use {@link ExoPlayer}, as the {@link VideoComponent} methods are defined by that
* interface.
*/
@Deprecated
@Override
@Nullable
public VideoComponent getVideoComponent() {
return this;
}
/**
* @deprecated Use {@link Player}, as the {@link TextComponent} methods are defined by that
* interface.
*/
@Deprecated
@Override
@Nullable
public TextComponent getTextComponent() {
return this;
}
/**
* @deprecated Use {@link Player}, as the {@link DeviceComponent} methods are defined by that
* interface.
*/
@Deprecated
@Override
@Nullable
public DeviceComponent getDeviceComponent() {
return this;
}
@Override
public void setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
blockUntilConstructorFinished();
@ -1278,6 +1229,7 @@ public class SimpleExoPlayer extends BasePlayer
*/
@Deprecated
@Override
@SuppressWarnings("deprecation") // Forwarding deprecated method.
public void setDeviceVolume(int volume) {
blockUntilConstructorFinished();
player.setDeviceVolume(volume);
@ -1294,6 +1246,7 @@ public class SimpleExoPlayer extends BasePlayer
*/
@Deprecated
@Override
@SuppressWarnings("deprecation") // Forwarding deprecated method.
public void increaseDeviceVolume() {
blockUntilConstructorFinished();
player.increaseDeviceVolume();
@ -1310,6 +1263,7 @@ public class SimpleExoPlayer extends BasePlayer
*/
@Deprecated
@Override
@SuppressWarnings("deprecation") // Forwarding deprecated method.
public void decreaseDeviceVolume() {
blockUntilConstructorFinished();
player.decreaseDeviceVolume();
@ -1326,6 +1280,7 @@ public class SimpleExoPlayer extends BasePlayer
*/
@Deprecated
@Override
@SuppressWarnings("deprecation") // Forwarding deprecated method.
public void setDeviceMuted(boolean muted) {
blockUntilConstructorFinished();
player.setDeviceMuted(muted);

View File

@ -210,11 +210,6 @@ import androidx.media3.test.utils.StubExoPlayer;
// ExoPlayer methods. Other methods are unsupported.
@Override
public AudioComponent getAudioComponent() {
return null;
}
@Override
public Looper getApplicationLooper() {
return Looper.getMainLooper();

View File

@ -23,7 +23,6 @@ import androidx.media3.common.AuxEffectInfo;
import androidx.media3.common.C;
import androidx.media3.common.Effect;
import androidx.media3.common.Format;
import androidx.media3.common.Player;
import androidx.media3.common.PriorityTaskManager;
import androidx.media3.common.util.Clock;
import androidx.media3.common.util.UnstableApi;
@ -52,50 +51,6 @@ import java.util.List;
@UnstableApi
public class StubExoPlayer extends StubPlayer implements ExoPlayer {
/**
* @deprecated Use {@link ExoPlayer}, as the {@link AudioComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Returning deprecated type
@Override
@Deprecated
public AudioComponent getAudioComponent() {
throw new UnsupportedOperationException();
}
/**
* @deprecated Use {@link ExoPlayer}, as the {@link VideoComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Returning deprecated type
@Override
@Deprecated
public VideoComponent getVideoComponent() {
throw new UnsupportedOperationException();
}
/**
* @deprecated Use {@link Player}, as the {@link TextComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Returning deprecated type
@Override
@Deprecated
public TextComponent getTextComponent() {
throw new UnsupportedOperationException();
}
/**
* @deprecated Use {@link Player}, as the {@link DeviceComponent} methods are defined by that
* interface.
*/
@SuppressWarnings("deprecation") // Returning deprecated type
@Override
@Deprecated
public DeviceComponent getDeviceComponent() {
throw new UnsupportedOperationException();
}
@Override
public Looper getPlaybackLooper() {
throw new UnsupportedOperationException();