function calculateReadyState(buffers, time) {
      // See: https://bit.ly/2JYh8WX
      for (const buffer of buffers) {
        if (time >= buffer.start) {
          if (time == buffer.end) {
            // The video has the current frame, but no data in the future.
            return HTMLMediaElement.HAVE_CURRENT_DATA;
          } else if (time < buffer.end) {
            // The video has enough data to play forward.
            return HTMLMediaElement.HAVE_ENOUGH_DATA;
          }
        }
      }
      // The video doesn't have any video data.
      return HTMLMediaElement.HAVE_METADATA;
    }
@param {!Array<{start: number, end: number}>} buffers
@param {number} time
@return {number}