SnosMe / uiohook-napi

MIT License
162 stars 37 forks source link

Event timestamp #20

Closed pie6k closed 1 year ago

pie6k commented 1 year ago

I need to record mouse movement with high precision in terms of "when" mouse movement occured

use case - rendering smooth cursor movement over screen recording video. This means even slight screen-recording-video<>mouse-data time mismatch is clearly visible

Seems that events triggered by the lib do not include time when event occurred. Eg event.timestamp

I can of course include Date.now in my event handler, but it will be date at the moment when I handle the event, not the time when event actually occured (eg system picked mouse move). As JS is single threaded - delay between event and my code handling it might vary a lot. (In my case more than 1/60s delay can already "ruin" it)

Do you think it is possible to include such information or do you have some tips how can I captures timestamp of mouse movements as precisely as possible?

SnosMe commented 1 year ago

I have not checked if this is in consistent units on all platforms. If it is not, we should report bug in the original repository.