Giter VIP home page Giter VIP logo

bee-fast-video's Introduction

Bee fast video

Install ๐Ÿ on Chrome or Firefox.

Bee fast video banner

Bee fast video is a browser extension that offers greater control over videos on all websites.

You can

Controls

  • โœ… speed up (X) and slow down any video (Z)
  • โœ… seek forward (D) and backward (A) through any video
  • โœ… seek video to % on any video (like on YouTube) (0 โ€“ 9)
  • โœ… play and pause (S) any video
  • โœ… bring to front and enable native video controls for all videos on the page (reload the page to turn off)
  • โœ… toggle loop for any video
  • โœ… toggle Picture-in-Picture (P) for any video
  • โœ… enable/disable controls on any website; useful for video conferencing

Development notes

The extension was initially made based on a Preact template, with most of the extra stuff removed. The Preact was later replaced by Solid from version v1.2.0.

The extension consists of the content script and a popup. These two components via browserContext and settings.

Content script

ControllersContainer

Most of the important bits are located within the content script. The execution starts from src/content/index.tsx. There, the ControllersContainer rendered. ControllersContainer initially queries all available videos, after which it keeps track of newly added/removed videos via observeForVideoElements mutation observer. For every video we render a Controller component, which receives the reference to that video element. ControllersContainer is intentionally rendered as an absolutely positioned, zero width and height element, in the top left corner of the page; Its purpose is to house the Controller components, which are absolutely positioned over the top left corner of the video in respect to the ControllersContainer.

Note: The only setting that the ControllersContainer is keeping track of is bring-to-top and enable the native controls. Once turned on, this setting will be applied to all videos, while being a bit destructive. It yanks the video from its parent and appends it to the body while trying to maintain its original position. It also forces the video controls to be turned on. The Controller will observe if some other actor (e.g. YouTube page) tries to turn off the native controls and turn them on as soon as this happens.

Controller

The Controller both updates the video element based on the user actions, and keeps track of changes related to the video element. It will update its state based on these changes. It will try to adjust its position to be on top of its video immediately (if it's possible to detect) and periodically (to cover the cases where it's not possible to easily detect such changes). The Controller will register listeners for keyboard shortcuts using the keyboardListener. It will keep track if the extension is considered disabled and unregister all listeners.

Popup

The popup is there to present functionality and shortcuts to the user. It must be manually kept in sync if either the functionality or shortcuts change.

Styles

Styles are written in SCSS and are imported as transformed CSS text. This text is then used as content for the <style>...</style> tag.

import cssText from "./some.scss?inline";

<style>{cssText}</style>

This setup circumvents issues related to processing and bundling of the styles. We want to keep the styles completely separate for the content script and the popup. Another benefit of this setup is that we don't have to declare each .css file in the extension manifest for the content script.

Commands

  • Dev build npm run dev
    • auto reload popup content on file save. You still have to manually reload the extension to observe the changes in the content script
    • enabled inlined source maps
  • Prod build npm run build

Note: Both builds are effectively split in two parts, due to vite/rollup's) limitation. Read more on this in vite.config.ts.

Be fast video logo

bee-fast-video's People

Contributors

tsopeh avatar

Watchers

 avatar

bee-fast-video's Issues

Function proposal

  1. in video on voe.sx,upstream.to,vidoza.net... in full screen I don't see taskbar with controls.
  2. please add customize position taskbar with controls
  3. please add mouse wheel controls like in Tweaks for youtube extension (Interaction Zones)
    zoomit

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.