diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 429ab4b1c2..8bea7b5e18 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -26,6 +26,8 @@ * Remove `FileDataSourceFactory`. Use `FileDataSource.Factory` instead. * Remove `SimpleExoPlayer.addMetadataOutput` and `removeMetadataOutput`. Use `Player.addListener` and `Player.Listener` instead. + * Remove `SimpleExoPlayer.addAudioListener`, `removeAudioListener` and + `AudioListener`. Use `Player.addListener` and `Player.Listener` instead. ### 2.15.0 (2021-08-10) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/Player.java b/library/common/src/main/java/com/google/android/exoplayer2/Player.java index 5040d84e63..a5ddac0779 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/Player.java @@ -24,7 +24,6 @@ import android.view.TextureView; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import com.google.android.exoplayer2.audio.AudioAttributes; -import com.google.android.exoplayer2.audio.AudioListener; import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.text.Cue; @@ -870,7 +869,7 @@ public interface Player { * *
All methods have no-op default implementations to allow selective overrides.
*/
- interface Listener extends VideoListener, AudioListener, TextOutput, EventListener {
+ interface Listener extends VideoListener, TextOutput, EventListener {
@Override
default void onTimelineChanged(Timeline timeline, @TimelineChangeReason int reason) {}
@@ -928,16 +927,32 @@ public interface Player {
@Override
default void onSeekBackIncrementChanged(long seekBackIncrementMs) {}
- @Override
+ /**
+ * Called when the audio session ID changes.
+ *
+ * @param audioSessionId The audio session ID.
+ */
default void onAudioSessionIdChanged(int audioSessionId) {}
- @Override
+ /**
+ * Called when the audio attributes change.
+ *
+ * @param audioAttributes The audio attributes.
+ */
default void onAudioAttributesChanged(AudioAttributes audioAttributes) {}
- @Override
+ /**
+ * Called when the volume changes.
+ *
+ * @param volume The new volume, with 0 being silence and 1 being unity gain.
+ */
default void onVolumeChanged(float volume) {}
- @Override
+ /**
+ * Called when skipping silences is enabled or disabled in the audio stream.
+ *
+ * @param skipSilenceEnabled Whether skipping silences in the audio stream is enabled.
+ */
default void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) {}
/** Called when the device information changes. */
diff --git a/library/common/src/main/java/com/google/android/exoplayer2/audio/AudioListener.java b/library/common/src/main/java/com/google/android/exoplayer2/audio/AudioListener.java
deleted file mode 100644
index 99e83e3060..0000000000
--- a/library/common/src/main/java/com/google/android/exoplayer2/audio/AudioListener.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.google.android.exoplayer2.audio;
-
-import com.google.android.exoplayer2.Player;
-
-/**
- * A listener for changes in audio configuration.
- *
- * @deprecated Use {@link Player.Listener}.
- */
-@Deprecated
-public interface AudioListener {
-
- /**
- * Called when the audio session ID changes.
- *
- * @param audioSessionId The audio session ID.
- */
- default void onAudioSessionIdChanged(int audioSessionId) {}
-
- /**
- * Called when the audio attributes change.
- *
- * @param audioAttributes The audio attributes.
- */
- default void onAudioAttributesChanged(AudioAttributes audioAttributes) {}
-
- /**
- * Called when the volume changes.
- *
- * @param volume The new volume, with 0 being silence and 1 being unity gain.
- */
- default void onVolumeChanged(float volume) {}
-
- /**
- * Called when skipping silences is enabled or disabled in the audio stream.
- *
- * @param skipSilenceEnabled Whether skipping silences in the audio stream is enabled.
- */
- default void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) {}
-}
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java
index fa151ec271..6bf7d66f15 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java
@@ -29,7 +29,6 @@ import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.audio.AudioCapabilities;
-import com.google.android.exoplayer2.audio.AudioListener;
import com.google.android.exoplayer2.audio.AudioSink;
import com.google.android.exoplayer2.audio.AuxEffectInfo;
import com.google.android.exoplayer2.audio.DefaultAudioSink;
@@ -146,24 +145,6 @@ public interface ExoPlayer extends Player {
/** The audio component of an {@link ExoPlayer}. */
interface AudioComponent {
- /**
- * Adds a listener to receive audio events.
- *
- * @param listener The listener to register.
- * @deprecated Use {@link #addListener(Listener)}.
- */
- @Deprecated
- void addAudioListener(AudioListener listener);
-
- /**
- * Removes a listener of audio events.
- *
- * @param listener The listener to unregister.
- * @deprecated Use {@link #removeListener(Listener)}.
- */
- @Deprecated
- void removeAudioListener(AudioListener listener);
-
/**
* Sets the attributes for audio playback, used by the underlying audio track. If not set, the
* default audio attributes will be used. They are suitable for general media playback.
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
index 7aa7084bb1..5748c49b5b 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
@@ -48,7 +48,6 @@ import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.audio.AudioAttributes;
-import com.google.android.exoplayer2.audio.AudioListener;
import com.google.android.exoplayer2.audio.AudioRendererEventListener;
import com.google.android.exoplayer2.audio.AuxEffectInfo;
import com.google.android.exoplayer2.decoder.DecoderCounters;
@@ -427,7 +426,6 @@ public class SimpleExoPlayer extends BasePlayer
private final ComponentListener componentListener;
private final FrameMetadataListener frameMetadataListener;
private final CopyOnWriteArraySet