This is so easy and I, a software developer with no actual experience in that area, know the obvious solution that eludes that hundreds of developers with actual experience in the area. Meanwhile, I take umbrage when my product manager tells me that implementing the next feature will be easy and I'm exaggerating how complicated it is."
if (not_visible) { suspend_wait_and_stop_consuming_resources }
I can imagine that it gets massively more complicated. However, as, say, an executive, this probably indicates that you can lean on your sw dev staff to approach the asymptotic ideal that looks so simple if you really care about the goal.
[1] E.g. Firefox added some in version 58: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibi...
Well, the difficult part is not writing an if statement...
Contrats, you just broke the web for anyone doing one of the following:
- listening to music in the browser.
- having a webRTC chat with someone while browsing.
- keep reading another tab while waiting for a page to load.
And I'm probably missing a dozen of other totally legit use-cases.
Oh tell me about it. That's just about dead now. I mean, wasn't the point of multi tab browsing that I could do precisely that? Now I load Google Maps on my lethargic internet connection, go do something else for ten minutes, and come back and ... it starts loading when I open. This is on Firefox. Super sad.
Presumably there is no easy way to disable page JS but keep your youtube video downloading.
If they don't render while backgrounded, how do they do that without being noticeable?
I couldn’t find info on how often a keyframe is expected from YouTube, but I’m recalling the bad old divx days where you sometimes had a frame per scene and skipping was very slow.
I understand this is rare, but I just have a very very hard time understanding what is so hard about this.
Page not visible? Just stop it. Stop the layout engine, stop the javascript VM. If there was a transfer in progress, let it finish, a page might get the callback when it's active again ...
(I know there are some tricky cases, a lot of them, but there just isn't any reason why a browser with 30 tabs should be consuming over 1 % cpu...)