timer icon indicating copy to clipboard operation
timer copied to clipboard

[FEATURE] An option to keep tracking when there are videos playing

Open Vran-n opened this issue 9 months ago • 4 comments

I noticed this extension stops tracking even when there are videos playing in the tab. tried it on both Youtube and Twitch even on theater mode. I do know it works in fullscreen, I just thought id be better if it also worked on windowed

Vran-n avatar Mar 10 '25 06:03 Vran-n

@Vran-n I agree with you and I've tried this before.

but it's really hard to judge if the video should be tracked. sometimes there is a video elememt in the dom tree, while it's actually hidden or no size. and sometimes it just plays in some unconspusuous places without eye catching. So I only force to track the fullscreen time.

This might be implemented after detailed designing, i think

sheepzh avatar Mar 10 '25 08:03 sheepzh

@sheepzh Are there any cases wherein it isnt too difficult to judge? Because my suggestion is to split updates into potentially 2 parts if that were the case like putting exceptions in some major sites.

Vran-n avatar Mar 10 '25 11:03 Vran-n

I know you.

I will implement this feature after I think it through, for now I will just hang on. Thanks for your feedback~

sheepzh avatar Mar 10 '25 15:03 sheepzh

I noticed it too. I was watching a Youtube video that is not full screen on Firefox browser. It stopped tracking after 10 minutes. Tracking works fine when watching full screen videos.

but it's really hard to judge if the video should be tracked. sometimes there is a video elememt in the dom tree, while it's actually hidden or no size. and sometimes it just plays in some unconspusuous places without eye catching. So I only force to track the fullscreen time.

Can this be a setting that can be toggled by the user "Keep tracking when videos are playing"? This can be off by default.

I understand that videos could be intentional (ex. Youtube) or unintentional (ex. Some websites playing video ads) but at least the user can decide to accept this possibility.

herrbrixter avatar Mar 25 '25 03:03 herrbrixter

To track / pause time when audio is playing for a particular tab. tab.audible property true = tab is currently playing audio false = tab is silent

So it knows when any tab is making sound regardless of whether it's active or in the background.

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
  if (changeInfo.audible !== undefined) {
    if (changeInfo.audible === true) {
      // Start tracking time for this tab
      startTimer(tabId, tab.url);
    } else {
      // Stop tracking time for this tab
      stopTimer(tabId);
    }
  }
});

if someone wanted to bypass this they could watch video muted and true this won't detect it but this is a simple way to limit oneself to a daily limit of video/audio consumption.

mrfragger avatar Nov 08 '25 13:11 mrfragger

by judging audio on or off is really a good idea. I ll consider it, thank you @mrfragger

but the time tracking event is sent by content script from tabs. so we need to find another API to listen audio paused or resumed. also welcome to PR

sheepzh avatar Nov 08 '25 13:11 sheepzh

finished in v3.7.3

sheepzh avatar Nov 11 '25 11:11 sheepzh