Time in multiple states stats

I’m looking to create something similar to a history_stats sensor that keeps a daily total of all the apps used in a current data. I can get this data easily from the media_player attribute app_name.

In my looking, is there really no way in HA to track time in different states without creating multiple history stats (one per app!) along with a sensor to watch? I would have thought this was an easy task.

I want to be able to look at the data and say ‘youtube’ was watched for X hours, netflix, etc… I don’t want to start creating dozens of history_stats and sensors just to do this. Any other options?