static idForSegmentRef(ref) {
    const segmentData = ref.getSegmentData(/* allowDeleteOnSingleUse= */ false);
    if (segmentData) {
      return shaka.util.Uint8ArrayUtils.toBase64(segmentData);
    }
    // Escape the URIs using encodeURI, to make sure that a weirdly formed URI
    // cannot cause two unrelated refs to be considered equivalent.
    const removeSprites = (uri) => {
      return uri.split('#xywh=')[0];
    };
    return ref.getUris().map(
        (uri) => '{' + encodeURI(removeSprites(uri)) + '}').join('') +
        ':' + ref.startByte + ':' + ref.endByte;
  }
Creates an ID that encapsulates all important information in the ref, which
can then be used to check for equality.
@param {shaka.media.SegmentReference|shaka.media.InitSegmentReference} ref
@return {string}