Originally Posted by qweasd
A fun fact, very related: my wife watches a lot of youtube in web browser, and there seems to be no bloody way to detect THAT activity.
Caffeine-ng may be able to do that, but to be honest I don't watch videos in my browser so I have not tested that. A much better solution would be to install youtube-dl and mpv (Be sure to compile with lua) and then you will be able stream many videos if you just do.
Additionally this support many more sites than just youtube as seen in this link.
Mpv supports xdg-screensaver so that should be able to disable xscreensaver when watching any videos without issue. Also you will notice that video quality streamed with mpv is higher than when watched with the youtube.com player, I guess youtube intentionally lower the quality.
The one downside is that there is a constant battle between youtube and youtube-dl, so when something stops working update youtube-dl...