Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
70 lines
3.8 KiB
TypeScript
70 lines
3.8 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { MOVE_EVERY_MS, markOf, markSpot, playerChrome, untilNextMove } from "../src/player/viewer-mark";
|
|
import * as web from "../../web/src/features/ott-player/viewer-mark";
|
|
import * as receiver from "../cast-receiver/mark.js";
|
|
|
|
const T0 = 1_800_000_000_000 - (1_800_000_000_000 % MOVE_EVERY_MS);
|
|
|
|
describe("viewer code on the phone and TV player (QM1.5)", () => {
|
|
it("moves on a 30 s beat and stays inside the picture", () => {
|
|
const a = markSpot("AB12CD34", T0);
|
|
expect(markSpot("AB12CD34", T0 + MOVE_EVERY_MS - 1)).toEqual(a);
|
|
const spots = new Set(Array.from({ length: 6 }, (_, n) => JSON.stringify(markSpot("AB12CD34", T0 + n * MOVE_EVERY_MS))));
|
|
expect(spots.size).toBeGreaterThan(3);
|
|
for (let n = 0; n < 200; n += 1) {
|
|
const s = markSpot("AB12CD34", T0 + n * MOVE_EVERY_MS);
|
|
expect(s.left).toBeGreaterThanOrEqual(8);
|
|
expect(s.left).toBeLessThan(78);
|
|
expect(s.top).toBeGreaterThanOrEqual(8);
|
|
expect(s.top).toBeLessThan(84);
|
|
}
|
|
expect(untilNextMove(T0 + 1000)).toBe(MOVE_EVERY_MS - 1000);
|
|
expect(untilNextMove(T0)).toBe(MOVE_EVERY_MS);
|
|
});
|
|
|
|
it("draws the same spot as the web player and the cast receiver", () => {
|
|
expect(MOVE_EVERY_MS).toBe(web.MOVE_EVERY_MS);
|
|
expect(MOVE_EVERY_MS).toBe(receiver.MOVE_EVERY_MS);
|
|
for (const mark of ["AB12CD34", "00000000", "ZZ9XY8W7"]) {
|
|
for (let n = 0; n < 40; n += 1) {
|
|
const at = T0 + n * 7_919_000;
|
|
expect(markSpot(mark, at)).toEqual(web.markSpot(mark, at));
|
|
expect(markSpot(mark, at)).toEqual(receiver.markSpot(mark, at));
|
|
expect(untilNextMove(at)).toBe(web.untilNextMove(at));
|
|
}
|
|
}
|
|
});
|
|
|
|
it("shows the code on a paid title and nothing on a free one", () => {
|
|
const base = { manifest_url: "https://api.example/ott/stream/tok/master.m3u8", expires_at: 1, session_id: "s" };
|
|
expect(markOf({ ...base, protected: true, viewer_mark: "AB12CD34" })).toBe("AB12CD34");
|
|
expect(markOf({ ...base, protected: false, viewer_mark: "AB12CD34" })).toBe("");
|
|
expect(markOf({ ...base, protected: false })).toBe("");
|
|
expect(markOf({ ...base, protected: true })).toBe("");
|
|
expect(markOf({ ...base, protected: true, viewer_mark: "<b>x</b>" })).toBe("");
|
|
expect(markOf(null)).toBe("");
|
|
expect(receiver.markOf({ protected: true, viewer_mark: "AB12CD34" })).toBe("AB12CD34");
|
|
expect(receiver.markOf({ protected: false, viewer_mark: "AB12CD34" })).toBe("");
|
|
});
|
|
|
|
it("keeps the code on screen in fullscreen: our fullscreen, no native fullscreen or PiP, for paid titles", () => {
|
|
expect(playerChrome({ mark: "AB12CD34", tv: false })).toEqual({ nativeFullscreen: false, pictureInPicture: false, ownFullscreen: true });
|
|
expect(playerChrome({ mark: "", tv: false })).toEqual({ nativeFullscreen: true, pictureInPicture: true, ownFullscreen: false });
|
|
expect(playerChrome({ mark: "AB12CD34", tv: true }).pictureInPicture).toBe(false);
|
|
});
|
|
|
|
it("the player draws the code inside the picture frame, untouchable and hidden from screen readers", () => {
|
|
const player = readFileSync(join(__dirname, "../src/player/WatchPlayer.tsx"), "utf8");
|
|
const frame = player.slice(player.indexOf("const picture = ("), player.indexOf("return (", player.indexOf("const picture = (")));
|
|
expect(frame).toContain("<VideoView");
|
|
expect(frame).toContain("<ViewerMark mark={mark} />");
|
|
expect(player).toMatch(/<Modal[\s\S]*?\}>\s*<View style=\{styles\.full\}>\{picture\}<\/View>/);
|
|
const mark = readFileSync(join(__dirname, "../src/player/ViewerMark.tsx"), "utf8");
|
|
expect(mark).toContain('pointerEvents="none"');
|
|
expect(mark).toContain("accessibilityElementsHidden");
|
|
expect(mark).toContain('importantForAccessibility="no-hide-descendants"');
|
|
});
|
|
});
|