Skip to content

🐛 Fix background audio dying after iOS audio interruptions#27

Closed
williamchong wants to merge 1 commit intolikecoin:mainfrom
williamchong:main
Closed

🐛 Fix background audio dying after iOS audio interruptions#27
williamchong wants to merge 1 commit intolikecoin:mainfrom
williamchong:main

Conversation

@williamchong
Copy link
Copy Markdown
Member

Increase auto-resume retry window from ~3s (3×1s) to ~2min (60×2s) so playback survives longer OS interruptions like Timer alerts.

Increase auto-resume retry window from ~3s (3×1s) to ~2min (60×2s)
so playback survives longer OS interruptions like Timer alerts.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the iOS native audio bridge’s auto-resume behavior so playback is more likely to recover after longer OS-level audio interruptions (e.g., Timer alerts), improving background playback reliability.

Changes:

  • Increase MAX_AUTO_RESUME_RETRIES from 3 to 60.
  • Increase the auto-resume retry delay from 1s to 2s (extending the overall retry window to ~2 minutes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

getActivePlayer()?.play();
}
}, 1000);
}, 2000);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry delay is a raw 2000ms literal here. Since this value and MAX_AUTO_RESUME_RETRIES effectively define a single “auto-resume window”, consider hoisting the delay into a named *_MS constant near the other recovery constants to keep tuning centralized and self-documenting.

Copilot uses AI. Check for mistakes.

// Auto-resume & stuck detection state
const MAX_AUTO_RESUME_RETRIES = 3;
const MAX_AUTO_RESUME_RETRIES = 60;
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAX_AUTO_RESUME_RETRIES is now coupled to the retry delay (currently 2000ms below), but the relationship isn’t encoded anywhere. Consider introducing an AUTO_RESUME_RETRY_DELAY_MS constant and deriving the max retries from a single “total retry window” duration so future changes don’t accidentally skew the intended ~2min window.

Suggested change
const MAX_AUTO_RESUME_RETRIES = 60;
const AUTO_RESUME_RETRY_DELAY_MS = 2000;
const AUTO_RESUME_TOTAL_WINDOW_MS = 2 * 60 * 1000; // ~2 minutes
const MAX_AUTO_RESUME_RETRIES = Math.floor(
AUTO_RESUME_TOTAL_WINDOW_MS / AUTO_RESUME_RETRY_DELAY_MS,
);

Copilot uses AI. Check for mistakes.
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.

2 participants