function findVariant(variants, audioId, videoId) {
    for (const variant of variants) {
      /** @type {?shaka.extern.Stream} */
      const audio = variant.audio;
      /** @type {?shaka.extern.Stream} */
      const video = variant.video;

      /** @type {boolean } */
      const audioMatch = audio ? audioId == audio.id : audioId == null;
      /** @type {boolean } */
      const videoMatch = video ? videoId == video.id : videoId == null;

      if (audioMatch && videoMatch) {
        return variant;
      }
    }

    return null;
  }
@param {!Array<shaka.extern.Variant>} variants
@param {?number} audioId
@param {?number} videoId
@return {?shaka.extern.Variant}