Skip to content

🎥 Make videos programmatically with React

this works on lambds

Jonny Burger02750b2f9e33
diff --git a/packages/renderer/src/browser/BrowserPage.ts b/packages/renderer/src/browser/BrowserPage.ts
index 79479f543b..780936d40f 100644
--- a/packages/renderer/src/browser/BrowserPage.ts
+++ b/packages/renderer/src/browser/BrowserPage.ts
@@ -344,20 +344,21 @@ export class Page extends EventEmitter {
}
async setViewport(viewport: Viewport): Promise<void> {
- const fromSurface = !process.env.DISABLE_FROM_SURFACE;
-
const request: SetDeviceMetricsOverrideRequest = {
mobile: false,
- width: fromSurface
- ? viewport.width
- : viewport.width * viewport.deviceScaleFactor,
- height: fromSurface
- ? viewport.height
- : viewport.height * viewport.deviceScaleFactor,
+ width: viewport.width,
+ height: viewport.height,
deviceScaleFactor: 1,
screenHeight: viewport.height,
screenWidth: viewport.width,
scale: viewport.deviceScaleFactor,
+ viewport: {
+ height: viewport.height * 2,
+ width: viewport.width * 2,
+ scale: 1,
+ x: 0,
+ y: 0,
+ },
};
const {value} = await this.#client.send(
diff --git a/packages/renderer/src/screenshot-task.ts b/packages/renderer/src/screenshot-task.ts
index 9b2de0c9ec..08503659c8 100644
--- a/packages/renderer/src/screenshot-task.ts
+++ b/packages/renderer/src/screenshot-task.ts
@@ -41,12 +41,6 @@ export const screenshotTask = async ({
color: {r: 0, g: 0, b: 0, a: 0},
});
- // We find that there is a 0.1% framedrop when rendering under memory pressure
- // which can be circumvented by disabling this option on Lambda.
- // To be determined: Is this a problem with Lambda, or the Chrome version
- // we are using on Lambda?
- // We already found out that the problem is not a general Linux problem.
-
const cap = startPerfMeasure('capture');
try {
let result;
@@ -69,6 +63,23 @@ export const screenshotTask = async ({
// we are using on Lambda?
// We already found out that the problem is not a general Linux problem.
const fromSurface = !process.env.DISABLE_FROM_SURFACE;
+ console.log(
+ clipRegion !== null && clipRegion !== 'hide'
+ ? {
+ x: clipRegion.x,
+ y: clipRegion.y,
+ height: clipRegion.height,
+ scale: 1,
+ width: clipRegion.width,
+ }
+ : {
+ x: 0,
+ y: 0,
+ height: height * scale,
+ scale: 1,
+ width: width * scale,
+ },
+ );
const {value} = await client.send('Page.captureScreenshot', {
format,
@@ -85,9 +96,9 @@ export const screenshotTask = async ({
: {
x: 0,
y: 0,
- height: fromSurface ? height : height * scale,
+ height: height * 2,
scale: 1,
- width: fromSurface ? width : width * scale,
+ width: width * 2,
},
captureBeyondViewport: true,
optimizeForSpeed: true,