selectAudioTrack(audioTrack, safeMargin = 0) {
    const selectMediaSourceMode = () => {
      const config =
          this.currentAdaptationSetCriteria_.getConfiguration();
      config.audioCodec = audioTrack.codecs || '';
      config.audioLabel = audioTrack.label || '';
      config.channelCount = audioTrack.channelsCount || 0;
      config.language = audioTrack.language;
      config.role = audioTrack.roles[0] || '';
      config.spatialAudio = audioTrack.spatialAudio;
      this.currentAdaptationSetCriteria_.configure(config);
      this.chooseVariantAndSwitch_(
          /* clearBuffer= */ true, /* safeMargin= */ safeMargin,
          /* force= */ false, /* fromAdaptation= */ false);
    };
    const selectSrcEqualsMode = () => {
      if (this.video_ && this.video_.audioTracks) {
        const audioTracks = Array.from(this.video_.audioTracks);
        let trackMatch = null;
        for (const track of audioTracks) {
          if (track.label == audioTrack.label &&
              track.language == audioTrack.language &&
              track.kind == audioTrack.roles[0]) {
            trackMatch = track;
            break;
          }
        }
        if (trackMatch) {
          this.switchHtml5Track_(trackMatch);
        }
      }
    };
    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 an audio track compatible with the current video track.
If the player has not loaded any content, this will be a no-op.

@param {shaka.extern.AudioTrack} audioTrack
@param {number=} safeMargin Optional amount of buffer (in seconds) to
  retain when clearing the buffer. Useful for switching quickly
  without causing a buffering event. Defaults to 0 if not provided. Can
  cause hiccups on some browsers if chosen too small, e.g. The amount of
  two segments is a fair minimum to consider as safeMargin value.
@export