Add ExoPlayer support for FrontendScreen from frontend request#6771
Merged
Add ExoPlayer support for FrontendScreen from frontend request#6771
Conversation
b782ecc to
e92f0fa
Compare
1b1d943 to
66f08d1
Compare
Contributor
271b455 to
97481e4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ExoPlayer-backed video playback support to the Compose FrontendScreen via new typed external bus messages, including a fullscreen request pathway up to LaunchActivity.
Changes:
- Introduces new incoming external bus messages (
exoplayer/play_hls,exoplayer/resize,exoplayer/stop) and corresponding handler events. - Adds a
FrontendExoPlayerManager+ExoPlayerUiState, wires it intoFrontendViewModel/FrontendViewState, and renders via a newExoPlayerOverlayinFrontendScreen. - Adds a
FrontendEvent.RequestFullscreenflow from frontend screen → navigation →LaunchViewModelto control system bars, plus tests.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/externalbus/incoming/IncomingExternalBusMessage.kt | Adds typed incoming external bus messages for ExoPlayer commands |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/handler/FrontendMessageHandler.kt | Maps new incoming messages to handler events and sends result for play_hls |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/handler/FrontendHandlerEvent.kt | Adds ExoPlayer action event types |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/exoplayer/FrontendExoPlayerManager.kt | New manager to own ExoPlayer lifecycle and overlay sizing/fullscreen state |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/exoplayer/ExoPlayerUiState.kt | UI state model for overlay position/size/fullscreen/aspect ratio |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewState.kt | Adds exoPlayerState to FrontendViewState.Content |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModel.kt | Collects ExoPlayer state into viewState, handles ExoPlayer actions, emits fullscreen requests |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendScreen.kt | Renders HAMediaPlayer overlay positioned by frontend resize messages |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendEvent.kt | Adds RequestFullscreen event type |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendNavigation.kt | Threads onRequestFullscreen through navigation and handles the new event |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/HAApp.kt | Adds optional onRequestFullscreen plumbing into app scaffold |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/HANavHost.kt | Passes onRequestFullscreen into frontend navigation graph |
| app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchActivity.kt | Wires fullscreen requests from nav/UI into LaunchViewModel |
| app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchViewModel.kt | Combines fullscreen preference with temporary fullscreen requests |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/externalbus/incoming/IncomingExternalBusMessageTest.kt | Tests JSON decoding for new ExoPlayer messages |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/handler/FrontendMessageHandlerTest.kt | Tests handler behavior for ExoPlayer messages |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/exoplayer/FrontendExoPlayerManagerTest.kt | New unit tests for manager behavior |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModelTest.kt | Tests fullscreen/event emission and ExoPlayer action forwarding/cleanup |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendEventHandlerTest.kt | Adds coverage for RequestFullscreen event handling |
| app/src/test/kotlin/io/homeassistant/companion/android/launch/LaunchViewModelTest.kt | Adds tests for preference/request fullscreen combining |
4 tasks
48 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ExoPlayer-driven video playback to the Compose FrontendScreen based on Home Assistant frontend external-bus commands, including overlay rendering and fullscreen coordination with the host activity’s fullscreen preference handling.
Changes:
- Add new incoming external-bus message types (
exoplayer/play_hls,exoplayer/resize,exoplayer/stop) and route them into newFrontendHandlerEvent.ExoPlayerActionevents. - Introduce
FrontendExoPlayerManager+ExoPlayerUiStateand wire it intoFrontendViewModel/FrontendViewStateto render aHAMediaPlayeroverlay. - Add a
FrontendEvent.RequestFullscreenpipeline fromFrontendViewModel→ navigation host →LaunchViewModel, combining frontend requests with the user’s fullscreen preference.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchViewModel.kt | Combine user fullscreen preference with temporary fullscreen requests from the frontend |
| app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchActivity.kt | Wire onRequestFullscreen callback into the Compose app host |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/HAApp.kt | Thread onRequestFullscreen callback through app scaffold to navigation host |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/HANavHost.kt | Pass onRequestFullscreen into the frontend navigation setup |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendNavigation.kt | Add onRequestFullscreen handler plumbing and handle FrontendEvent.RequestFullscreen |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendEvent.kt | Introduce RequestFullscreen one-shot event |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/handler/FrontendHandlerEvent.kt | Add ExoPlayerAction events used to drive playback/resize/stop |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/externalbus/incoming/IncomingExternalBusMessage.kt | Add incoming external-bus message models for ExoPlayer commands |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/handler/FrontendMessageHandler.kt | Parse ExoPlayer external-bus messages and emit corresponding handler events |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/exoplayer/FrontendExoPlayerManager.kt | New manager owning ExoPlayer instance, resize/aspect-ratio logic, and state flow |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/exoplayer/ExoPlayerUiState.kt | New UI state model for the overlay player (position/size/fullscreen/aspect ratio) |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewState.kt | Extend Content state to include ExoPlayer overlay state |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModel.kt | Integrate ExoPlayer manager lifecycle, forward actions, and emit fullscreen requests |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendScreen.kt | Render ExoPlayer overlay on top of WebView using HAMediaPlayer |
| app/src/test/kotlin/io/homeassistant/companion/android/launch/LaunchViewModelTest.kt | Add tests for preference-vs-request fullscreen behavior |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendEventHandlerTest.kt | Add tests ensuring RequestFullscreen events call the host callback |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/handler/FrontendMessageHandlerTest.kt | Add tests for ExoPlayer message handling via external bus |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/externalbus/incoming/IncomingExternalBusMessageTest.kt | Add JSON parsing tests for new ExoPlayer message types |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/exoplayer/FrontendExoPlayerManagerTest.kt | New unit tests for ExoPlayer manager behavior (play/resize/stop/fullscreen/close) |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModelTest.kt | Add tests for fullscreen requests, manager wiring, and lifecycle cleanup |
jpelgrom
reviewed
May 4, 2026
jpelgrom
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for showing exoPlayer from a frontend command on the
FrontendScreen.I've introduced a
ExoPlayerOverlayto manage the player, once the player is initialized for the session we keep it so it can be reuse. I've also introduced a way to request full screen to the activity, it is also use to request leaving full screen but if the settings is already set to full screen then it stays on full screen.Checklist
Screenshots
Screen_recording_20260429_125650.mp4