addBasicMediaListeners_(mediaElement, startTimeOfLoad) {
    const updateStateHistory = () => this.updateStateHistory_();
    const onRateChange = () => this.onRateChange_();
    this.loadEventManager_.listen(mediaElement, 'playing', updateStateHistory);
    this.loadEventManager_.listen(mediaElement, 'pause', updateStateHistory);
    this.loadEventManager_.listen(mediaElement, 'ended', updateStateHistory);
    this.loadEventManager_.listen(mediaElement, 'ratechange', onRateChange);
    if (mediaElement.remote) {
      this.loadEventManager_.listen(mediaElement.remote, 'connect', () => {
        if (this.streamingEngine_ &&
            mediaElement.remote.state == 'connected') {
          this.onTextChanged_();
        }
        this.onTracksChanged_();
      });
      this.loadEventManager_.listen(mediaElement.remote, 'connecting',
          () => this.onTracksChanged_());
      this.loadEventManager_.listen(mediaElement.remote, 'disconnect',
          async () => {
            if (this.streamingEngine_ &&
                mediaElement.remote.state == 'disconnected') {
              await this.streamingEngine_.resetMediaSource();
              this.onTextChanged_();
            }
            this.onTracksChanged_();
          });
    }
    if (mediaElement.audioTracks) {
      this.loadEventManager_.listen(mediaElement.audioTracks, 'addtrack',
          () => this.onTracksChanged_());
      this.loadEventManager_.listen(mediaElement.audioTracks, 'removetrack',
          () => this.onTracksChanged_());
      this.loadEventManager_.listen(mediaElement.audioTracks, 'change',
          () => this.onTracksChanged_());
    }
    if (mediaElement.videoTracks) {
      this.loadEventManager_.listen(mediaElement.videoTracks, 'addtrack',
          () => this.onTracksChanged_());
      this.loadEventManager_.listen(mediaElement.videoTracks, 'removetrack',
          () => this.onTracksChanged_());
      this.loadEventManager_.listen(mediaElement.videoTracks, 'change',
          () => this.onTracksChanged_());
    }
    if (mediaElement.webkitPresentationMode) {
      this.loadEventManager_.listen(mediaElement,
          'webkitpresentationmodechanged', () => {
            if (this.videoContainer_) {
              this.createAndConfigureTextDisplayer_(/* force= */ true);
            }
          });
    }

    if (mediaElement.textTracks) {
      const trackChange = () => {
        if (this.loadMode_ === shaka.Player.LoadMode.SRC_EQUALS &&
            this.textDisplayer_ instanceof shaka.text.NativeTextDisplayer) {
          this.onTextChanged_();
        }
        this.onTracksChanged_();
      };
      this.loadEventManager_.listen(
          mediaElement.textTracks, 'addtrack', (e) => {
            const trackEvent = /** @type {!TrackEvent} */(e);
            if (trackEvent.track) {
              const track = trackEvent.track;
              goog.asserts.assert(
                  track instanceof TextTrack, 'Wrong track type!');

              switch (track.kind) {
                case 'metadata':
                  this.processTimedMetadataSrcEquals_(track);
                  break;

                case 'chapters':
                  this.activateChaptersTrack_(track);
                  break;

                default:
                  trackChange();
                  break;
              }
            }
          });
      this.loadEventManager_.listen(mediaElement.textTracks, 'removetrack',
          trackChange);
      this.loadEventManager_.listen(mediaElement.textTracks, 'change',
          trackChange);

      if (this.config_.streaming.crossBoundaryStrategy !==
        shaka.config.CrossBoundaryStrategy.KEEP) {
        const forwardTimeForCrossBoundary = () => {
          if (!this.streamingEngine_) {
            return;
          }
          this.streamingEngine_.forwardTimeForCrossBoundary();
        };
        this.loadEventManager_.listen(mediaElement, 'waiting',
            () => forwardTimeForCrossBoundary());
        this.loadEventManager_.listen(mediaElement, 'timeupdate',
            () => forwardTimeForCrossBoundary());
      }
    }

    // Wait for the 'loadedmetadata' event to measure load() latency, but only
    // if preload is set in a way that would result in this event firing
    // automatically.
    // See https://github.com/shaka-project/shaka-player/issues/2483
    if (mediaElement.preload != 'none') {
      this.loadEventManager_.listenOnce(
          mediaElement, 'loadedmetadata', () => {
            const now = Date.now() / 1000;
            const delta = now - startTimeOfLoad;
            this.stats_.setLoadLatency(delta);
          });
    }
  }
Adds the basic media listeners

@param {HTMLMediaElement} mediaElement
@param {number} startTimeOfLoad
@private