Merge pull request #39 from amhsirak/develop
fix: remote browser screencast lag
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
|||||||
BrowserContext,
|
BrowserContext,
|
||||||
} from 'playwright';
|
} from 'playwright';
|
||||||
import { Socket } from "socket.io";
|
import { Socket } from "socket.io";
|
||||||
import { fullLists, PlaywrightBlocker, Request } from '@cliqz/adblocker-playwright';
|
import { PlaywrightBlocker } from '@cliqz/adblocker-playwright';
|
||||||
import fetch from 'cross-fetch';
|
import fetch from 'cross-fetch';
|
||||||
|
|
||||||
import logger from '../../logger';
|
import logger from '../../logger';
|
||||||
@@ -124,7 +124,6 @@ export class RemoteBrowser {
|
|||||||
await this.changeTab(tabInfo.index - 1);
|
await this.changeTab(tabInfo.index - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// close the page and log it
|
|
||||||
await page.close();
|
await page.close();
|
||||||
logger.log(
|
logger.log(
|
||||||
'debug',
|
'debug',
|
||||||
@@ -187,9 +186,7 @@ export class RemoteBrowser {
|
|||||||
*/
|
*/
|
||||||
public makeAndEmitScreenshot = async (): Promise<void> => {
|
public makeAndEmitScreenshot = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const screenshot = await this.currentPage?.screenshot(
|
const screenshot = await this.currentPage?.screenshot();
|
||||||
{ type: 'jpeg', quality: 90, fullPage: true }
|
|
||||||
);
|
|
||||||
if (screenshot) {
|
if (screenshot) {
|
||||||
this.emitScreenshot(screenshot.toString('base64'));
|
this.emitScreenshot(screenshot.toString('base64'));
|
||||||
}
|
}
|
||||||
@@ -322,7 +319,7 @@ export class RemoteBrowser {
|
|||||||
logger.log('warn', 'client is not initialized');
|
logger.log('warn', 'client is not initialized');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.client.send('Page.startScreencast', { format: 'jpeg', quality: 90 });
|
await this.client.send('Page.startScreencast', { format: 'jpeg', quality: 75 });
|
||||||
logger.log('info', `Browser started with screencasting a page.`);
|
logger.log('info', `Browser started with screencasting a page.`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user