Break Page Visibility API and Fullscreen API so video plays in background
Перейти к файлу
Jan Henning 234b1bf3eb v1.7.0 2023-05-01 13:50:56 +02:00
_locales Add Czech translation 2023-04-30 22:19:42 +02:00
.gitignore zip -> xpi 2017-05-05 17:00:35 +08:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file 2019-04-01 22:24:44 +02:00
LICENSE Add LICENSE and mention API blocked, and mention technical detail 2017-05-14 10:49:44 +08:00
Makefile Add icon 2018-12-25 17:01:40 +01:00
README.md Include logo in readme 2019-01-14 21:25:29 +01:00
icon.svg Add icon 2018-12-25 17:01:40 +01:00
manifest.json v1.7.0 2023-05-01 13:50:56 +02:00
video-bg-play-content.js Improve domain detection regex 2021-03-17 18:36:57 +01:00

README.md

Video Background Play Fix logo

Firefox for Android can continue playing video even if you switch to another tab or app. However, sites can detect these user actions with the Page Visibility API and the Fullscreen API. This add-on is designed to block events and properties exposed by the APIs.

License

Add-on code: MIT.

"Glasses" icon used in the logo by rahmatmasiv from the Noun Project under the CC BY 3.0 US.

Technical detail

The add-on injects a content script to replace the properties exposed, and stops events from propagating when applicable.

Page Visibility API

The add-on blocks visibilitychange event, and set document.hidden to be always false and document.visibilityState to be forever visible.

Fullscreen API

The add-on doesn't generally override the Fullscreen API because at the moment this is not required and the original implementation caused some broken UI after existing fullscreen. As a site-specific workaround, we do however block fullscreenchange events on Vimeo to prevent playback from stopping when exiting fullscreen.

User activity tracking

Some pages stop playback if they don't detect any user activity for a certain amount of time. To avoid this, the add-on ensures that the time of the last user activity is regularly updated.

Sites

As a demonstration, the content script currently injects itself to the following sites:

  • youtube.com and youtube-nocookie.com
  • vimeo.com