2. Player detection (and related problems) - tamius-han/ultrawidify GitHub Wiki
In order for this extension to work, it must know two things about the page we're on:
- how big is the video element
- how big is the player element
To determine that, we need to find those two elements.
The extension tries to find the correct player element. However, this method is not exactly foolproof: by guessing what the player is, this extension is making a few assumptions — and some sites do not conform to those assumptions.
For cases like this, Ultrawidify allows you to pick the correct player element.
That's because other extensions merely zoom the <video> element by the correct amount when you, the user, determines that aspect ratio is not correct. This approach has its benefits:
- it's much more reliable at cropping the video
But it also has its drawbacks:
- if you crop a video to an aspect ratio wider than your monitor, then the extension will crop away the left and right sides of the video
This drawback is not a big deal for extensions that require you to manually crop the video. Ultrawidify, on the other hand, attempts to correct aspect ratio automatically (with DRM-shaped asterisks).
By design, Ultrawidify only seeks to eliminate black bars surrounding the video. Once vertical black bars are cropped away, Ultrawidify will not crop the image further — even if some of the horizontal bars still remain (or vice versa).
Since videos can have aspect ratios wider than your ultrawide monitor (and because Ultrawidify also supports theater mode), the only way to ensure Ultrawidify doesn't crop too much is also knowing the dimensions of the player element.
This is a hassle other extensions don't have to bother with.
Checked by default. If this option is checked, the extension will try to find player element automatically.
CSS selectors that define the player element(s). You can separate multiple selectors with a comma. This is necessary on some sites as the selector of the player element changes depending on the context (e.g. whether the video is embedded or not).
More details: querySelectorAll() on MDN.
If this option is checked, query selector will be ignored and the player element determined by how many times you need to call element.parentNode to reach it.
Sometimes the problem is not player element detection. Sometimes, the video player on a video site just won't take the maximum possible width (Vimeo, I'm looking at you).
In cases like this, you need additional CSS in order to modify the player size on the page. The extension will inject it when it loads.
