diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Player.java b/library/core/src/main/java/com/google/android/exoplayer2/Player.java index 1c0dd4ca0a..a5d86d0b2c 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Player.java @@ -539,12 +539,15 @@ public interface Player { */ @Documented @Retention(RetentionPolicy.SOURCE) - @IntDef({PLAYBACK_SUPPRESSION_REASON_NONE, PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS}) + @IntDef({ + PLAYBACK_SUPPRESSION_REASON_NONE, + PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS + }) @interface PlaybackSuppressionReason {} /** Playback is not suppressed. */ int PLAYBACK_SUPPRESSION_REASON_NONE = 0; - /** Playback is suppressed because audio focus is lost or can't be acquired. */ - int PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS = 1; + /** Playback is suppressed due to transient audio focus loss. */ + int PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS = 1; /** * Repeat modes for playback. One of {@link #REPEAT_MODE_OFF}, {@link #REPEAT_MODE_ONE} or {@link @@ -669,13 +672,10 @@ public interface Player { int getPlaybackState(); /** - * Returns reason why playback is suppressed even if {@link #getPlaybackState()} is {@link - * #STATE_READY} and {@link #getPlayWhenReady()} is {@code true}. + * Returns the reason why playback is suppressed even though {@link #getPlayWhenReady()} is {@code + * true}, or {@link #PLAYBACK_SUPPRESSION_REASON_NONE} if playback is not suppressed. * - *

Note that {@link #PLAYBACK_SUPPRESSION_REASON_NONE} indicates that playback is not - * suppressed. - * - * @return The current {@link PlaybackSuppressionReason}. + * @return The current {@link PlaybackSuppressionReason playback suppression reason}. */ @PlaybackSuppressionReason int getPlaybackSuppressionReason(); 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 b89bd6fc54..9e59448c2d 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 @@ -1452,7 +1452,7 @@ public class SimpleExoPlayer extends BasePlayer @PlaybackSuppressionReason int playbackSuppressionReason = playWhenReady && playerCommand != AudioFocusManager.PLAYER_COMMAND_PLAY_WHEN_READY - ? Player.PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS + ? Player.PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS : Player.PLAYBACK_SUPPRESSION_REASON_NONE; player.setPlayWhenReady(playWhenReady, playbackSuppressionReason); } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/util/EventLogger.java b/library/core/src/main/java/com/google/android/exoplayer2/util/EventLogger.java index ec9ddba122..88f6b97e5c 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/util/EventLogger.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/util/EventLogger.java @@ -666,8 +666,8 @@ public class EventLogger implements AnalyticsListener { switch (playbackSuppressionReason) { case Player.PLAYBACK_SUPPRESSION_REASON_NONE: return "NONE"; - case Player.PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS: - return "AUDIO_FOCUS_LOSS"; + case Player.PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS: + return "TRANSIENT_AUDIO_FOCUS_LOSS"; default: return "?"; }