You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MementoEmbed's Python code calls a Puppeteer script as an external process to take the screenshot. To solve the problem you've documented here, I first thought that we could raise the THUMBNAIL_TIMEOUT value in this config file used during development:
# Number of seconds to wait for the thumbnail script to finish
# before sending an error message back to the user
THUMBNAIL_TIMEOUT = "300"
but the value is set to 300 seconds, which is 5 minutes. This is how long the Python code will wait for Puppeter before giving up.
Our Trove examples produce (poor) thumbnails much faster than 5 minutes, so that timeout is clearly not in play. Instead, I wonder if the screenshot code itself needs to be modified.
I don't remember what units page.waitFor will take. According to the Puppeteer source code for the Page class, the waitFor method can accept a selector, predictor or timeout to wait for. Maybe that would be helpful?
When using "networkidle0", it waits for the network to be idle for 500ms. While there is no option to control the wait time/timeout there, we could emulate the puppeteer code to adjust the timeout. Tested with a timeout value of 2000ms instead of 500ms.
The thumbnail generated looks much better. We can try making adjustments to this timeout value to set the most suitable value considering the trade-off between the quality of the thumbnail and the time to generate the thumbnail.
Test URI-Ms:
https://webarchive.nla.gov.au/awa/20160210010019/http://pandora.nla.gov.au/pan/156727/20160210-1200/www.barefaced.com.au/index.html
https://webarchive.nla.gov.au/awa/20160229080832/http://www.barefaced.com.au/
Thumbnails generated through MementoEmbed for the above NLA URI-Ms:
Thumbnail 1
Thumbnail 2
It appears that the screenshot to be used as the thumbnail is captured from the URI-M at Trove too soon before the page completely loads.
The text was updated successfully, but these errors were encountered: