Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

src/ui/video-player.js decodes H.264 access units with WebCodecs into a canvas and reports when it cannot - module and test only #305

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

src/ui/video-player.js decodes H.264 access units with WebCodecs and draws them into a canvas. When the browser has no WebCodecs, or no picture arrives, it says so instead of showing an empty frame (#258). This push merges main into the branch.

Notes

shipped merged

opened this

src/ui/video-player.js decodes H.264 access units with WebCodecs and draws them into a canvas. When the browser has no WebCodecs, or no picture arrives, it says so instead of showing an empty frame (#258).

This push merges main into the branch. The only conflict was the "mute" case in Software/so101/src/lobby.ts. The branch had the mute handling inline, with a fix that falls back to null when the mute length isn't recognised. main (#304) moved that handling into muteUser and added moderator checks: a moderator can't mute the owner, another moderator, or anyone who hasn't joined. muteUser already has the same null fallback, so the merge keeps main's version and nothing from the branch is lost. The video player itself is unchanged.

The type check (bun x tsc --noEmit) passes. On the first bun test run, 544 of 545 tests passed. That run's output didn't name the failing test, and on a second full run it didn't fail again.

To try it, open the preview at https://arm--305--forge-trevato-apps.open-platform.sh and watch a camera that has an H.264 source. To check the merge, mute and unmute someone in chat as the owner and as a moderator.

🤖 Generated with Claude Code

Continues #305

1 earlier comment · 1 event
commented

src/ui/video-player.js decodes H.264 access units with WebCodecs and draws them into a canvas. When the browser has no WebCodecs, or no picture arrives, it says so instead of showing an empty frame (#258).

This push merges main into the branch. The only conflict was the "mute" case in Software/so101/src/lobby.ts. The branch had the mute handling inline, with a fix that falls back to null when the mute length isn't recognised. main (#304) moved that handling into muteUser and added moderator checks: a moderator can't mute the owner, another moderator, or anyone who hasn't joined. muteUser already has the same null fallback, so the merge keeps main's version and nothing from the branch is lost. The video player itself is unchanged.

The type check (bun x tsc --noEmit) passes. On the first bun test run, 544 of 545 tests passed. That run's output didn't name the failing test, and on a second full run it didn't fail again.

To try it, open the preview at https://arm--305--forge-trevato-apps.open-platform.sh and watch a camera that has an H.264 source. To check the merge, mute and unmute someone in chat as the owner and as a moderator.

🤖 Generated with Claude Code

Approved

Does what #305 asked and no more: a self-contained ES module plus its test, no new dependency, no server or lobby change. It parses the 10-byte header, configures the decoder from the first SPS, waits for a keyframe, drops everything while the decoder is behind until the next keyframe, and reports "none" when WebCodecs is missing, the socket closes, or no picture arrives within waitMs. Nothing is wired into a page yet, so the preview has nothing to show. That matches the module-and-test scope, and no door or tty change applies. The tests cover parsing, a truncated SPS, missing support, join mid-GOP, backpressure with age, quality and report, and close before any picture. Two things to do next: (1) test the decoder error callback and the decode() throw path, which set needKey and clear configured so the next keyframe reconfigures; neither is exercised. (2) When it is wired in, show the MJPEG fallback on "none", and decide whether a mid-stream socket close should reconnect or only report.

commented

This pull adds Software/so101/src/ui/video-player.js and its test, and changes nothing else. The module comes from pull #207's branch. It decodes H.264 access units with VideoDecoder into a canvas and works out its own avc1.PPCCLL codec string from the first SPS. It reports "none" so the page can fall back in three cases: WebCodecs is missing, no picture arrives within waitMs, or the socket closes before any picture. Nothing loads it yet and viewer.html is unchanged, so the first-visit gzip budget stays the same.

Why pull #271 failed, and what is different now:

  • The lobby fix is gone. #271 carried a one-line type fix to src/lobby.ts. Main has since rewritten that code in #304 (the moderator mute, now muteUser), and its version already has the same ?? null fallback. I merged main and kept main's lobby.ts, so the diff against main is only src/ui/video-player.js and src/ui/video-player.test.ts.
  • The failing server test was the setup, not the code. The one test #271 reported as failing, server.test.ts "serves the model, its meshes and the vendored libraries", also fails here when node_modules is empty, because the vendored libraries aren't there to serve. With bun install --frozen-lockfile run first, it passes. I can't see the forge's deploy log, so I have not confirmed this is what broke #271's preview.

What to look at: video-player.test.ts builds its own small Annex-B clip (SPS, PPS, IDR, then P pictures). Main now has src/h264-clip.ts, but the test doesn't import it, so this pull stays independent of the other pieces of #70.

Checks: after merging main and installing dependencies, bun x tsc --noEmit is clean and bun --cwd Software/so101 test passes 545 of 545, including the 7 video-player tests.

Closes #258

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs