google/ExoPlayer · error · IllegalStateException

Missing implementation to handle COMMAND_ADJUST_DEVICE_VOLUM

Error message

Missing implementation to handle COMMAND_ADJUST_DEVICE_VOLUME or COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS

What it means

SimpleBasePlayer forwards Player.increaseDeviceVolume() / increaseDeviceVolume(int) to handleIncreaseDeviceVolume(int flags). If the subclass lists Player.COMMAND_ADJUST_DEVICE_VOLUME (or the _WITH_FLAGS variant) in availableCommands but leaves the default handler, the call throws this IllegalStateException. The message intentionally names both command constants because either one routes here.

Source

Thrown at library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java:3090

    throw new IllegalStateException(
        "Missing implementation to handle COMMAND_SET_DEVICE_VOLUME or"
            + " COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS");
  }

  /**
   * Handles calls to {@link Player#increaseDeviceVolume()} and {@link
   * Player#increaseDeviceVolume(int)}.
   *
   * <p>Will only be called if {@link Player#COMMAND_ADJUST_DEVICE_VOLUME} or {@link
   * Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS} is available.
   *
   * @param flags Either 0 or a bitwise combination of one or more {@link C.VolumeFlags}.
   * @return A {@link ListenableFuture} indicating the completion of all immediate {@link State}
   *     changes caused by this call.
   */
  @ForOverride
  protected ListenableFuture<?> handleIncreaseDeviceVolume(@C.VolumeFlags int flags) {
    throw new IllegalStateException(
        "Missing implementation to handle COMMAND_ADJUST_DEVICE_VOLUME or"
            + " COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS");
  }

  /**
   * Handles calls to {@link Player#decreaseDeviceVolume()} and {@link
   * Player#decreaseDeviceVolume(int)}.
   *
   * <p>Will only be called if {@link Player#COMMAND_ADJUST_DEVICE_VOLUME} or {@link
   * Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS} is available.
   *
   * @param flags Either 0 or a bitwise combination of one or more {@link C.VolumeFlags}.
   * @return A {@link ListenableFuture} indicating the completion of all immediate {@link State}
   *     changes caused by this call.
   */
  @ForOverride
  protected ListenableFuture<?> handleDecreaseDeviceVolume(@C.VolumeFlags int flags) {
    throw new IllegalStateException(

View on GitHub (pinned to dd430f7053)

Solutions

  1. Override handleIncreaseDeviceVolume(@C.VolumeFlags int flags) and raise the device volume (e.g. AudioManager.adjustStreamVolume(STREAM_MUSIC, RAISE, flags)), returning an immediate future.
  2. Alternatively drop COMMAND_ADJUST_DEVICE_VOLUME(_WITH_FLAGS) from availableCommands so the increment call is ignored instead of throwing.
  3. Implement the whole volume-handler family (set/increase/decrease/mute) together whenever you advertise any device-volume command.

Example fix

// before
// availableCommands includes COMMAND_ADJUST_DEVICE_VOLUME, no override:

// after
@Override
protected ListenableFuture<?> handleIncreaseDeviceVolume(@C.VolumeFlags int flags) {
  audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, flags);
  return Futures.immediateVoidFuture();
}
Defensive patterns

Strategy: validation

Validate before calling

boolean canAdjust = player.isCommandAvailable(Player.COMMAND_ADJUST_DEVICE_VOLUME)
    || player.isCommandAvailable(Player.COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS);
if (canAdjust) checkOverrides(playerClass, "handleIncreaseDeviceVolume");

Prevention

When it happens

Trigger: Calling player.increaseDeviceVolume() on a custom SimpleBasePlayer whose State.availableCommands includes COMMAND_ADJUST_DEVICE_VOLUME or COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS without an override of handleIncreaseDeviceVolume.

Common situations: Forwarding UI volume-up key events to a custom player; enabling the full volume command group in a wrapper player around a cast or remote session while only implementing setDeviceVolume.

Related errors


AI-assisted analysis of google/ExoPlayer@dd430f7053 (2026-08-14). Data as JSON: /api/errors/58161e78c2a24015. Report an issue: GitHub.