Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add external bus protocol for the native WebRTC camera player#7140

Draft
TimoPtr wants to merge 2 commits into
claude/webrtc-phase2-compose-rendererhome-assistant/android:claude/webrtc-phase2-compose-rendererfrom
claude/webrtc-external-bushome-assistant/android:claude/webrtc-external-busCopy head branch name to clipboard
Draft

Add external bus protocol for the native WebRTC camera player#7140
TimoPtr wants to merge 2 commits into
claude/webrtc-phase2-compose-rendererhome-assistant/android:claude/webrtc-phase2-compose-rendererfrom
claude/webrtc-external-bushome-assistant/android:claude/webrtc-external-busCopy head branch name to clipboard

Conversation

@TimoPtr

@TimoPtr TimoPtr commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

Third slice of the native WebRTC camera streaming plan (docs/adr/0001-native-webrtc-session-library.md), stacked on #7139 (which stacks on #7137). This adds the dashboard entry point: the external bus protocol that lets the frontend delegate camera WebRTC playback to the native player, paired with a frontend change (branch native-webrtc-external-bus, developed against home-assistant/frontend dev).

The protocol mirrors the existing ExoPlayer HLS delegation one-to-one:

  • Frontend → app: webrtc/play_camera {entity_id, muted}, webrtc/resize {left, top, right, bottom} (getBoundingClientRect semantics, like exoplayer/resize), webrtc/stop.
  • App → frontend: webrtc/error {entity_id, code?, message?} command when the native session fails, so ha-web-rtc-player falls back to in-WebView playback for the rest of the session.
  • Capability: the app reports hasNativeWebRTC in the external config response, gated by a new developer setting (Settings → Developer tools → "Native WebRTC player (beta)", off by default) so the rollout is opt-in while the camera/codec matrix is validated.

Implementation notes:

  • The WebRtcSession is owned by WebViewActivity like the ExoPlayer instance, rendered by WebRtcVideo in an overlay above the WebView at the reported rect (setZOrderMediaOverlay so the video surface composites above the WebView, like the HLS player).
  • Session failures are observed from the session's StateFlow; the session is released on stop, on a new play request, and in onDestroy.
  • When the frontend does not constrain the rect height (no video size known before the first frame), a 16:9 ratio is used until the next resize.

Frontend counterpart (in review separately): ha-web-rtc-player hides its video element and delegates when hasNativeWebRTC is set, exactly like _renderHLSExoPlayer; type-checked, eslint/prettier/lit-analyzer clean.

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Any other notes

  • Stacked on Add Compose WebRTC renderer and developer debug screen #7139; do not merge before it. Draft until the paired frontend PR is up and the flow is validated end-to-end on a device (frontend + app + real camera), which needs the frontend branch deployed — the "thoroughly tested" box stays unchecked until then.
  • Verified locally: full :app (1353) and :common (656) unit test suites, :app lint (no new issues), ktlint, and compilation across all touched modules.
  • No behavior change with the developer setting off: the config flag is false and the frontend keeps its current in-WebView WebRTC path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TxHn9ySi8aRFvvmfcPRgVu


Generated by Claude Code

@TimoPtr
TimoPtr force-pushed the claude/webrtc-external-bus branch from f16895a to b93318e Compare July 8, 2026 10:09
claude added 2 commits July 8, 2026 10:54
Mirrors the existing exoplayer HLS delegation: when the new developer
setting is enabled the app reports hasNativeWebRTC in the external
config, and the frontend can delegate camera WebRTC playback through
webrtc/play_camera, webrtc/resize (getBoundingClientRect semantics) and
webrtc/stop. The native player renders in an overlay above the WebView
at the reported rect, and failures are forwarded to the frontend as a
webrtc/error command so it can fall back to in-WebView playback.

The capability is off by default (Settings > Developer tools > Native
WebRTC player) while the paired frontend change lands and the camera
compatibility matrix is validated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TxHn9ySi8aRFvvmfcPRgVu
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.