From aeabc1810131a249ed8bab933ee19837691bf56b Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Mon, 18 May 2020 20:53:43 -0400 Subject: tried to fix youtube snapshotter --- src/server/ApiManagers/UploadManager.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/ApiManagers/UploadManager.ts b/src/server/ApiManagers/UploadManager.ts index 1ab81803f..60c52bcfc 100644 --- a/src/server/ApiManagers/UploadManager.ts +++ b/src/server/ApiManagers/UploadManager.ts @@ -289,12 +289,13 @@ async function captureYoutubeScreenshot(targetUrl: string): Promise> const page = await browser.newPage(); await page.setViewport({ width: 1920, height: 1080 }); - await page.goto(targetUrl, { waitUntil: 'networkidle0' }); + await page.goto(targetUrl, { waitUntil: 'networkidle2' as any }); + const videoPlayer = await page.$('.html5-video-player'); // hide youtube player controls. - await page.evaluate(() => (document.querySelector('.ytp-chrome-bottom') as any).style.display = 'none'); + await page.evaluate(() => + (document.querySelector('.ytp-chrome-bottom') as any).style.display = 'none'); - const videoPlayer = await page.$('.html5-video-player'); const buffer = await videoPlayer?.screenshot({ encoding: "binary" }); await browser.close(); -- cgit v1.2.3-70-g09d2