Repository navigation
feat(spf): speak moqt-22 through @caprid/moq-core - #75
Conversation
The player's MOQT codec and session driver now come from @caprid/moq-core 0.1.1, the package extracted from network/moqt, and the local modules and their tests are deleted. The session actor offers moqt-22 first with moqt-20 as the fallback, and the core reads the negotiated WebTransport protocol to pick its LOCATION_FILTER codec. A browser without WebTransport.protocol offers moqt-22 only. The fake relays in the tests re-export the package's unexported relay-side codec from one helper instead of keeping a second copy. Transport section citations follow draft-22 numbering. @caprid/moq-media moves to ^0.1.1 alongside. Claude-Session: https://claude.ai/code/session_01DaH4ieYHRP2Agar6P9KSCB
Replaces the vendored draft-20 text with draft-22 and updates the specs README: revision table, checksum, and the sentence that said the protocol pin lives in network/moqt. The publishing guide, the sandbox relay comments and the plans now point at @caprid/moq-core and draft-22. Claude-Session: https://claude.ai/code/session_01DaH4ieYHRP2Agar6P9KSCB
moq-media 0.1.1 decodes every Opus input with WebAssembly libopus by default for packet-loss concealment. That decoder is single-stream and ignores the OpusHead channel mapping, so a multistream track the catalog allows (channelConfig above stereo, with init data) would decode as noise. The default player factory turns lossConcealment off, which keeps the WebCodecs path #72 shipped with. Claude-Session: https://claude.ai/code/session_01DaH4ieYHRP2Agar6P9KSCB
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
📦 Bundle Size Report🎨 @videojs/html
Presets (7)
Media (19)
Players (5)
Skins (29)
UI Components (62)
⚛️ @videojs/react — no changesPresets (7)
Media (22)
Extensions (2)
Players (5)
Skins (18)
UI Components (39)
🧩 @videojs/core — no changesEntries (76)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (13)
📦 @videojs/cdn — no changes📦 @videojs/cloudflare-video — no changes📦 @videojs/dash-video — no changes📦 @videojs/google-cast — no changes📦 @videojs/hlsjs-video — no changes📦 @videojs/media — no changesEntries (3)
📦 @videojs/mux — no changes📦 @videojs/mux-audio — no changesEntries (2)
📦 @videojs/mux-data — no changes📦 @videojs/mux-video — no changesEntries (2)
📦 @videojs/native-hls-video — no changes📦 @videojs/shaka-video — no changes📦 @videojs/spf
Entries (8)
📦 @videojs/spotify-audio — no changes📦 @videojs/tiktok-video — no changes📦 @videojs/twitch-video — no changes📦 @videojs/other — no changesEntries (3)
📦 @videojs/vimeo-video — no changes📦 @videojs/wistia-video — no changesEntries (2)
📦 @videojs/youtube-video — no changesℹ️ How to interpretEach entry is independently bundled, minified, and brotli-compressed. Initial size includes its static import graph; lazy dynamic chunks are reported separately. Entries are not additive because their dependency graphs overlap. Preset rows represent realistic combined bundles. Changes of 300 B or less across initial, lazy, and total size are collapsed, not discarded. Run |
There was a problem hiding this comment.
6 issues found across 36 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/spf/package.json">
<violation number="1" location="packages/spf/package.json:82">
P2: `@caprid/moq-core` and `@caprid/moq-media` 0.1.1 declare `engines: node >=24` in the lockfile, but the root `engines` still allows `>=22.19.0`. Either raise the root `engines` floor to match, or confirm that Node 22 consumers of the workspace will not install or build these packages.</violation>
</file>
<file name=".agents/plans/moq-transport-20-migration.md">
<violation number="1" location=".agents/plans/moq-transport-20-migration.md:21">
P3: This migration plan is explicitly superseded, so retaining its draft-20 checklist leaves stale instructions in the repository. Delete `.agents/plans/moq-transport-20-migration.md` before merging.</violation>
</file>
<file name=".agents/plans/moq-engine-implementation.md">
<violation number="1" location=".agents/plans/moq-engine-implementation.md:12">
P3: This temporary implementation plan should not remain in the repository after the implementation lands. Delete `.agents/plans/moq-engine-implementation.md` before merging, as required by `.agents/plans/README.md`.</violation>
</file>
<file name="apps/sandbox/templates/spf-moq-player/loopback-relay.ts">
<violation number="1" location="apps/sandbox/templates/spf-moq-player/loopback-relay.ts:5">
P3: The sandbox UI still says the default loopback relay speaks draft-20, contradicting this draft-22 update. Update `index.html` so the user-facing description matches the relay.</violation>
<violation number="2" location="apps/sandbox/templates/spf-moq-player/loopback-relay.ts:48">
P3: The draft-22 vi64 comment omits the 9-byte, 64-bit form, and `varintByteLength` still caps encodings at 8 bytes. Add draft-22’s 9-byte encoding support before claiming full draft-22 wire coverage.</violation>
<violation number="3" location="apps/sandbox/templates/spf-moq-player/loopback-relay.ts:687">
P3: Section 6.4.2.3 does not define FIN as cancellation; it explicitly distinguishes FIN from RESET_STREAM/STOP_SENDING cancellation. Describe the `done` branch as graceful stream completion and leave cancellation to the catch path.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| }, | ||
| "dependencies": { | ||
| "@caprid/moq-media": "^0.1.0", | ||
| "@caprid/moq-core": "^0.1.1", |
There was a problem hiding this comment.
P2: @caprid/moq-core and @caprid/moq-media 0.1.1 declare engines: node >=24 in the lockfile, but the root engines still allows >=22.19.0. Either raise the root engines floor to match, or confirm that Node 22 consumers of the workspace will not install or build these packages.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/spf/package.json, line 82:
<comment>`@caprid/moq-core` and `@caprid/moq-media` 0.1.1 declare `engines: node >=24` in the lockfile, but the root `engines` still allows `>=22.19.0`. Either raise the root `engines` floor to match, or confirm that Node 22 consumers of the workspace will not install or build these packages.</comment>
<file context>
@@ -79,7 +79,8 @@
},
"dependencies": {
- "@caprid/moq-media": "^0.1.0",
+ "@caprid/moq-core": "^0.1.1",
+ "@caprid/moq-media": "^0.1.1",
"@videojs/media": "workspace:*",
</file context>
There was a problem hiding this comment.
Won't fix. The same engines: node >=24 mismatch was accepted for @caprid/moq-media in #72, and moq-core only adds the same constraint.
| @@ -18,6 +18,13 @@ the spec text is ambiguous, and calls out each place it does. | |||
|
|
|||
There was a problem hiding this comment.
P3: This migration plan is explicitly superseded, so retaining its draft-20 checklist leaves stale instructions in the repository. Delete .agents/plans/moq-transport-20-migration.md before merging.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .agents/plans/moq-transport-20-migration.md, line 21:
<comment>This migration plan is explicitly superseded, so retaining its draft-20 checklist leaves stale instructions in the repository. Delete `.agents/plans/moq-transport-20-migration.md` before merging.</comment>
<file context>
@@ -18,6 +18,13 @@ the spec text is ambiguous, and calls out each place it does.
Temporary implementation notes — delete before merge per `AGENTS.md`.
+**Superseded on the player (2026-10-27):** `mmcc/moq` now takes its transport
+from `@caprid/moq-core`, which was extracted from `network/moqt/`. It offers
+`moqt-22` first and falls back to `moqt-20`. The local modules this plan
</file context>
There was a problem hiding this comment.
Won't fix. The MoQ plan files are kept on these integration branches deliberately. This one is marked superseded on the player instead.
| @@ -9,7 +9,7 @@ plan, and what Phase 0/5 still owes. | |||
| | Plan item | Status | Where | | |||
There was a problem hiding this comment.
P3: This temporary implementation plan should not remain in the repository after the implementation lands. Delete .agents/plans/moq-engine-implementation.md before merging, as required by .agents/plans/README.md.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .agents/plans/moq-engine-implementation.md, line 12:
<comment>This temporary implementation plan should not remain in the repository after the implementation lands. Delete `.agents/plans/moq-engine-implementation.md` before merging, as required by `.agents/plans/README.md`.</comment>
<file context>
@@ -9,7 +9,7 @@ plan, and what Phase 0/5 still owes.
|---|---|---|
| §5 type-model change | ✅ | `media/types` — `TrackDeliveryMode` + `LiveOf<T>` (extends `PartiallyResolved<T>`, zero HLS ripple; audit confirmed selection reads only metadata) |
-| Phase 1 wire protocol | ✅ | `network/moqt/` — vi64 varint, control messages, request streams, object streams, session driver; 51 tests incl. spec Table 2 golden vectors |
+| Phase 1 wire protocol | ✅ | Was `network/moqt/` (vi64 varint, control messages, request streams, object streams, session driver; 51 tests incl. spec Table 2 golden vectors). Since 2026-10-27 the player uses `@caprid/moq-core`, the package extracted from it |
| Phase 2 format layer | ✅ | `media/moq/` — parse-source (msf: fragment), parse-catalog (independent + delta), loc, codec-mapping, timeline; 46 tests |
| Phase 3 actors/behaviors | ✅ | `playback/actors/{moq-session,track-subscriber}`, `playback/actors/dom/{video,audio}-renderer`, `playback/behaviors/{setup-moq-session,resolve-catalog,subscribe-selected-tracks,sync-latency,track-moq-bandwidth}`, `behaviors/dom/setup-moq-renderers` |
</file context>
There was a problem hiding this comment.
Won't fix, for the same reason: the MoQ plan files are kept on these integration branches deliberately.
| * | ||
| * There is no public relay that serves draft-ietf-moq-msf-01 catalogs yet (Phase 0 interop is still owed), so this | ||
| * stands in for one: it speaks real draft-20 bytes over an in-memory `MoqtTransport` and publishes real | ||
| * stands in for one: it speaks real draft-22 bytes over an in-memory `MoqtTransport` and publishes real |
There was a problem hiding this comment.
P3: The sandbox UI still says the default loopback relay speaks draft-20, contradicting this draft-22 update. Update index.html so the user-facing description matches the relay.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sandbox/templates/spf-moq-player/loopback-relay.ts, line 5:
<comment>The sandbox UI still says the default loopback relay speaks draft-20, contradicting this draft-22 update. Update `index.html` so the user-facing description matches the relay.</comment>
<file context>
@@ -2,12 +2,12 @@
*
* There is no public relay that serves draft-ietf-moq-msf-01 catalogs yet (Phase 0 interop is still owed), so this
- * stands in for one: it speaks real draft-20 bytes over an in-memory `MoqtTransport` and publishes real
+ * stands in for one: it speaks real draft-22 bytes over an in-memory `MoqtTransport` and publishes real
* WebCodecs-encoded media, which is enough to drive the whole engine — catalog → selection → subscribe → decode →
* canvas + AudioContext.
</file context>
There was a problem hiding this comment.
Fixed in #77: the sandbox page now says draft-22.
| // Cancellation *is* the stream lifecycle (§6.4.2.3): the subscriber | ||
| // aborting its sending direction ends the subscription. |
There was a problem hiding this comment.
P3: Section 6.4.2.3 does not define FIN as cancellation; it explicitly distinguishes FIN from RESET_STREAM/STOP_SENDING cancellation. Describe the done branch as graceful stream completion and leave cancellation to the catch path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sandbox/templates/spf-moq-player/loopback-relay.ts, line 687:
<comment>Section 6.4.2.3 does not define FIN as cancellation; it explicitly distinguishes FIN from RESET_STREAM/STOP_SENDING cancellation. Describe the `done` branch as graceful stream completion and leave cancellation to the catch path.</comment>
<file context>
@@ -684,7 +684,7 @@ export function createLoopbackRelay({ onLog }: LoopbackRelayOptions = {}): Loopb
const { value, done } = await reader.read();
- // Cancellation *is* the stream lifecycle (§3.3.3): the subscriber
+ // Cancellation *is* the stream lifecycle (§6.4.2.3): the subscriber
// aborting its sending direction ends the subscription.
if (done) break;
</file context>
| // Cancellation *is* the stream lifecycle (§6.4.2.3): the subscriber | |
| // aborting its sending direction ends the subscription. | |
| // A FIN means the subscriber sent no further messages; cancellation | |
| // uses RESET_STREAM/STOP_SENDING (§6.4.2.3) and reaches the catch path. |
There was a problem hiding this comment.
Fixed in #77. The comment now says a FIN isn't a cancellation (§6.4.2.2), that this loopback ends the subscription on either, and why that's harmless with this player (moq-core cancels with a reset and FINs only after the publisher).
| * The vi64 varint of draft-15+ (§1.4.1) — leading ones on the first byte give the encoded length minus one, so an | ||
| * L-byte encoding carries 7L value bits. NOT the QUIC RFC 9000 varint. | ||
| * The vi64 varint of draft-15+ (§8.1) — leading ones on the first byte give the encoded length minus one, so an L-byte | ||
| * encoding carries 7L value bits. NOT the QUIC RFC 9000 varint. |
There was a problem hiding this comment.
P3: The draft-22 vi64 comment omits the 9-byte, 64-bit form, and varintByteLength still caps encodings at 8 bytes. Add draft-22’s 9-byte encoding support before claiming full draft-22 wire coverage.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sandbox/templates/spf-moq-player/loopback-relay.ts, line 48:
<comment>The draft-22 vi64 comment omits the 9-byte, 64-bit form, and `varintByteLength` still caps encodings at 8 bytes. Add draft-22’s 9-byte encoding support before claiming full draft-22 wire coverage.</comment>
<file context>
@@ -31,21 +31,21 @@ const MESSAGE_TYPE = {
- * The vi64 varint of draft-15+ (§1.4.1) — leading ones on the first byte give the encoded length minus one, so an
- * L-byte encoding carries 7L value bits. NOT the QUIC RFC 9000 varint.
+ * The vi64 varint of draft-15+ (§8.1) — leading ones on the first byte give the encoded length minus one, so an L-byte
+ * encoding carries 7L value bits. NOT the QUIC RFC 9000 varint.
*/
function varintByteLength(value: number): number {
</file context>
There was a problem hiding this comment.
Corrected the comment in #77, but no encoder change. The decoder already reads the 9-byte form, and the 8-byte form's 56 bits cover every integer a JS number represents exactly (2^53), so the encoder never needs 9 bytes.
fix(spf): pin @caprid/moq-media 0.1.0 and address #75 review
Brings in #72 (worklet audio core), #75 (player on @caprid/moq-core, moqt-22) and #77 (moq-media pinned to 0.1.0). The publisher keeps its own draft-20 copy of network/moqt until its publish session moves onto @caprid/moq-core; the player side uses the package. The cross-engine relay hub now speaks each engine's draft: draft-20 upstream to the publisher, moqt-22 (via moqt-wire) to the player, whose Location Filters draft-22 encodes differently. The cross-engine harness hands the engine a context with `baseContext`, as the adapter does, so the worklet audio core can start. Claude-Session: https://claude.ai/code/session_01DaH4ihcQ4LStE1f1zbDuZm
Stacks on #72 (
feat/moq-worklet-audio-default). Retarget tommcc/moqonce #72 merges.Summary
The MoQ player takes its MOQT codec and session from
@caprid/moq-core0.1.1 instead of its own copy inpackages/spf/src/network/moqt/, which is deleted. The package was extracted from that copy, and itsUPSTREAM.jsonasks v10 to migrate rather than keep a divergent implementation. The player now offersmoqt-22first and falls back tomoqt-20.Changes
@caprid/moq-core^0.1.1 is added to@videojs/spf, and@caprid/moq-mediamoves to ^0.1.1.network/moqt/*now imports from@caprid/moq-core:moq-session,track-subscriber,resolve-catalog,subscribe-selected-tracksand their tests. The local modules (bytes, varint, errors, control-messages, object-stream, request-stream, session) and their tests are deleted.MOQT_PROTOCOL_IDS(['moqt-22', 'moqt-20']). The default factory hands the realWebTransportto the core, and the core readstransport.protocol(theWT-Protocolanswer) throughresolveMoqtProtocolto pick its LOCATION_FILTER codec, the only wire difference between -20 and -22. A browser withoutWebTransport.prototype.protocoloffersmoqt-22only, because it could not report amoqt-20pick, and the core would misread the filter.relative-group 0andrelative-group 1filters. Those encode to the same bytes on -20 and -22, so no player logic changed. Transport section citations in source and the sandbox loopback relay now use draft-22 numbering.@caprid/moq-media0.1.1 decodes Opus with WebAssembly libopus by default. That decoder is single-stream and ignores the OpusHead channel mapping, so a multistream track (channelConfig above stereo) would decode as noise. The default player factory passeslossConcealment: false, which keeps feat(spf): render MoQ audio through the @caprid/moq-media worklet core #72's WebCodecs path. Codex found and reproduced this.draft-ietf-moq-transport-22.txtreplaces the -20 text ininternal/specs/moq/. The README's tables, checksum and "declared in code" sentence now point at@caprid/moq-core.packages/spf/docs/moq-publishing.md, the sandbox relay templates and both.agents/plans/MoQ notes are repointed. The draft-20 migration plan is marked superseded on the player.v10-side helpers kept
packages/spf/src/network/tests/helpers/moqt-wire.ts, test-only. The in-memory fake relays need the relay side of the wire: server SETUP,decodeControlMessage,encodeSubscribeOk,encodeRequestError,StreamReaderandutf8Encode. The package's public entry doesn't export any of them. The helper re-exports them from the package's owndist/protocol/*by deep relative path instead of re-implementing them, so a release that moves those modules breaks the tests loudly. A public@caprid/moq-core/testing(or wire-codec) entry would let this go.compareLocations,isRetryable*,utf8Decode,REQUEST_ERROR_CODE,PUBLISH_DONE_STATUSand the session types) is exported by 0.1.1.Testing
pnpm -F @videojs/spf test: 132 files and 2305 tests pass, with no type errors.pnpm build:packages,pnpm typecheck(staletypes/and tsbuildinfo cleared first) andpnpm lintall pass.codex review --base feat/moq-worklet-audio-defaultmade one finding, the multistream Opus regression above, which is fixed in 38db34c with a test that fails without the fix.@caprid/moq-core's publish session underhuddle/videojs-testing/*. It then plays the broadcast throughcreateMoqEnginewith the default WebTransport factory.["moqt-22","moqt-20"]and the relay selectedmoqt-22. The player session was ready 107 ms after connect.next-objectplus fillrelative-group 1. The publisher served it.Notes for the publisher PR (
mmcc/moq-publisher)createMoqtPublishSessionreplacespublish-session.ts. The publisher has to adapt to:openUniStream(trackAlias);getStreamCount, since the session counts data and fill streams itself;TRACK_PROPERTY.TIMESCALE) yourself;close()that waits up toCLOSE_END_ACK_TIMEOUT_MS(2 s) for the relay's FIN;end({ after })can open streams.subgroup-writer.tsmaps tocreateSubgroupWriter, andencodeFetchHeaderandisEmptyFetchRangeare exported. The publisher's tests that usetests/helpers/raw-peer.tsandtransport-pair.tswill need the same deep-import approach asmoqt-wire.ts, or a testing entry upstream.MOQT_PROTOCOL_IDSand construct the session over the realWebTransport.getLargestObject, plus a fill) and played cleanly.🤖 Generated with Claude Code
https://claude.ai/code/session_01DaH4ieYHRP2Agar6P9KSCB
Summary by cubic
The MoQ player now speaks the transport through
@caprid/moq-core0.1.1 instead of its own vendored copy inpackages/spf/src/network/moqt/, which is deleted. The session offersmoqt-22first withmoqt-20as fallback, and the core reads the negotiatedWebTransportprotocol to pick itsLOCATION_FILTERcodec — the only wire difference between the two — while browsers withoutWebTransport.prototype.protocoloffermoqt-22only.Behavior changes
@caprid/moq-mediamoves to ^0.1.1, and its default WebAssembly libopus decoder is disabled (lossConcealment: false) since it decodes multistream Opus as noise; WebCodecs stays the audio path.moqt-wire.tsre-exports the package's relay-side codec through a deep path into itsdist/, so a release that moves those modules fails the tests loudly.Written for commit 38db34c. Summary will update on new commits.