selectTextTrack(track) {
    const selectMediaSourceMode = () => {
      const stream = this.manifest_.textStreams.find(
          (stream) => stream.id == track.id);

      if (!stream) {
        if (!this.isRemotePlayback()) {
          shaka.log.error('No stream with id', track.id);
        }
        return;
      }

      if (stream == this.streamingEngine_.getCurrentTextStream()) {
        shaka.log.debug('Text track already selected.');
        return;
      }

      // Add entries to the history.
      this.addTextStreamToSwitchHistory_(stream, /* fromAdaptation= */ false);
      this.streamingEngine_.switchTextStream(stream);
      this.onTextChanged_();
      this.setTextDisplayerLanguage_();

      // Workaround for
      // https://github.com/shaka-project/shaka-player/issues/1299
      // When track is selected, back-propagate the language to
      // currentTextLanguage_.
      this.currentTextLanguage_ = stream.language;
    };
    const selectSrcEqualsMode = () => {
      if (this.video_ && this.video_.textTracks) {
        const textTracks = this.getFilteredTextTracks_();
        const newTrack = textTracks.find((textTrack) =>
          shaka.util.StreamUtils.html5TrackId(textTrack) === track.id);
        if (!newTrack) {
          shaka.log.error('No track with id', track.id);
          return;
        }
        if (this.textDisplayer_ instanceof shaka.text.NativeTextDisplayer) {
          for (const texTrack of textTracks) {
            const mode = texTrack === newTrack ?
                this.isTextVisible_ ? 'showing' : 'hidden' :
                'disabled';
            if (texTrack.mode !== mode) {
              texTrack.mode = mode;
            }
          }
        } else {
          const oldTrack = textTracks.find((textTrack) =>
            textTrack.mode !== 'disabled');
          if (oldTrack !== newTrack) {
            if (oldTrack) {
              oldTrack.mode = 'disabled';
              this.loadEventManager_.unlisten(oldTrack, 'cuechange');
              this.textDisplayer_.remove(0, Infinity);
            }
            if (newTrack) {
              this.enableNativeTrack_(newTrack);
            }
          }
        }
        this.onTextChanged_();
        this.setTextDisplayerLanguage_();
      }
    };
    if (this.manifest_ && this.playhead_) {
      selectMediaSourceMode();
      // When using MSE + remote we need to set tracks for both MSE and native
      // apis so that synchronization is maintained.
      if (!this.isRemotePlayback()) {
        return;
      }
    }
    selectSrcEqualsMode();
  }
Select a specific text track. <code>track</code> should come from a call to
<code>getTextTracks</code>. If the track is not found, this will be a
no-op. If the player has not loaded content, this will be a no-op.

<p>
Note that <code>AdaptationEvents</code> are not fired for manual track
selections.

@param {shaka.extern.TextTrack} track
@export