useSegmentTemplate(template, segmentDuration, segmentSize = null) {
    goog.asserts.assert(this.manifest_,
        'A top-level generated Manifest is required to use this method!');
    goog.asserts.assert(
        segmentDuration, 'Must pass a non-zero segment duration');

    const shaka_ = this.manifest_.shaka_;
    let totalDuration = this.manifest_.presentationTimeline.getDuration();
    goog.asserts.assert(
        isFinite(totalDuration), 'Must specify a manifest duration');
    if (!isFinite(totalDuration)) {
      // Without this, a mistake of an infinite duration would result in an
      // infinite loop and a crash, which would in turn prevent you from seeing
      // the above assertion fail.
      totalDuration = 0;
    }

    const segmentCount = totalDuration / segmentDuration;
    const references = [];

    for (let index = 0; index < segmentCount; index++) {
      const getUris = () => [sprintf(template, index)];
      const start = index * segmentDuration;
      const end = Math.min(totalDuration, (index + 1) * segmentDuration);
      references.push(new shaka_.media.SegmentReference(
          /* startTime= */ start,
          /* endTime= */ end,
          getUris,
          /* startByte= */ 0,
          /* endByte= */ segmentSize,
          this.initSegmentReference_,
          /* timestampOffset= */ 0,
          /* appendWindowStart= */ 0,
          /* appendWindowEnd= */ totalDuration));
    }
    this.segmentIndex = new shaka_.media.SegmentIndex(references);
    return this;
  }
Sets the current stream to use segment template to create segments.

@param {string} template An sprintf template that will take the segment
  index and give a URI.
@param {number} segmentDuration
@param {?number=} segmentSize
@return {shaka.test.ManifestGenerator.Stream}