timecut
timecut copied to clipboard
Using window.scrollTo become blank page
Bug - The video becomes blank if the page scrolls with window.scrollTo
I wanted to inject data into window, I tried using preparePage with page.evaluate() but that didn't seem to work either. Is there another way to access the page's window before it loads?
@ariel-frischer This sounds like your comment is unrelated to the issue you're posting under-- is that the case? If so, could you open a new issue? Also could you give more detail what you want to do? I'm not sure what you mean by accessing the page before it loads. Thanks!
As for the original issue with window.scrollTo, I'll try to replicate this when I have a chunk of time.
@tungs I've posted the details of my issue here as a feature request: https://github.com/tungs/timecut/issues/50
Bug confirmed. This seems to be due to setting the clip property of page.screenshot in capture-screenshots.js. Commenting out the line fixes this issue, though it also disables clipping the screenshot.
Adding window.scrollX and window.scrollY to x and y of the clip seems to compensate for this, though evaluating window.scrollX and window.scrollY per frame might be inefficient due to the asynchronous nature of page.evaluate. If there's a way to get scrollX and scrollY directly in puppeteer without having to evaluate it, that would be ideal, though if there is not, this compensation might be enabled / disabled via a configuration option.
The decision is whether this should be something to enable (and have something like config.enableClipRecalculation) or something to disable (either with something like config.performanceMode or config.disableClipRecalculation). Regardless, it's probably a good idea to not use a clip argument to page.screenshot if there aren't any custom clipping arguments.