I just tried it. Unfortunately it does not seem to work with my use case where I use youtube to play music in a background tab while working on other things. I want it to block me from actively watching videos but playback in the background is fine in my case.
Thanks for recommending that. We actually do one better - we not only count time when browser tab is active, but also stop counting time when we don't detect activity or video playing for longer than 5 minutes :)