chore(deps): unpin ovenplayer (0.10.51 media-captions crashes under vitest/SSR) #237

Closed
opened 2026-06-17 20:40:21 +00:00 by spikerj · 1 comment
Owner

ovenplayer was reverted from 0.10.51 to 0.10.50 and pinned exact (no caret) to unblock the deploy pipeline.

Problem

ovenplayer@0.10.51 bundles a media-captions build that throws at import time under the vitest/jsdom environment:

TypeError: Class extends value undefined is not a constructor or null
  ovenplayer/dist/.../node_modules/media-captions/dist/prod/index.js:15:9

stream.component.ts does a static import OvenPlayer from "ovenplayer", so loading the component crashes stream.component.spec, fails spikersoft:test, and blocks the build_and_publish_frontend deploy job. The production nx build passed, but the same import-time Class extends undefined is a latent SSR risk (@angular/ssr / platform-server) where the component may be evaluated on the server.

Introduced by the #230 app-runtime roll-up (ovenplayer 0.10.50 → 0.10.51).

Work required

  • Investigate the 0.10.51 media-captions ESM/CJS interop issue (likely a default-export/__esModule interop problem under Vite/jsdom).
  • Options: lazy-load OvenPlayer (dynamic import() on the client only), add a vitest-safe shim/mock, or wait for an ovenplayer patch that fixes the bundled media-captions.
  • Once resolved, remove the exact pin, restore ^0.10.5x, regenerate the lockfile.
  • Verify: pnpm run test-all green AND SSR render of the stream page works.

Context

Fix landed in spikersoft-angular (hotfix branch fix/ovenplayer-revert-test-regression).

`ovenplayer` was reverted from `0.10.51` to **`0.10.50`** and pinned exact (no caret) to unblock the deploy pipeline. ## Problem `ovenplayer@0.10.51` bundles a `media-captions` build that throws at **import time** under the vitest/jsdom environment: ``` TypeError: Class extends value undefined is not a constructor or null ovenplayer/dist/.../node_modules/media-captions/dist/prod/index.js:15:9 ``` `stream.component.ts` does a static `import OvenPlayer from "ovenplayer"`, so loading the component crashes `stream.component.spec`, fails `spikersoft:test`, and blocks the `build_and_publish_frontend` deploy job. The production `nx build` passed, but the same import-time `Class extends undefined` is a latent **SSR risk** (`@angular/ssr` / platform-server) where the component may be evaluated on the server. Introduced by the #230 app-runtime roll-up (`ovenplayer 0.10.50 → 0.10.51`). ## Work required - Investigate the 0.10.51 `media-captions` ESM/CJS interop issue (likely a default-export/`__esModule` interop problem under Vite/jsdom). - Options: lazy-load OvenPlayer (dynamic `import()` on the client only), add a vitest-safe shim/mock, or wait for an ovenplayer patch that fixes the bundled media-captions. - Once resolved, remove the exact pin, restore `^0.10.5x`, regenerate the lockfile. - Verify: `pnpm run test-all` green AND SSR render of the stream page works. ## Context Fix landed in spikersoft-angular (hotfix branch `fix/ovenplayer-revert-test-regression`).
Author
Owner

Resolved in spikersoft-angular PR #164 (merged to master). Finding first: ovenplayer 0.10.52 (latest) still ships the broken media-captions bundle — same 'Class extends value undefined' import-time crash as 0.10.51 — so waiting upstream was a dead end. Implemented the ticket's robust option instead: stream.component uses a type-only import + dynamic import() in ngAfterViewInit, so the module only evaluates in a real browser; a try/catch leaves the player absent (with tracking) instead of killing the page on chunk-load failure, and a destroyed-guard covers teardown during the await. This also closes the latent @angular/ssr risk the ticket flagged. Pin removed: 0.10.50 exact → ^0.10.52, lockfile regenerated. nx test spikersoft 1871/1871 with zero unhandled errors (the 0.10.52 bump alone still crashed the spec — reproduced before the fix). Post-deploy sanity: /stream still plays (WebRTC→HLS fallback unchanged; only module loading moved). With this, all four deferred-deps tickets from the #229/#230 roll-ups (#234, #235, #236, #237) are done or re-scoped. Closing.

Resolved in spikersoft-angular PR #164 (merged to master). Finding first: ovenplayer 0.10.52 (latest) still ships the broken media-captions bundle — same 'Class extends value undefined' import-time crash as 0.10.51 — so waiting upstream was a dead end. Implemented the ticket's robust option instead: stream.component uses a type-only import + dynamic import() in ngAfterViewInit, so the module only evaluates in a real browser; a try/catch leaves the player absent (with tracking) instead of killing the page on chunk-load failure, and a destroyed-guard covers teardown during the await. This also closes the latent @angular/ssr risk the ticket flagged. Pin removed: 0.10.50 exact → ^0.10.52, lockfile regenerated. nx test spikersoft 1871/1871 with zero unhandled errors (the 0.10.52 bump alone still crashed the spec — reproduced before the fix). Post-deploy sanity: /stream still plays (WebRTC→HLS fallback unchanged; only module loading moved). With this, all four deferred-deps tickets from the #229/#230 roll-ups (#234, #235, #236, #237) are done or re-scoped. Closing.
Sign in to join this conversation.