@hyperframes/engine 0.8.213 → 0.8.214

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,7 @@ export interface ShownBox {
89
89
  }
90
90
  /**
91
91
  * Seeks to each of `times`; returns each video's largest drawn box in device pixels. Videos that are
92
- * graded, sampled by a canvas, `object-fit: none | scale-down` or never laid out get none (full size).
92
+ * graded (directly or through a grade group), sampled by a canvas, `object-fit: none | scale-down` or never laid out get none (full size).
93
93
  */
94
94
  export declare function measureVideoShownBoxes(page: Page, videoIds: readonly string[], times: readonly number[]): Promise<Map<string, ShownBox>>;
95
95
  /**
@@ -10,7 +10,7 @@ import { promises as fs } from "fs";
10
10
  import { touchCacheDir } from "./extractionCache.js";
11
11
  import { injectVideoFramesBatch, syncVideoFrameVisibility } from "./screenshotService.js";
12
12
  import { DEFAULT_CONFIG } from "../config.js";
13
- import { HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_CANVAS_ID_PREFIX, RENDER_FRAME_ID_PREFIX, RENDER_FRAME_ID_SUFFIX, renderFrameIdForRenderId, } from "@hyperframes/core";
13
+ import { HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_CANVAS_ID_PREFIX, HF_COLOR_GROUP_ATTR, HF_COLOR_GROUP_TAG, RENDER_FRAME_ID_PREFIX, RENDER_FRAME_ID_SUFFIX, renderFrameIdForRenderId, } from "@hyperframes/core";
14
14
  /**
15
15
  * Two-bound LRU keyed by frame path. Either bound triggers eviction of the
16
16
  * oldest entry — entry count protects against pathological many-tiny-frames
@@ -255,12 +255,12 @@ async function setVideoElementsVisibility(page, videoIds, visible) {
255
255
  }
256
256
  /**
257
257
  * Seeks to each of `times`; returns each video's largest drawn box in device pixels. Videos that are
258
- * graded, sampled by a canvas, `object-fit: none | scale-down` or never laid out get none (full size).
258
+ * graded (directly or through a grade group), sampled by a canvas, `object-fit: none | scale-down` or never laid out get none (full size).
259
259
  */
260
260
  export async function measureVideoShownBoxes(page, videoIds, times) {
261
261
  if (videoIds.length === 0 || times.length === 0)
262
262
  return new Map();
263
- const boxes = await page.evaluate(async (ids, seekTimes, gradingAttr, gradingCanvasPrefix) => {
263
+ const boxes = await page.evaluate(async (ids, seekTimes, gradingAttr, gradingCanvasPrefix, groupAttr, groupTag) => {
264
264
  const hf = window.__hf;
265
265
  if (typeof hf?.seek !== "function")
266
266
  return [];
@@ -268,8 +268,13 @@ export async function measureVideoShownBoxes(page, videoIds, times) {
268
268
  .__hfWaitForSeekCompletion;
269
269
  const largest = new Map();
270
270
  const fullSize = new Set();
271
+ const gradedThroughGroup = (video) => {
272
+ const groupId = video.getAttribute(groupAttr);
273
+ const group = groupId ? document.getElementById(groupId) : null;
274
+ return group?.localName === groupTag && group.hasAttribute(gradingAttr);
275
+ };
271
276
  const keepsFullSize = (video) => {
272
- if (video.hasAttribute(gradingAttr))
277
+ if (video.hasAttribute(gradingAttr) || gradedThroughGroup(video))
273
278
  return true;
274
279
  const fit = window.getComputedStyle(video).objectFit;
275
280
  return fit === "none" || fit === "scale-down";
@@ -297,7 +302,7 @@ export async function measureVideoShownBoxes(page, videoIds, times) {
297
302
  measure(id);
298
303
  }
299
304
  return Array.from(largest).filter(([id, box]) => !fullSize.has(id) && box.width > 0 && box.height > 0);
300
- }, [...videoIds], [...times], HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_CANVAS_ID_PREFIX);
305
+ }, [...videoIds], [...times], HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_CANVAS_ID_PREFIX, HF_COLOR_GROUP_ATTR, HF_COLOR_GROUP_TAG);
301
306
  return new Map(boxes);
302
307
  }
303
308
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/engine",
3
- "version": "0.8.213",
3
+ "version": "0.8.214",
4
4
  "description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,8 +54,8 @@
54
54
  "linkedom": "^0.18.12",
55
55
  "puppeteer": "~25.11.0",
56
56
  "puppeteer-core": "^25.11.0",
57
- "@hyperframes/core": "^0.8.213",
58
- "@hyperframes/parsers": "^0.8.213"
57
+ "@hyperframes/parsers": "^0.8.214",
58
+ "@hyperframes/core": "^0.8.214"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^25.0.10",