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

fix: video gets stuck at silenceSpeed for a while when performing processing-heavy actions on the page #104

Open
WofWca opened this issue Aug 2, 2022 · 0 comments

Comments

@WofWca
Copy link
Owner

WofWca commented Aug 2, 2022

For example, open a video on YouTube and then open dev tools (F12), or try resizing the window.

Could be the reason for #24 (comment).

What I think happens is that the main thread gets overloaded and can't process messages from SilenceDetectorNode in a timely manner:

if (IS_DEV_MODE) {
const messageSentAt = data[1];
const delayS = elementSpeedSwitchedAt - messageSentAt;
if (delayS > 0.03) {
console.warn(`elementSpeedSwitchedAt - messageSentAt === ${delayS}s`);
}
}

Not sure what we can do about this. Putting this listener on a separate thread (#88) would be perfect, but AFAIK it's not possible to access DOM from within Workers.

Maybe we could measure how loaded the main thread currently is and if it is quite busy, don't switch to silenceSpeed. Maybe requestIdleCallback could help, idk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant