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 63b31b23ae..f8e04d3d62 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 @@ -239,7 +239,7 @@ public interface ExoPlayer extends Player { * *
This method is experimental, and will be renamed or removed in a future release. * - * @param timeoutMs The time limit in milliseconds, or 0 for no limit. + * @param timeoutMs The time limit in milliseconds. */ public Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs) { setForegroundModeTimeoutMs = timeoutMs; @@ -457,7 +457,9 @@ public interface ExoPlayer extends Player { looper, /* wrappingPlayer= */ null); - player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs); + if (setForegroundModeTimeoutMs > 0) { + player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs); + } if (!throwWhenStuckBuffering) { player.experimentalDisableThrowWhenStuckBuffering(); } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java index 51f897e2e5..9e5a8b2409 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java @@ -204,7 +204,7 @@ import java.util.concurrent.TimeoutException; *
This method is experimental, and will be renamed or removed in a future release. It should * only be called before the player is used. * - * @param timeoutMs The time limit in milliseconds, or 0 for no limit. + * @param timeoutMs The time limit in milliseconds. */ public void experimentalSetForegroundModeTimeoutMs(long timeoutMs) { internalPlayer.experimentalSetForegroundModeTimeoutMs(timeoutMs);