google/ExoPlayer · error · IllegalStateException
Missing implementation to handle COMMAND_SET_SPEED_AND_PITCH
Error message
Missing implementation to handle COMMAND_SET_SPEED_AND_PITCH
What it means
Default handler behind Player.setPlaybackParameters/setPlaybackSpeed in SimpleBasePlayer: it throws when COMMAND_SET_SPEED_AND_PITCH is advertised but handleSetPlaybackParameters(PlaybackParameters) is not overridden. The base class maps the public speed/pitch API onto this single handler.
Source
Thrown at library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java:3008
* changes caused by this call.
*/
@ForOverride
protected ListenableFuture<?> handleSetShuffleModeEnabled(boolean shuffleModeEnabled) {
throw new IllegalStateException("Missing implementation to handle COMMAND_SET_SHUFFLE_MODE");
}
/**
* Handles calls to {@link Player#setPlaybackParameters} or {@link Player#setPlaybackSpeed}.
*
* <p>Will only be called if {@link Player#COMMAND_SET_SPEED_AND_PITCH} is available.
*
* @param playbackParameters The requested {@link PlaybackParameters}.
* @return A {@link ListenableFuture} indicating the completion of all immediate {@link State}
* changes caused by this call.
*/
@ForOverride
protected ListenableFuture<?> handleSetPlaybackParameters(PlaybackParameters playbackParameters) {
throw new IllegalStateException("Missing implementation to handle COMMAND_SET_SPEED_AND_PITCH");
}
/**
* Handles calls to {@link Player#setTrackSelectionParameters}.
*
* <p>Will only be called if {@link Player#COMMAND_SET_TRACK_SELECTION_PARAMETERS} is available.
*
* @param trackSelectionParameters The requested {@link TrackSelectionParameters}.
* @return A {@link ListenableFuture} indicating the completion of all immediate {@link State}
* changes caused by this call.
*/
@ForOverride
protected ListenableFuture<?> handleSetTrackSelectionParameters(
TrackSelectionParameters trackSelectionParameters) {
throw new IllegalStateException(
"Missing implementation to handle COMMAND_SET_TRACK_SELECTION_PARAMETERS");
}
View on GitHub (pinned to dd430f7053)
Solutions
- Override handleSetPlaybackParameters(PlaybackParameters playbackParameters) and reflect the new parameters in State (fallback parameters too, if the backend clamps them).
- If speed/pitch control is unsupported, build availableCommands without COMMAND_SET_SPEED_AND_PITCH.
- Validate/clamp unreasonable speeds before forwarding to the backend.
Example fix
// before
// no override; UI calls setPlaybackSpeed(2f) -> throws
// after
@Override
protected ListenableFuture<?> handleSetPlaybackParameters(PlaybackParameters params) {
return updateStateAndNotify(
state.buildUpon().setPlaybackParameters(params).build());
} Defensive patterns
Strategy: validation
Validate before calling
if (!supportsSpeedAndPitch) commands.remove(Player.COMMAND_SET_SPEED_AND_PITCH);
Prevention
- Implement handleSetPlaybackParameters() or exclude COMMAND_SET_SPEED_AND_PITCH.
- Clamp speeds to a range your backend supports before applying.
- Test with the speed controls your UI exposes.
When it happens
Trigger: player.setPlaybackSpeed(1.5f) or setPlaybackParameters(new PlaybackParameters(1.2f, 0.95f)) on a SimpleBasePlayer subclass whose State includes COMMAND_SET_SPEED_AND_PITCH without a matching override.
Common situations: Custom players that play at fixed rate and never implement speed; speed controls in UI or MediaController (e.g. playback-control layout speed button) hitting the unimplemented command.
Related errors
- Missing implementation to handle COMMAND_PLAY_PAUSE
- Missing implementation to handle COMMAND_PREPARE
- Missing implementation to handle COMMAND_STOP
- Missing implementation to handle COMMAND_RELEASE
- Missing implementation to handle COMMAND_SET_REPEAT_MODE
AI-assisted analysis of google/ExoPlayer@dd430f7053 (2026-08-14).
Data as JSON: /api/errors/b9edaadefd17ee78.
Report an issue: GitHub.