Give a view-only share guest a real player, native WebRTC first, and name the camera in the bar - #379
Conversation
…name the camera in the bar
A view-only link got the camera's MJPEG in a bare <img>: no sound, no
snapshot, no full screen, and the heaviest way to move a 4K picture.
It now walks the same chain as the camera's own WebUI player:
1. WebRTC: signalling over /ws/webrtc through the tunnel, media on its own
peer connection straight to the camera with the share's ICE servers --
sub-second latency, the hardware decoder, and nothing heavy on the
tunnel's data channel.
2. MSE over /ws/video through the tunnel, when WebRTC will not: a codec this
browser's WebRTC does not offer, a camera whose media slots are taken
("busy"), a path the media cannot cross.
3. The camera's MJPEG, with the reason shown.
With sound on request (renegotiated on whichever rung is playing), a snapshot
that downloads, and full screen.
The camera names itself in WELCOME now; the bar and the tab title show it,
so a guest with links to two cameras can tell them apart.
PR Summary by QodoAdd a WebRTC-first player for view-only camera shares
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
…d harden the player's fallbacks - Candidates that arrive before the camera's answer are held until it is in, rather than refused and lost; one without a media ID goes to the video line. - Every track joins one stream, so sound arriving apart from the picture no longer replaces it. - The MSE retry count resets when video plays, not on an init the camera may send before dropping again, so repeated drops do reach the MJPEG floor. - A MediaSource's sourceopen acts only for that source and attempt. - A link that ends while the player loads is not covered by a blank player.
The player. A view-only share link used to show the camera's MJPEG in a bare
<img>: no sound, no snapshot, no full screen, and the heaviest way to move a 4K picture. The share page now has its own player,static/player.js. It tries the same three ways the camera's own WebUI player does, in the same order:/ws/webrtc, carried by the tunnel. The media gets its own peer connection straight to the camera, using the share's ICE servers. That gives sub-second latency and the browser's hardware decoder, and keeps heavy traffic off the tunnel's data channel./ws/video, through the tunnel, when WebRTC will not play: a codec this browser's WebRTC does not offer, or a camera whose media slots are taken (it answersbusy).Sound is asked for on demand, and renegotiated on whichever of the three is playing. Snapshot downloads
/image.jpg, and Full screen works.The camera's name. The camera now names itself in WELCOME (the
camerafield). The bar and the tab title show it, so a guest with links to two cameras can tell them apart. Without the field the bar still reads "Shared camera".Checks
service/run.sh test ./internal/sharerelay/...passes. The relay itself is unchanged; it serves the new file like the others, under the versioned path.openipc serve --role share, a camera build pointed at it, guests in headless Chromium, and the owner watching Live throughout.busyand falls back to MSE at 4K.Merging deploys nothing. Per
deploy/DEV-VALIDATION.md, it should be validated on dev before production.