trun_(streamInfo, offset) {
    const ContentType = shaka.util.ManifestParserUtils.ContentType;
    const Mp4Generator = shaka.util.Mp4Generator;

    const samples = streamInfo.data ? streamInfo.data.samples : [];
    const samplesLength = samples.length;
    const bytesLen = 12 + 16 * samplesLength;
    const bytes = new Uint8Array(bytesLen);
    offset += 8 + bytesLen;
    const isVideo = streamInfo.type === ContentType.VIDEO;
    bytes.set(
        [
        // version 1 for video with signed-int sample_composition_time_offset
        isVideo ? 0x01 : 0x00,
        0x00, 0x0f, 0x01, // flags
        ...this.breakNumberIntoBytes_(samplesLength, 4), // sample_count
        ...this.breakNumberIntoBytes_(offset, 4), // data_offset
        ],
        0,
    );
    for (let i = 0; i < samplesLength; i++) {
      const sample = samples[i];
      const duration = this.breakNumberIntoBytes_(sample.duration, 4);
      const size = this.breakNumberIntoBytes_(sample.size, 4);
      const flags = sample.flags;
      const cts = this.breakNumberIntoBytes_(sample.cts, 4);
      bytes.set(
          [
            ...duration, // sample_duration
            ...size, // sample_size
            (flags.isLeading << 2) | flags.dependsOn,
            (flags.isDependedOn << 6) | (flags.hasRedundancy << 4) |
              flags.isNonSync,
            flags.degradPrio & (0xf0 << 8),
            flags.degradPrio & 0x0f, // sample_flags
            ...cts, // sample_composition_time_offset
          ],
          12 + 16 * i,
      );
    }
    return Mp4Generator.box('trun', bytes);
  }
Generate a TRUN box

@param {shaka.util.Mp4Generator.StreamInfo} streamInfo
@param {number} offset
@return {!Uint8Array}
@private