Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 57 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ Website: https://fullorama.com
[![Install from the Chrome Web Store](https://img.shields.io/badge/Get_it_on-Chrome_Web_Store-4285F4?style=for-the-badge&logo=googlechrome&logoColor=white)](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg)
[![Install from Firefox Add-ons](https://img.shields.io/badge/Get_it_on-Firefox_Add--ons-FF7139?style=for-the-badge&logo=firefoxbrowser&logoColor=white)](https://addons.mozilla.org/firefox/addon/fullorama/)

Fullorama for YouTube™ adds one crop button directly to YouTube's player. Turn
it on once and videos stay zoomed to fill across videos, refreshes, navigation,
and fullscreen, until you turn it off.
Fullorama for YouTube™ adds one button directly to YouTube's player. Choose Crop
or Stretch in the toolbar popup, then click the player button to turn that mode
on or off. Crop zooms in evenly to fill the player and trims the edges; stretch
widens the picture to fill it and leaves nothing out. The choice stays across
videos, refreshes, navigation, and fullscreen, until you change it.

Built for 21:9 and other ultrawide displays.

Expand All @@ -30,62 +32,66 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052

## Features

- YouTube player button for ultrawide crop / zoom-to-fill
- Global persistent on/off state across videos, refreshes, and navigation
- Choose Crop or Stretch in the toolbar popup
- An Original frame and two looping result previews show what each mode does
- YouTube player button turns the selected mode on or off
- Crop mode zooms evenly to fill the player and trims the edges
- Stretch mode fills the player without trimming, at the cost of distortion
- The selected mode and on/off state persist across videos, refreshes, and navigation
- Works with YouTube's single-page navigation
- Works in theater mode and fullscreen
- Read-only popup shows current crop status
- Popup shows the selected mode and whether it's on or off
- Optional feedback form (popup link and uninstall survey)

## FAQ

### How do I watch YouTube full screen on an ultrawide monitor?

Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Look at the bottom-right of the player: there's a new button with four little corner brackets, next to the settings gear. Click it and the video zooms in to fill the player. A small square appears in the middle of the icon to show it's on. Click it again to go back to normal.
Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Click Fullorama's icon in your browser toolbar and choose Crop or Stretch from the two result cards under the Original frame. Crop zooms the video in to fill the player; stretch fills it without trimming anything, at the cost of distortion. Then use the new button with four little corner brackets at the bottom-right of the player, next to the settings gear, to turn that mode on or off. A small square (crop) or wide bar (stretch) appears in the middle of the icon while it's on.

### I can't find the button. Where is it?

It's with YouTube's own buttons at the bottom-right of the video, between the settings gear and the theater-mode button. Move your mouse over the video if the controls are hidden. If the button isn't there, refresh the YouTube tab once. Tabs that were already open when you installed Fullorama don't get it until you do.

### Will the video look stretched?

No. Fullorama zooms in evenly from the center, so people and objects keep their normal shape. The trade-off is that a little of the edges gets trimmed.
Crop mode doesn't stretch anything. It zooms in evenly from the center, so people and objects keep their normal shape; the trade-off is that a little of the edges gets trimmed. Stretch mode does stretch the picture to fill the player and will make it look wider or taller than it is. Nothing gets trimmed in stretch mode. Use crop if you care more about shape, and stretch if you care more about seeing the whole frame. The player button turns the selected mode off at any time.

### Why do some videos still have black bars?

Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with the button on. It also can't show picture that was never in the video.
Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with a mode on. It also can't show picture that was never in the video.

### Does it work in theater mode and fullscreen?

Yes. When you switch to theater mode or fullscreen, the zoom adjusts automatically to fill the new size.
Yes. When you switch to theater mode or fullscreen, the scaling adjusts automatically to fill the new size.

### Do I have to click it for every video?

No. Turn it on once and it stays on as you watch more videos, refresh, or browse around YouTube. Turn it off the same way whenever you like. The setting applies to all of YouTube in that browser.
No. Pick a mode once and it stays selected as you watch more videos, refresh, or browse around YouTube. It also remembers whether it was on or off. Change either from the toolbar popup or the player button whenever you like. The setting applies to all of YouTube in that browser.

### Does it work on 21:9 and 32:9 ultrawide monitors?

Yes. Fullorama works out the zoom from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. On wider screens, a little more of the edges is trimmed.
Yes. Fullorama works out the scaling from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. In crop mode, wider screens trim a little more of the edges; stretch mode fills them without trimming.

### Can I fill the screen and still see the whole picture?

Only if the video is already the same shape as your screen. Otherwise a little of the edges is trimmed to fill it. You can turn the button off any time to see the whole picture.
Only if the video is already the same shape as your screen. Crop mode trims a little of the edges to fill it; stretch mode keeps everything but distorts the shape. You can turn the selected mode off any time to see the original picture.

### Does it work on Netflix, other sites, or my phone?

No, only YouTube in a desktop browser (Chrome or Firefox). It doesn't work on Netflix, Prime Video, other websites, or the YouTube app on phones and TVs.

### Will it slow YouTube down or make videos sharper?

It just zooms in on the video that's already playing, so it doesn't change the video's quality or load anything extra. Zooming in won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching.
It just scales the video that's already playing, so it doesn't change the video's quality or load anything extra. Scaling won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching.

### What's the toolbar icon for?

Clicking Fullorama's icon in your browser toolbar shows whether the zoom is on or off, and has a link to send us feedback. To turn it on or off, use the button in the video player.
Clicking Fullorama's icon in your browser toolbar opens the mode picker. It shows whether the selected mode is on or off, alongside an Original frame and the two results: Crop keeps the shape and cuts off the edges; Stretch shows everything and pulls the video to fit. Clicking a card selects that mode and turns it on. To turn the selected mode off, use the button in the video player.

### Does Fullorama collect my data?

No. It saves one thing in your browser: whether the zoom is on or off. It doesn't track what you watch, has no ads, and needs no account.
No. It saves two things in your browser: which mode you selected and whether it's on or off. It doesn't track what you watch, has no ads, and needs no account.

Feedback is optional and goes through a separate form run by Tally. It opens if you choose "Share feedback" in the toolbar popup, or after you uninstall. The form link includes the extension's version and where you opened it from. On Firefox, those two details are only sent if you've allowed the optional data permission. See the [privacy policy](https://fullorama.com/privacy) for the full details.

Expand All @@ -95,24 +101,45 @@ Yes, completely free and open source. The code is on GitHub under the [MIT licen

## How It Works

The extension stores one boolean, `cropEnabled`, in extension local storage (`chrome.storage.local` on Chrome and `browser.storage.local` on Firefox).

A read-only toolbar popup displays whether crop is currently on or off by
reading the stored value once when opened. The popup cannot toggle crop — only
the player button can. A tiny background script registers an uninstall survey
URL so the browser can open the optional feedback form if you remove the
extension.

When crop is enabled, the content script adds a class to YouTube's
`#movie_player` element and sets a CSS scale variable based on the current
player aspect ratio and video aspect ratio. The CSS clips the player and scales
the rendered video from the center.
The extension stores `fillMode` (`crop` or `stretch`) and `fillEnabled`
(`true` or `false`) in extension local storage (`chrome.storage.local` on Chrome
and `browser.storage.local` on Firefox). Two values are needed because the
player can be off while still remembering which mode its button will turn back
on. Upgrading from a version before 1.3.0 moves the older `cropEnabled` boolean
to `fillEnabled` and removes the old key. That migration is temporary and will
be removed in the release after 1.3.0.

The toolbar popup is interactive. It reads the state once and shows the status in
the header (`Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`) with
a green dot when on. A static `Original` frame above a branching connector shows
the square video inside a 21:9 player with side bars. The two result cards loop
between the original frame and the mode applied. They are CSS-only: each card
holds the square still in a 21:9 box, scaled uniformly by `21 ÷ 9 = 2.3333` for
crop or on the X axis only for stretch, on the same 5-second loop. The selected
card gets a white outline and a filled radio, and the selected Crop card shows
the cut-off parts as a faded overflow above and below the frame. Under
`prefers-reduced-motion: reduce` the loop stops and each card holds its applied
state. Clicking a card calls `selectMode`, which selects that mode and turns fill
on. The player button calls `toggleEnabled`, so it only turns the selected mode
off and on. A tiny background script registers an uninstall survey URL so the
browser can open the optional feedback form if you remove the extension.

When enabled, `applyFill` reads the state itself and adds `flrm-fill-on` to
YouTube's `#movie_player` element, setting `--flrm-scale-x` and `--flrm-scale-y`
from the current player and video aspect ratios. Crop sets both variables to the
same scale and clips the overflow, so the picture fills the player without
changing shape. Stretch sets the shorter axis to 1 and the longer axis to the
fill scale, so the picture fills the player but changes shape. `content.css`
applies one transform from the center. If the player size is not known yet,
`applyFill` clears the previous fill so changing modes early cannot leave stale
geometry behind.

YouTube rebuilds parts of its player during normal navigation, so the extension
uses YouTube navigation events, a controls-scoped `MutationObserver`, a
player-scoped `ResizeObserver`, video metadata events, window resize, fullscreen,
and short retry bursts to keep the button and crop state in sync. Player-size
changes automatically recalculate the crop when entering or leaving theater mode.
and short retry bursts to keep the button and mode state in sync. Player-size
changes automatically recalculate the scaling when entering or leaving theater
mode.

## Install Locally

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fullorama",
"version": "1.2.1",
"version": "1.3.0",
"description": "Fill your ultrawide screen with YouTube videos without distracting black bars.",
"type": "module",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function copyStatic(target: BuildTarget): void {
copyFileSync('src/content.css', `${target.distDir}/content.css`);
copyFileSync('src/popup/popup.html', `${target.distDir}/popup.html`);
copyFileSync('src/popup/popup.css', `${target.distDir}/popup.css`);
copyFileSync('src/popup/preview.jpg', `${target.distDir}/preview.jpg`);
rmSync(`${target.distDir}/icons`, { recursive: true, force: true });
cpSync('icons', `${target.distDir}/icons`, { recursive: true });
}
Expand Down
17 changes: 13 additions & 4 deletions src/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,24 @@
display: block;
}

.flrm-btn[aria-pressed="false"] .flrm-on {
.flrm-btn .flrm-crop,
.flrm-btn .flrm-stretch {
display: none;
}

#movie_player.flrm-crop-on {
.flrm-btn[aria-pressed="true"][data-flrm-mode="crop"] .flrm-crop {
display: block;
}

.flrm-btn[aria-pressed="true"][data-flrm-mode="stretch"] .flrm-stretch {
display: block;
}

#movie_player.flrm-fill-on {
overflow: hidden !important;
}

#movie_player.flrm-crop-on video.html5-main-video {
transform: scale(var(--flrm-scale, 1)) !important;
#movie_player.flrm-fill-on video.html5-main-video {
transform: scale(var(--flrm-scale-x, 1), var(--flrm-scale-y, 1)) !important;
transform-origin: center center !important;
}
19 changes: 10 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/**
* Fullorama for YouTube™
*
* Adds a crop button to the YouTube player that zooms the video to fill
* the player, removing letterboxing. The toggle persists in
* Adds a button to the YouTube player that turns the selected fill mode on or
* off. The toolbar popup chooses crop (uniform zoom that trims edges) or
* stretch (scales one axis and distorts). The mode and on/off state persist in
* chrome.storage.local across videos, refreshes, and navigation.
*/

import { loadState, onStorageChange } from './storage/state';
import { updateButton } from './player/button';
import { applyCrop } from './player/crop';
import { applyFill } from './player/fill';
import { getPlayer } from './player/dom';
import {
applyCropAndSync,
applyCropNow,
applyFillAndSync,
applyFillNow,
onVideoMetadata,
resetObserver,
retryBurst,
Expand All @@ -24,12 +25,12 @@ async function init(): Promise<void> {
// Sync from other tabs
onStorageChange(() => {
updateButton();
applyCrop(getPlayer());
applyFill(getPlayer());
});

// Apply crop immediately on resize and fullscreen
window.addEventListener('resize', applyCropNow, { passive: true });
document.addEventListener('fullscreenchange', applyCropAndSync);
// Apply the selected mode immediately on resize and fullscreen
window.addEventListener('resize', applyFillNow, { passive: true });
document.addEventListener('fullscreenchange', applyFillAndSync);
document.addEventListener('yt-navigate-finish', retryBurst);
document.addEventListener('yt-navigate-start', resetObserver);
document.addEventListener('loadedmetadata', onVideoMetadata, true);
Expand Down
55 changes: 39 additions & 16 deletions src/player/button.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Button — injects and manages the crop toggle button in YouTube's player.
* Button — injects and manages the mode button in YouTube's player.
*/

import { isEnabled, toggleCrop } from '../storage/state';
import { applyCrop } from './crop';
import { getMode, isEnabled, toggleEnabled } from '../storage/state';
import { applyFill } from './fill';
import { getPlayer } from './dom';

const BUTTON_ATTR = 'data-flrm-btn';
Expand Down Expand Up @@ -49,7 +49,7 @@ function createIcon(): SVGSVGElement {
svg.append(
group,
svgElement<SVGRectElement>('rect', {
class: 'flrm-on',
class: 'flrm-crop',
x: '13',
y: '13',
width: '10',
Expand All @@ -58,17 +58,47 @@ function createIcon(): SVGSVGElement {
fill: 'currentColor',
stroke: 'none',
}),
svgElement<SVGRectElement>('rect', {
class: 'flrm-stretch',
x: '10',
y: '15',
width: '16',
height: '6',
rx: '1',
fill: 'currentColor',
stroke: 'none',
}),
);

return svg;
}

function syncButtonState(button: HTMLElement): void {
const mode = getMode();
const enabled = isEnabled();
const label = `Fullorama: ${mode} ${enabled ? 'on' : 'off'}`;
const pressed = String(enabled);

if (button.dataset.flrmMode !== mode) {
button.dataset.flrmMode = mode;
}
if (button.title !== label) {
button.title = label;
}
if (button.getAttribute('aria-label') !== label) {
button.setAttribute('aria-label', label);
}
if (button.getAttribute('aria-pressed') !== pressed) {
button.setAttribute('aria-pressed', pressed);
}
}

function onButtonClick(event: Event): void {
event.preventDefault();
event.stopPropagation();
toggleCrop();
toggleEnabled();
updateButton();
applyCrop(getPlayer());
applyFill(getPlayer());
}

export function injectButton(
Expand All @@ -82,12 +112,9 @@ export function injectButton(
const button = document.createElement('button');
button.setAttribute(BUTTON_ATTR, '');
button.className = 'ytp-button flrm-btn';
button.title = 'Fullorama crop';
button.setAttribute('aria-label', 'Fullorama crop');
button.setAttribute('aria-pressed', String(isEnabled()));
button.append(createIcon());

button.addEventListener('click', onButtonClick);
syncButtonState(button);

controls.insertBefore(
button,
Expand All @@ -99,11 +126,7 @@ export function updateButton(): void {
const btn = document.querySelector<HTMLElement>(
'#movie_player [' + BUTTON_ATTR + ']',
);
if (!btn) {
return;
}
const pressed = String(isEnabled());
if (btn.getAttribute('aria-pressed') !== pressed) {
btn.setAttribute('aria-pressed', pressed);
if (btn) {
syncButtonState(btn);
}
}
Loading
Loading