chrishtr / battery-savings

14 stars 5 forks source link

"prefer" vs. "allow" #1

Open inexorabletash opened 4 years ago

inexorabletash commented 4 years ago

Just a drive by from skimming the explainer:

The meta tag has: allow-reduced-framerate The media query has: prefer-reduced-framerate

Should these align? So far as I can tell, they mean the same thing: if the UA is going to throttle the site, prefer to sacrifice frame rate before script speed or other techniques.

...

Which begs the question - should the naming be inverted? Should the site instead indicate what it prioritizes to keep rather than what to give up? e.g. "prefer-high-framerate", "prefer-script-speed", etc. I don't know the domain very well here, or how the set of options will grow over time and what knobs UAs actually have, so this may not make sense.

chrishtr commented 4 years ago

Good point about naming - I changed the explainer to suggest reduced-framerate for the media query, since the media query is for cases where for sure reduced framerate is in fact happening.

You raise good questions as well about which direction the preferences should go. I think we might end up needing preferences in both directions, as well as an auto mode when no preference was made.

jimmywarting commented 4 years ago

Read upon #3 of how to detect the mode

You have already introduced a css solution.

and a javascript solution to check if dark mode is enabled is throught matchMedia

const {matches, onchange} = matchMedia('(prefers-color-scheme: dark)')

can only imagine a similar approach for prefer-reduced-framerate

const {matches, onchange} = matchMedia('(prefer-reduced-framerate: true)')

But i think it's confusing to assume that prefer-reduced-framerate is the equivalent to battery saving Would maybe want this instead

const {matches, onchange} = matchMedia('(prefer-battery-saving: true)')
jimmywarting commented 4 years ago

we already have prefers-reduced-motion and that is very similar to the term prefer-reduced-framerate IMO
So i don't think we need another prefer-reduced-framerate?

...or do i have some misconception of what they both mean?

Maybe we should have

<meta name="battery-savings" content="prefers-reduced-motion">

...instead?

Just speculation: When OS goes into power saving mode, the system could then also change prefers-reduced-motion to true if the config is set to "auto". so prefers-reduced-motion could be a way to detect battery saving mode 🙃

CrazyPython commented 3 years ago

When the OS goes into power saving mode, what does Chrome on Android currently do?