Fix v8.0: Audio Background Playback Issue

Critical Fix:
- Fixed audio continuing to play when leaving the app
- PlayerActivity now properly manages ExoPlayer lifecycle
- No more background audio when switching to other apps

Lifecycle Management:
- onStop(): Releases ExoPlayer when app goes to background
- onStart(): Reloads stream only if player is null (prevents duplicates)
- onDestroy(): Final cleanup of player resources
- Proper memory management prevents leaks

Android TV Integration:
- Perfect multitasking behavior for TV environment
- Clean switching between streaming apps (YouTube, Netflix, etc.)
- No audio interference when navigating Android TV interface
- Stream resumes automatically when returning to app

Technical Details:
- Dual release points: onStop() and onDestroy() for safety
- Smart reconstruction: Only reload when necessary
- Memory safe: No ExoPlayer leaks or resource issues
- TV optimized: Seamless integration with Android TV ecosystem

User Experience:
- Background audio completely stopped when leaving app
- Clean transitions between different streaming services
- Automatic stream resumption when returning to StreamPlayer
- Professional Android TV behavior

All existing features maintained:
- Tab interface with visible focus (Channels/Events)
- Real-time events with Argentina timezone
- Alphabetical channel sorting
- DNS bypass for global access
- TV-optimized navigation and UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-14 22:11:05 +00:00
parent 96c4c360ee
commit 5ade6350eb

View File

@@ -223,6 +223,8 @@ public class PlayerActivity extends AppCompatActivity {
super.onStart(); super.onStart();
if (player != null) { if (player != null) {
playerView.onResume(); playerView.onResume();
} else if (channelUrl != null) {
loadChannel();
} }
} }
@@ -245,9 +247,7 @@ public class PlayerActivity extends AppCompatActivity {
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
if (player != null) { releasePlayer();
playerView.onPause();
}
} }
@Override @Override