Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get exact time when first frame is captured? #28

Open
pie6k opened this issue Sep 14, 2022 · 1 comment
Open

Is it possible to get exact time when first frame is captured? #28

pie6k opened this issue Sep 14, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@pie6k
Copy link

pie6k commented Sep 14, 2022

Thank you for this amazing lib!

I record screen and mouse movement info at the same time. I later 'blend it' together, so I need to know the exact time when recording actually started to avoid video<>mouse-data time missmatch.

.startRecording() promise resolves when recording starts, but it can be delayed by multiple reasons, eg main thread being busy.

It would be great if .startRecording() would return promise with something like firstFrameTimestamp

const { firstFrameTimestamp } = await recorder.startRecording(options)

This way I would know exactly at which point in time actual visual recording starts.

Do you have any suggestions how can I do that (even if it requires some hacks)

Alternatives I tried:
I thought 'stopRecording' method is way more lightweight, so I can capture 'endTime' (either before or after calling stopRecording), then measure recording duration reading recording file and then doing startTime = endTime - videoDuration. It might be more precise, but it is still subject to delays.

@sindresorhus
Copy link
Contributor

I agree, it would be useful to include the timestamp, however, it's unfortunately not something I have time to look into right now. PR welcome though. I think you could include the timestamp in one of the events sent from the Swift back-end.

@sindresorhus sindresorhus added enhancement New feature or request help wanted Extra attention is needed labels Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants