async getChaptersAsync(language) {
    if (!this.externalChaptersStreams_.length) {
      return [];
    }
    const LanguageUtils = shaka.util.LanguageUtils;
    const inputLanguage = LanguageUtils.normalize(language);
    const chapterStreams = this.externalChaptersStreams_
        .filter((c) => LanguageUtils.normalize(c.language) == inputLanguage);
    if (!chapterStreams.length) {
      return [];
    }
    const chapters = [];
    const uniqueChapters = new Set();
    for (const chapterStream of chapterStreams) {
      if (!chapterStream.segmentIndex) {
        // eslint-disable-next-line no-await-in-loop
        await chapterStream.createSegmentIndex();
      }
      chapterStream.segmentIndex.forEachTopLevelReference((ref) => {
        const title = ref.getUris()[0];
        const id = ref.startTime + '-' + ref.endTime + '-' + title;
        /** @type {shaka.extern.Chapter} */
        const chapter = {
          id,
          title,
          startTime: ref.startTime,
          endTime: ref.endTime,
        };
        if (!uniqueChapters.has(id)) {
          chapters.push(chapter);
          uniqueChapters.add(id);
        }
      });
    }
    return chapters;
  }
This returns the list of chapters.

@param {string} language
@return {!Promise<!Array<shaka.extern.Chapter>>}
@export