No description
- Kotlin 100%
Fixes a lifecycle bug: live audio kept playing after Home, even while another app played its own content. Root cause: the ExoPlayer requested no audio focus and nothing observed the Activity lifecycle, so playback ran on in the background. - Audio focus: build the player with AudioAttributes(USAGE_MEDIA) and handleAudioFocus=true, so Media3 pauses/ducks when another app takes focus and requests focus on play. - Lifecycle: a LifecycleEventObserver pauses on ON_STOP (Home, app switch, screen off) — recording whether playback was active — and resumes on ON_START only if it was active (a user pause stays paused). In-app overlays (Quick Switch, EPG) don't change the Activity lifecycle, so they don't pause. Live rejoins the live edge (seekToDefaultPosition) where supported. No player recreation for brief Home interruptions. - Watchdog: suspends stall/frozen detection and never reconnects while backgrounded; re-initializes its timers on foreground via a tick bumped from the lifecycle callback (the loop itself is frozen while hidden), so the background gap and resume re-buffer aren't mistaken for a stall. Verified on the emulator: Home pauses (and resumes on return), a user pause survives Home/return, Quick Switch doesn't pause, no spurious recovery on resume, a single media session across repeated Home/return. 48 unit tests (adds shouldResumeOnForeground + paused-never-recovers). versionCode 24 / versionName 0.1.23. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| app | ||
| gradle | ||
| .gitignore | ||
| build.gradle.kts | ||
| gradle.properties | ||
| gradlew.bat | ||
| settings.gradle.kts | ||