Skip to content

Conversation

@biplavbarua
Copy link
Contributor

This PR adds a new feature "Force Background Play".

Problem:
Many websites use the Page Visibility API to automatically pause media or reduce quality when the tab is backgrounded or minimised. This disrupts the user experience for those who want to listen to video content in the background.

Solution:
I added a configurable option (default off) that, when enabled:

  • Overrides document.hidden to always return false.
  • Overrides document.visibilityState to always return 'visible'.
  • Intercepts and blocks visibilitychange events.

Changes:

  • Added BackgroundMode class in contentScript/main.
  • Updated State type and ConfigSync to handle the new flag.
  • Added UI toggle in SectionFlags.
  • Added English locale strings.

@polywock polywock merged commit d9ec0b7 into polywock:master Dec 12, 2025
polywock pushed a commit that referenced this pull request Dec 13, 2025
@polywock
Copy link
Owner

Thanks for the contribution! I liked the idea and went ahead and merged the PR.

I made a few follow-up changes:

  1. Added translations for additional locales.

  2. Made the feature configurable via the options page (it’s currently tucked under the three-dot menu, since I’d prefer more testing before broader use).

  3. Added support for URL conditions so users can enable it only on specific websites.

  4. Included document.webkitHidden and document.webkitVisibilityState just in case.

  5. Removed the addEventListener override. The feature should still work in ~99% of cases without it.

@biplavbarua
Copy link
Contributor Author

Thanks, @polywock! I'm glad you liked the feature. Appreciate you taking the time to review and integrate it with those improvements (especially the URL conditions). Happy to have contributed!

@polywock
Copy link
Owner

polywock commented Dec 17, 2025

Hello! Although I liked the idea, I did ultimately have to remove it. This is because it caused issues on several anime websites. I might add it back if I can figure a way to fix the issue.

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