Skip to content

Refactor camera player UI and remove legacy WebRTC views#4277

Merged
bgoncal merged 1 commit intomainfrom
cameraplayer
Jan 29, 2026
Merged

Refactor camera player UI and remove legacy WebRTC views#4277
bgoncal merged 1 commit intomainfrom
cameraplayer

Conversation

@bgoncal
Copy link
Copy Markdown
Member

@bgoncal bgoncal commented Jan 29, 2026

Consolidates camera player overlays and controls into CameraPlayerView, removing duplicated overlay code from CameraMJPEGPlayerView and CameraStreamHLSView. Deletes legacy WebRTCPlayer* views and updates WebRTCVideoPlayerView to use a shared controlsVisible binding for UI overlays. Adds HAAppEntity.entity(id:serverId:) for entity lookup, and updates IncomingURLHandler to use CameraPlayerView.

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Consolidates camera player overlays and controls into CameraPlayerView, removing duplicated overlay code from CameraMJPEGPlayerView and CameraStreamHLSView. Deletes legacy WebRTCPlayer* views and updates WebRTCVideoPlayerView to use a shared controlsVisible binding for UI overlays. Adds HAAppEntity.entity(id:serverId:) for entity lookup, and updates IncomingURLHandler to use CameraPlayerView.
@bgoncal bgoncal self-assigned this Jan 29, 2026
Copilot AI review requested due to automatic review settings January 29, 2026 15:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 refactors camera player UI to consolidate overlays and controls, removing code duplication across different player types. It deletes three legacy WebRTC view files and updates the WebRTC player to use a shared controlsVisible binding managed by the new wrapper CameraPlayerView. A new database lookup method is added to retrieve entity information for displaying camera names.

Changes:

  • Consolidates camera player overlays by moving camera name badge and close button to CameraPlayerView, eliminating duplicated UI code from individual player views
  • Removes legacy WebRTC player files (WebRTCPlayerVideoView.swift, WebRTCPlayerViewControls.swift, WebRTCPlayerViewController.swift)
  • Adds HAAppEntity.entity(id:serverId:) static method for entity lookup from the database
  • Updates IncomingURLHandler to use CameraPlayerView instead of WebRTCVideoPlayerView directly

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Sources/Shared/HAAppEntity.swift Adds new static method for entity lookup by ID and server ID
Sources/App/WebView/IncomingURLHandler.swift Updates camera URL handling to use CameraPlayerView wrapper
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCViewPlayerViewModel.swift Removes controlsVisible state and showControlsTemporarily method
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCVideoPlayerViewControls.swift Removes camera name display and top buttons (mute/close) from controls
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCVideoPlayerView.swift Adds AppCameraView protocol conformance, accepts controlsVisible binding, adds mute button to toolbar
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCPlayerViewControls.swift Deletes legacy controls file
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCPlayerViewController.swift Deletes legacy view controller
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCPlayerVideoView.swift Deletes legacy player view
Sources/App/Cameras/CameraPlayer/CameraStreamHLSView.swift Removes duplicate overlay controls
Sources/App/Cameras/CameraPlayer/CameraPlayerView.swift Adds NavigationStack wrapper with toolbar, name badge overlay, entity lookup, and controlsVisible state management
Sources/App/Cameras/CameraPlayer/CameraMJPEGPlayerView.swift Removes duplicate overlay controls
HomeAssistant.xcodeproj/project.pbxproj Removes deleted WebRTC files from build configuration

Comment thread Sources/App/Cameras/CameraPlayer/CameraPlayerView.swift
Comment thread Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCVideoPlayerView.swift
Comment thread Sources/Shared/HAAppEntity.swift
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@35e52f7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
Sources/Shared/HAAppEntity.swift 0.00% 10 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4277   +/-   ##
=======================================
  Coverage        ?   43.13%           
=======================================
  Files           ?      261           
  Lines           ?    15089           
  Branches        ?        0           
=======================================
  Hits            ?     6508           
  Misses          ?     8581           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bgoncal bgoncal merged commit 057b67c into main Jan 29, 2026
21 checks passed
@bgoncal bgoncal deleted the cameraplayer branch January 29, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants