Skip to content

fix(dashboard): restrict live view controls to camera device types that support WebRTC#888

Open
lboue wants to merge 4 commits into
matter-js:mainfrom
lboue:fix/snapshot-camera-no-live-view
Open

fix(dashboard): restrict live view controls to camera device types that support WebRTC#888
lboue wants to merge 4 commits into
matter-js:mainfrom
lboue:fix/snapshot-camera-no-live-view

Conversation

@lboue

@lboue lboue commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Type of change

  • 🐛 Fix — corrects a defect or wrong behavior
  • Feature — adds new functionality or capability

Description

The camera overlay always rendered the live-view controls (resolution selector, Start/Retry button, watermark/OSD toggles) regardless of the endpoint's Matter device type. For a Snapshot Camera (0x0145) endpoint — which does not implement the mandatory WebRTCTransportProvider cluster (0x0553) — this let a user click Start and attempt to negotiate a WebRTC session the camera cannot serve.

Root cause: camera-overlay.ts gated the Snapshot button independently on the AVSM SNP feature bit, but gated nothing on device type — the assumption was that any endpoint opening the overlay (Camera / Video Doorbell / Floodlight Camera / Snapshot Camera) supports live view.

Fix:

  • New LIVE_VIEW_DEVICE_TYPE_IDS constant (device-icons.ts, readonly + Object.freezed): Camera, Video Doorbell, Floodlight Camera — the device types that mandate WebRTCTransportProvider.
  • camera-overlay.ts: new _liveViewSupported getter (endpoint device type lookup); canStart now requires it, hiding the resolution selector / watermark / OSD toggles / Start button for Snapshot Camera. The Snapshot resolution dropdown and Snapshot button stay independently gated on _snapshotSupported, unaffected.
  • webrtc-stream-view.ts: new liveViewSupported prop; the idle placeholder text changes to "Live view not supported — use Snapshot"; start() reports the unsupported case via the existing _fireStateChange("error", …) path (not a throw), consistent with the method's other error handling and safe for fire-and-forget callers (void view.start()).
  • node-details.ts: the node action button relabels from "Live View" to "Snapshot" (camera icon instead of video icon) when the endpoint's device type doesn't support live view; reuses the shared LIVE_VIEW_DEVICE_TYPE_IDS constant instead of duplicating the device type list.
  • CHANGELOG.md: added an entry under the work-in-progress placeholder (rebased onto the 1.2.7 release cut after main advanced).

Review feedback addressed (Copilot):

  • Reporting unsupported live view via _fireStateChange("error", …) instead of throwing from start(), since callers invoke it fire-and-forget.
  • Made LIVE_VIEW_DEVICE_TYPE_IDS immutable (readonly + Object.freeze) since it's shared/copied by other modules.

Backing evidence

Checklist

  • Tests added or updated to cover the change
  • npm test passes (PRIMARY_INTERFACE=ens33 MATTER_MDNS_NETWORKINTERFACE=ens33 npm test, full monorepo run, all packages green including matter-server integration tests: 251/251)
  • npm run format-verify and npm run lint pass
  • CHANGELOG updated (if applicable)

Copilot AI review requested due to automatic review settings July 16, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the dashboard camera overlay UI so live-view (WebRTC) controls are only shown for Matter camera device types that mandate WebRTCTransportProvider, preventing Snapshot Camera endpoints from offering streaming controls they can’t support.

Changes:

  • Added a shared LIVE_VIEW_DEVICE_TYPE_IDS list to represent device types that support WebRTC live streaming.
  • Updated the camera overlay and stream view to hide/adjust live-view UI when unsupported and to clarify the idle state messaging.
  • Updated node details to relabel the camera action button to “Snapshot” (with a camera icon) when live view isn’t supported.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/dashboard/src/util/device-icons.ts Introduces LIVE_VIEW_DEVICE_TYPE_IDS to centralize the live-view-capable device type list.
packages/dashboard/src/pages/components/node-details.ts Reuses shared constant and relabels the action button based on live-view support.
packages/dashboard/src/pages/camera-overlay.ts Gates live-view controls on device type support while keeping snapshot controls available.
packages/dashboard/src/components/webrtc-stream-view.ts Adds liveViewSupported prop and updates placeholder text; adds defensive start behavior.
CHANGELOG.md Adds a WIP changelog entry documenting the fix.

Comment thread packages/dashboard/src/components/webrtc-stream-view.ts
lboue and others added 3 commits July 16, 2026 20:56
…at support WebRTC

Snapshot Camera (0x0145) doesn't implement WebRTCTransportProvider, so the
overlay's Start/resolution/watermark/OSD controls no longer render for it —
only Snapshot, which is gated independently on the AVSM SNP feature. The
node-details "Live View" button also relabels to "Snapshot" with a camera
icon for snapshot-only device types.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…a throw

Addresses PR review feedback: start() is called fire-and-forget
(void view.start()), so throwing bypassed the method's error handling
and risked an unhandled promise rejection instead of a user-visible
error state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lboue
lboue force-pushed the fix/snapshot-camera-no-live-view branch from 40ad81d to 8d227b1 Compare July 16, 2026 18:58
@lboue
lboue requested a review from Copilot July 16, 2026 18:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread packages/dashboard/src/util/device-icons.ts Outdated
Addresses PR review feedback: the exported array is shared/copied by
other modules (node-details.ts spreads it), so accidental mutation by
a consumer would silently change live-view gating at runtime.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants