code: public void invokeErrorListener(int what, int extra) {
      // Calling doStop() un-schedules the next event and
      // stops normal event flow from continuing.
      doStop();
      state = ERROR;
      boolean handled = errorListener != null
          && errorListener.onError(player, what, extra);
      if (!handled) {
        // The documentation isn't very clear if onCompletion is
        // supposed to be called from non-playing states
        // (ie, states other than STARTED or PAUSED). Testing
        // revealed that onCompletion is invoked even if playback
        // hasn't started or is not in progress.
        invokeCompletionListener();
        // Need to set this again because
        // invokeCompletionListener() will set the state
        // to PLAYBACK_COMPLETED
        state = ERROR;
      }
    }
docs: Allows test cases to directly simulate invocation of the OnError event.
  
  @param what
  parameter to pass in to {@code what} in
  {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)}.
  @param extra
  parameter to pass in to {@code extra} in
  {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)}.