mpv
mpv copied to clipboard
Render video ONLY if player is in focus
Why is this not a feature in mpv? Most browsers do it natively to save power. If you are streaming a youtube video in mpv but the player is not in focus, it should only decode audio.
Pretty sure it does this under wayland already, if by "in focus" you mean "not hidden".
Why is this not a feature in mpv?
because you didn't implement it.
I'm pretty sure it continues decoding the video, but it doesn't get rendered.
[background]
profile-cond=not focused and get("current-tracks/video/albumart") == false
profile-restore=copy-equal
vid=0
In wayland, it only renders if the mpv window isn't hidden as mentioned above. x11 actually does this too as well although most WMs in practice will only send _NET_WM_STATE_HIDDEN when the window is minimized.
[background] profile-cond=not focused and get("current-tracks/video/albumart") == false profile-restore=copy-equal vid=0
That's probably not what the OP wants, and it's not the behaviour of browsers either. "Focus" is the wrong word here. Maybe they are looking for the term "minimize" or window occlusion.
Refusing to decode video when the window isn't in focus doesn't make sense, as you create latency when you re-focus on the window.
However, mpv doesn't render the video if it wouldn't make it to the screen. At least on wayland, and I believe on x11 as well if the player is minimized.
profile-cond=not focused and get("current-tracks/video/albumart") == false profile-restore=copy-equal vid=0
This code has introduced significant stuttering in audio when mpv is not in focus, why is that?