: mapPlaybackState(player.getPlaybackState(), player.getPlayWhenReady()); if (customError != null) { builder.setErrorMessage(customError.first, customError.second); } else if (playbackError != null && errorMessageProvider != null) { Pair<Integer, String> message = errorMessageProvider.getErrorMessage(playbackError); builder.setErrorMessage(message.first, message.second);
@Override public void reportPlaybackStateChanged( @NonNull final PlaybackState state, @Nullable final CharSequence errorMessage) { @PlaybackStateCompat.State final int playbackState = toPlaybackStateCompat(state); final boolean isPlaying = playbackState == PlaybackStateCompat.STATE_PLAYING; final PlaybackStateCompat.Builder builder = new PlaybackStateCompat.Builder() .setActions(PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE | PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_STOP | PlaybackStateCompat.ACTION_SKIP_TO_NEXT | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SEEK_TO | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH) .setState(playbackState, 0, isPlaying ? 1 : 0); if (errorMessage != null) { builder.setErrorMessage(PlaybackStateCompat.ERROR_CODE_APP_ERROR, errorMessage); } mMediaSession.setPlaybackState(builder.build()); }
stateBuilder.setErrorMessage(error); state = PlaybackStateCompat.STATE_ERROR;