Code Monkey home page Code Monkey logo

video-bg-play's Introduction

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

video-bg-play's People

Contributors

buttercookie42 avatar timdream avatar aroskuski avatar jogarweb avatar mozilla-github-standards avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.