Skip to content

Stop hero video playback when Home screen is backgrounded - #789

Merged
ProdigyV21 merged 1 commit into
mainfrom
ccr-473f1a26-yxbu4z
Oct 7, 2026
Merged

ProdigyV21 merged 1 commit into
mainfrom
ccr-473f1a26-yxbu4z

Conversation

@silentbil

Copy link
Copy Markdown
Collaborator

Summary

This change ensures that hero video playback is properly stopped when the Home screen is backgrounded (e.g., when the user presses the Home button or minimizes the app). This prevents audio from continuing to play in the background and ensures live streams are re-prepared fresh when the app returns to the foreground.

Key Changes

  • Added lifecycle state tracking using currentStateAsState() to monitor when the Home screen is in the STARTED state
  • Prevent hero video URL from being set when the Home screen is not in the started state
  • Added a LaunchedEffect that fully releases the video stream when the Home screen is backgrounded by:
    • Setting playWhenReady = false
    • Calling player.stop()
    • Clearing all media items
    • Resetting the prepared video URL

Implementation Details

  • The lifecycle state is checked against Lifecycle.State.STARTED to determine if the screen is actively displayed
  • Live streams are intentionally fully released (rather than paused) so they re-prepare fresh when returning to the foreground, preventing the stream from being behind the live window
  • The solution handles the edge case where the composition remains alive even after the activity is stopped

https://claude.ai/code/session_01MYpWycUKkE68tJ8MZK2ucm

Pressing Home while a favorite TV channel previewed in the hero only
stopped the activity; the Home composition stayed alive and its
ExoPlayer kept playing. Gate the hero video on the lifecycle being
STARTED and release the stream on stop so it re-prepares on return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MYpWycUKkE68tJ8MZK2ucm
@github-actions github-actions Bot added the area: android Changes to the Android app or Gradle build label Oct 6, 2026
@silentbil
silentbil requested a review from ProdigyV21 October 7, 2026 08:58
@ProdigyV21
ProdigyV21 merged commit cb6c15c into main Oct 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: android Changes to the Android app or Gradle build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants