google/ExoPlayer · error · IllegalStateException
Missing implementation to handle COMMAND_SET_TRACK_SELECTION
Error message
Missing implementation to handle COMMAND_SET_TRACK_SELECTION_PARAMETERS
What it means
Default handler for Player.setTrackSelectionParameters(...) in SimpleBasePlayer: IllegalStateException when COMMAND_SET_TRACK_SELECTION_PARAMETERS is available but handleSetTrackSelectionParameters(TrackSelectionParameters) is not overridden in the subclass.
Source
Thrown at library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java:3023
*/
@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");
}
/**
* Handles calls to {@link Player#setPlaylistMetadata}.
*
* <p>Will only be called if {@link Player#COMMAND_SET_PLAYLIST_METADATA} is available.
*
* @param playlistMetadata The requested {@linkplain MediaMetadata playlist metadata}.
* @return A {@link ListenableFuture} indicating the completion of all immediate {@link State}
* changes caused by this call.
*/
@ForOverride
protected ListenableFuture<?> handleSetPlaylistMetadata(MediaMetadata playlistMetadata) {
throw new IllegalStateException(
"Missing implementation to handle COMMAND_SET_PLAYLIST_METADATA");
}
View on GitHub (pinned to dd430f7053)
Solutions
- Override handleSetTrackSelectionParameters(...) to merge the parameters into your State via state.buildUpon().setTrackSelectionParameters(...).
- If track selection is fixed, remove COMMAND_SET_TRACK_SELECTION_PARAMETERS from the State's commands so calls become inert and the UI hides the controls.
- Consider intersecting requested overrides with what your backend can actually honor.
Example fix
// before
// no override; settings screen calls setTrackSelectionParameters -> throws
// after
@Override
protected ListenableFuture<?> handleSetTrackSelectionParameters(
TrackSelectionParameters trackSelectionParameters) {
return updateStateAndNotify(
state.buildUpon().setTrackSelectionParameters(trackSelectionParameters).build());
} Defensive patterns
Strategy: validation
Validate before calling
if (!supportsTrackSelection) commands.remove(Player.COMMAND_SET_TRACK_SELECTION_PARAMETERS);
Prevention
- Implement handleSetTrackSelectionParameters() or exclude the command.
- Merge (not replace) parameters if your player only honors a subset.
- Trigger the command from your app's settings screen in tests.
When it happens
Trigger: player.setTrackSelectionParameters(defaults.buildUpon().setMaxAudioBitrate(...).build()) — common in settings screens — on a SimpleBasePlayer subclass missing the override while the command is in availableCommands.
Common situations: Apps with audio/video preference screens calling setTrackSelectionParameters; MediaController track-selection commands forwarded to a custom player.
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/7069ee957c9ddb4d.
Report an issue: GitHub.