Skip to content

feat: add exit confirmation dialog to prevent accidental player exits#2838

Open
AiCurv wants to merge 1 commit into
recloudstream:masterfrom
AiCurv:feature/exit-confirmation-dialog
Open

feat: add exit confirmation dialog to prevent accidental player exits#2838
AiCurv wants to merge 1 commit into
recloudstream:masterfrom
AiCurv:feature/exit-confirmation-dialog

Conversation

@AiCurv
Copy link
Copy Markdown

@AiCurv AiCurv commented May 25, 2026

Summary

Shows a confirmation dialog when pressing back during video playback, preventing accidental exits that would lose the buffered stream.

Currently, a single back press instantly exits the player, discarding the entire buffered stream. This is especially frustrating on devices with sensitive back buttons or gesture navigation where accidental presses are common.

Changes

FullScreenPlayer.kt

  • Added showExitConfirmDialog() method that shows an AlertDialog with "Exit Player?" title and "Your buffered stream will be lost" message
  • Replaced activity?.popCurrentPage("FullScreenPlayer") with showExitConfirmDialog() in the back press handler
  • Restores immersive mode (hideSystemUI()) when dialog is dismissed without exiting
  • Handles edge cases: prevents showing dialog if activity is finishing/destroyed, prevents duplicate dialogs

DownloadedPlayerActivity.kt

  • Added same showExitConfirmDialog() method for external player intents
  • Replaced finish() with showExitConfirmDialog() in the back press callback
  • Pressing back while dialog is showing dismisses it instead of creating a new one

strings.xml

  • Added exit_player_confirm_title ("Exit Player?")
  • Added exit_player_confirm_message ("Your buffered stream will be lost. Are you sure you want to exit?")
  • Reuses existing yes and no string resources for dialog buttons

User Experience

Before: Back press → instant exit, stream and buffer lost
After: Back press → confirmation dialog → user chooses Yes to exit or No to continue watching

The dialog uses the existing AlertDialogCustom style for visual consistency with the rest of the app.

Testing

  • Verified dialog appears on back press in FullScreenPlayer
  • Verified dialog appears on back press in DownloadedPlayerActivity (external player mode)
  • Verified pressing "No" dismisses dialog and returns to playback with immersive mode restored
  • Verified pressing "Yes" exits the player as expected
  • Verified duplicate dialogs cannot be created by pressing back multiple times

Show a confirmation dialog when pressing back during playback,
preventing accidental exits that would lose the buffered stream.

- FullScreenPlayer: Replace instant popCurrentPage() with
  showExitConfirmDialog() that shows AlertDialog before exiting
- DownloadedPlayerActivity: Replace instant finish() with
  showExitConfirmDialog() that shows AlertDialog before exiting
- Add exit_player_confirm_title and exit_player_confirm_message
  string resources
- Restore system UI (immersive mode) when dialog is dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant