Only set experimentalSetForegroundModeTimeoutMs value when it's > 0

PiperOrigin-RevId: 345489364
This commit is contained in:
olly 2020-12-03 19:00:55 +00:00 committed by Ian Baker
parent 2980354510
commit 0f64ace515
2 changed files with 5 additions and 3 deletions

View file

@ -239,7 +239,7 @@ public interface ExoPlayer extends Player {
* *
* <p>This method is experimental, and will be renamed or removed in a future release. * <p>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) { public Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs) {
setForegroundModeTimeoutMs = timeoutMs; setForegroundModeTimeoutMs = timeoutMs;
@ -457,7 +457,9 @@ public interface ExoPlayer extends Player {
looper, looper,
/* wrappingPlayer= */ null); /* wrappingPlayer= */ null);
player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs); if (setForegroundModeTimeoutMs > 0) {
player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs);
}
if (!throwWhenStuckBuffering) { if (!throwWhenStuckBuffering) {
player.experimentalDisableThrowWhenStuckBuffering(); player.experimentalDisableThrowWhenStuckBuffering();
} }

View file

@ -204,7 +204,7 @@ import java.util.concurrent.TimeoutException;
* <p>This method is experimental, and will be renamed or removed in a future release. It should * <p>This method is experimental, and will be renamed or removed in a future release. It should
* only be called before the player is used. * 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) { public void experimentalSetForegroundModeTimeoutMs(long timeoutMs) {
internalPlayer.experimentalSetForegroundModeTimeoutMs(timeoutMs); internalPlayer.experimentalSetForegroundModeTimeoutMs(timeoutMs);