mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-15 13:58:20 +00:00
Adds the 25 video primitive compositions and their generated Mintlify pages. Each page embeds a live <hyperframes-player> preview with editable composition variables rather than a rendered MP4. Adds the catalog-browsing eval under evals/catalog-retrieval: a 424-entry shelf built from HEAD, nine retrieval conditions (no-catalog control, full read, lexical, semantic, and hybrid across several values of k), a brief generator that constructs each brief from a known target, a blind three-pass gold validation committee, and a mechanical scorer that keeps mountable and fit as two separate numbers. The eval vendors its own shelf, primitive sources, and preview list instead of reading them from an ignored working directory, so the shelf regenerates byte for byte from a clean checkout. Derived artifacts stay out: the embedding cache and the run checkpoints are regenerated rather than committed, so no run can score against a stale copy of either. Lint ignores now cover vendored minified player bundles by pattern instead of one path at a time.
62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
// QA gallery only: autoplay + loop each hyperframes-player when it scrolls into
|
|
// view, pause when off-screen. Lets every candidate be watched without manually
|
|
// scrubbing 78 players, while keeping only the visible ones running so the page
|
|
// stays smooth. Not shipped; QA surface only.
|
|
(function () {
|
|
// Mintlify auto-loads every root-level .js in docs/ on every page. Autoplaying
|
|
// every player on the real documentation is not wanted, and the QA harnesses
|
|
// are standalone .html files while doc routes never end in .html.
|
|
if (!location.pathname.endsWith(".html")) return;
|
|
|
|
function wire(p) {
|
|
if (p.__hfLoopWired) return;
|
|
p.__hfLoopWired = true;
|
|
p.setAttribute("loop", "");
|
|
// The native loop attribute does not reliably restart every composition
|
|
// (some freeze on their end frame, e.g. an OUT phase that clears the stage),
|
|
// so force it: the player exposes restart() = seek(0)+play().
|
|
p.addEventListener("ended", function () {
|
|
if (typeof p.restart === "function") {
|
|
try {
|
|
p.restart();
|
|
} catch {}
|
|
} else {
|
|
try {
|
|
if (typeof p.seek === "function") p.seek(0);
|
|
if (typeof p.play === "function") p.play();
|
|
} catch {}
|
|
}
|
|
});
|
|
var io = new IntersectionObserver(
|
|
function (entries) {
|
|
entries.forEach(function (e) {
|
|
if (e.isIntersecting) {
|
|
p.setAttribute("autoplay", "");
|
|
if (typeof p.play === "function") {
|
|
try {
|
|
p.play();
|
|
} catch {}
|
|
}
|
|
} else if (typeof p.pause === "function") {
|
|
try {
|
|
p.pause();
|
|
} catch {}
|
|
}
|
|
});
|
|
},
|
|
{ threshold: 0.3 },
|
|
);
|
|
io.observe(p);
|
|
}
|
|
function scan() {
|
|
document.querySelectorAll("hyperframes-player").forEach(wire);
|
|
}
|
|
if (!("customElements" in window)) return;
|
|
customElements.whenDefined("hyperframes-player").then(function () {
|
|
scan();
|
|
new MutationObserver(scan).observe(document.body, { childList: true, subtree: true });
|
|
setTimeout(scan, 800);
|
|
setTimeout(scan, 2500);
|
|
});
|
|
})();
|