Refactor camera player UI and remove legacy WebRTC views#4277
Conversation
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.
There was a problem hiding this comment.
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
IncomingURLHandlerto useCameraPlayerViewinstead ofWebRTCVideoPlayerViewdirectly
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 |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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