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 #271

Parked opened this
Closed without merging

This adds Software/so101/src/ui/video-player.js, taken unchanged from pull #207's branch, along with its test. It decodes H.264 access units arriving over a WebSocket with VideoDecoder and draws them into a canvas.

Notes

stopped parked by the crew deploy e87acfe

opened this

This adds Software/so101/src/ui/video-player.js, taken unchanged from pull #207's branch, along with its test. It decodes H.264 access units arriving over a WebSocket with VideoDecoder and draws them into a canvas. It works out its own codec string (avc1.PPCCLL) from the first SPS, and it reports "none" to the page in three cases: WebCodecs is missing (canDecode() is false), no picture arrives within waitMs, or the socket closes before any picture.

Nothing loads it yet. viewer.html is unchanged, so the first-visit gzip budget is too.

What to look at:

  • The test fixture. On #207's branch the test imports src/h264-clip.ts, which isn't on main and isn't part of #257. video-player.test.ts now builds the same small Annex-B clip itself (SPS, PPS, IDR, then P pictures), so this pull doesn't depend on any other piece of #70.
  • New tests. On top of #207's tests I added:

- no support when VideoDecoder is missing; - no picture within waitMs, and no "none" once a picture has arrived; - a keyframe with no SPS, or no decoder at all, is never configured or decoded; - a P picture or a truncated SPS gives no codec, without reading past the end.

  • A one-line fix in src/lobby.ts. On main, bun x tsc --noEmit failed: #253 left span possibly undefined at src/lobby.ts:356. It is now MUTE_FOR[m.for ?? "forever"] ?? null. The key was already checked two lines up, so behaviour is unchanged. It is a separate commit and can be dropped if another pull fixes it first.

Checks:

  • bun x tsc --noEmit is clean.
  • bun test src/ui/video-player.test.ts: 7 pass.
  • The lobby, chat and player suites pass after the lobby fix.
  • The whole package ran before the fix: 501 passed and 1 failed. The failure was in server.test.ts ("serves the model, its meshes and the vendored libraries"); that file then passed on its own (54/54), so it looks flaky rather than related to this change.

🤖 Generated with Claude Code

Closes #258

Closes #258

commented

This adds Software/so101/src/ui/video-player.js, taken unchanged from pull #207's branch, along with its test. It decodes H.264 access units arriving over a WebSocket with VideoDecoder and draws them into a canvas. It works out its own codec string (avc1.PPCCLL) from the first SPS, and it reports "none" to the page in three cases: WebCodecs is missing (canDecode() is false), no picture arrives within waitMs, or the socket closes before any picture.

Nothing loads it yet. viewer.html is unchanged, so the first-visit gzip budget is too.

What to look at:

  • The test fixture. On #207's branch the test imports src/h264-clip.ts, which isn't on main and isn't part of #257. video-player.test.ts now builds the same small Annex-B clip itself (SPS, PPS, IDR, then P pictures), so this pull doesn't depend on any other piece of #70.
  • New tests. On top of #207's tests I added:

- no support when VideoDecoder is missing; - no picture within waitMs, and no "none" once a picture has arrived; - a keyframe with no SPS, or no decoder at all, is never configured or decoded; - a P picture or a truncated SPS gives no codec, without reading past the end.

  • A one-line fix in src/lobby.ts. On main, bun x tsc --noEmit failed: #253 left span possibly undefined at src/lobby.ts:356. It is now MUTE_FOR[m.for ?? "forever"] ?? null. The key was already checked two lines up, so behaviour is unchanged. It is a separate commit and can be dropped if another pull fixes it first.

Checks:

  • bun x tsc --noEmit is clean.
  • bun test src/ui/video-player.test.ts: 7 pass.
  • The lobby, chat and player suites pass after the lobby fix.
  • The whole package ran before the fix: 501 passed and 1 failed. The failure was in server.test.ts ("serves the model, its meshes and the vendored libraries"); that file then passed on its own (54/54), so it looks flaky rather than related to this change.

🤖 Generated with Claude Code

Closes #258

commented

Parked by the crew: the preview's deploy failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs