Skip to content

🎥 Make videos programmatically with React

how about now

Jonny Burgere798b7cb0531
diff --git a/packages/it-tests/package.json b/packages/it-tests/package.json
index a6d9c9822c..14eb9b568c 100644
--- a/packages/it-tests/package.json
+++ b/packages/it-tests/package.json
@@ -9,6 +9,7 @@
"test": "bun test src/rendering --run",
"testssr": "bun test src/ssr src/bundle src/templates src/monorepo --timeout 40000",
"testlambda": "exit 0",
+ "lint": "tsc -d",
"formatting": "prettier src --check"
},
"private": true,
diff --git a/packages/it-tests/props.json b/packages/it-tests/props.json
new file mode 100644
index 0000000000..3380bed741
--- /dev/null
+++ b/packages/it-tests/props.json
@@ -0,0 +1 @@
+{"flag":true}
\ No newline at end of file
diff --git a/packages/it-tests/src/bundle/bundle-studio.test.ts b/packages/it-tests/src/bundle/bundle-studio.test.ts
index 8ecb16a767..28d2facfa4 100644
--- a/packages/it-tests/src/bundle/bundle-studio.test.ts
+++ b/packages/it-tests/src/bundle/bundle-studio.test.ts
@@ -6,7 +6,14 @@ import path from 'path';
test('Bundle studio', async () => {
const browser = openBrowser('chrome');
- const tab = await (await browser).newPage(() => null, 'info', false);
+ const tab = await (
+ await browser
+ ).newPage({
+ context: () => null,
+ logLevel: 'info',
+ indent: false,
+ pageIndex: 0,
+ });
const folder = path.join(process.cwd(), '..', 'example', 'build');
const indexHtmlExists = existsSync(path.join(folder, 'index.html'));
if (!indexHtmlExists) {
@@ -42,6 +49,6 @@ test('Bundle studio', async () => {
});
expect(result.toString()).toBeGreaterThan(1);
- await (await browser).close(false, 'info', false);
+ await (await browser).close({silent: false});
await close();
});
diff --git a/packages/it-tests/src/monorepo/go-package.test.ts b/packages/it-tests/src/monorepo/go-package.test.ts
index cd05069529..0e2399b45a 100644
--- a/packages/it-tests/src/monorepo/go-package.test.ts
+++ b/packages/it-tests/src/monorepo/go-package.test.ts
@@ -76,6 +76,7 @@ test('Go package should create the same payload as normal Lambda package', async
metadata: {
Author: 'Remotion',
},
+ apiKey: null,
});
expect(removeUndefined(parsed)).toEqual(removeUndefined(nativeVersion));
diff --git a/packages/it-tests/src/monorepo/php-package.test.ts b/packages/it-tests/src/monorepo/php-package.test.ts
index 79355c93bd..43101ff4bb 100644
--- a/packages/it-tests/src/monorepo/php-package.test.ts
+++ b/packages/it-tests/src/monorepo/php-package.test.ts
@@ -123,6 +123,7 @@ class Semantic
metadata: {
Author: 'Remotion',
},
+ apiKey: null,
});
const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);
const parsedJson = JSON.parse(jsonOutput);
diff --git a/packages/it-tests/src/monorepo/python-package.test.ts b/packages/it-tests/src/monorepo/python-package.test.ts
index a26561c267..5d3b1d0a72 100644
--- a/packages/it-tests/src/monorepo/python-package.test.ts
+++ b/packages/it-tests/src/monorepo/python-package.test.ts
@@ -100,6 +100,7 @@ test('Python package should create the same renderMedia payload as normal Lambda
metadata: {
Author: 'Lunar',
},
+ apiKey: null,
});
const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);
const parsedJson = JSON.parse(jsonOutput);
@@ -181,6 +182,7 @@ test('Python package should create the same renderStill payload as normal Lambda
dumpBrowserLogs: false,
quality: undefined,
forcePathStyle: false,
+ apiKey: null,
});
const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);
const {streamed: _, ...parsedJson} = JSON.parse(jsonOutput);
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index a74868c1f9..4b2a426efc 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -456,6 +456,7 @@ test("Should succeed to render an audio file that doesn't have any audio inputs"
test('Should render a still that uses the staticFile() API and should apply props', async () => {
const out = outputPath.replace('.mp4', '.png');
+ await Bun.write('props.json', JSON.stringify({flag: true}));
const task = await execa(
'pnpm',
[
@@ -470,6 +471,7 @@ test('Should render a still that uses the staticFile() API and should apply prop
],
{
cwd: path.join(process.cwd(), '..', 'example'),
+ // @ts-expect-error staticfile
env: {
REMOTION_FLAG: 'hi',
},
diff --git a/packages/it-tests/src/size-benchmark/run-benchmark.ts b/packages/it-tests/src/size-benchmark/run-benchmark.ts
index 5a53758c09..3e04c53877 100644
--- a/packages/it-tests/src/size-benchmark/run-benchmark.ts
+++ b/packages/it-tests/src/size-benchmark/run-benchmark.ts
@@ -60,6 +60,9 @@ export const runBenchmark = async ({
if (!fps) {
throw new Error('Could not get fps of video');
}
+ if (!dimensions) {
+ throw new Error('Could not get fps of video');
+ }
const output = `${os.tmpdir()}/output.mp4`;
diff --git a/packages/it-tests/src/ssr/render-frames.test.ts b/packages/it-tests/src/ssr/render-frames.test.ts
index 0b01e231bd..f5f6d1c2c5 100644
--- a/packages/it-tests/src/ssr/render-frames.test.ts
+++ b/packages/it-tests/src/ssr/render-frames.test.ts
@@ -69,5 +69,5 @@ test('Legacy SSR way of rendering videos should still work', async () => {
expect(probe.stderr).toMatch(/Video: h264/);
RenderInternals.deleteDirectory(framesDir);
- await puppeteerInstance.close(false, 'info', false);
+ await puppeteerInstance.close({silent: false});
});
diff --git a/packages/it-tests/src/ssr/render-media.test.ts b/packages/it-tests/src/ssr/render-media.test.ts
index ea28cdeae8..8edb64973c 100644
--- a/packages/it-tests/src/ssr/render-media.test.ts
+++ b/packages/it-tests/src/ssr/render-media.test.ts
@@ -34,7 +34,7 @@ test('Render video with browser instance open', async () => {
puppeteerInstance,
metadata: {Author: 'Lunar'},
});
- await puppeteerInstance.close(false, 'info', false);
+ await puppeteerInstance.close({silent: false});
expect(existsSync(outPath)).toBe(true);
});
@@ -99,7 +99,7 @@ test('should fail on invalid CRF', async () => {
);
}
- await browserInstance.close(false, 'info', false);
+ await browserInstance.close({silent: false});
});
test('Render video to a buffer', async () => {
diff --git a/packages/it-tests/src/ssr/render-still.test.ts b/packages/it-tests/src/ssr/render-still.test.ts
index 2b165b2afb..27920cb112 100644
--- a/packages/it-tests/src/ssr/render-still.test.ts
+++ b/packages/it-tests/src/ssr/render-still.test.ts
@@ -46,7 +46,7 @@ test('Render video with browser instance open', async () => {
puppeteerInstance,
});
expect(buffer).toBe(null);
- await puppeteerInstance.close(false, 'info', false);
+ await puppeteerInstance.close({silent: false});
});
test('Render still with browser instance not open and legacy webpack config', async () => {
diff --git a/packages/lambda-php/composer.lock b/packages/lambda-php/composer.lock
index eaccdff63d..fa8bf56597 100644
--- a/packages/lambda-php/composer.lock
+++ b/packages/lambda-php/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "f4d8368e9239f03cfcace6e4e20c8946",
+ "content-hash": "7e46eeea9977efad74c54ed3295a6457",
"packages": [
{
"name": "aws/aws-crt-php",
diff --git a/packages/renderer/src/browser/BrowserPage.ts b/packages/renderer/src/browser/BrowserPage.ts
index b98b6a8324..069c7e7941 100644
--- a/packages/renderer/src/browser/BrowserPage.ts
+++ b/packages/renderer/src/browser/BrowserPage.ts
@@ -159,6 +159,7 @@ export class Page extends EventEmitter {
this.screenshotTaskQueue = new TaskQueue();
this.browser = browser;
this.id = String(Math.random());
+ console.log({sourceMapGetter});
this.sourceMapGetter = sourceMapGetter;
this.logLevel = logLevel;
this.pageIndex = pageIndex;
diff --git a/packages/renderer/src/browser/mitt/index.ts b/packages/renderer/src/browser/mitt/index.ts
index 8d37b0e6d7..3dec14f180 100644
--- a/packages/renderer/src/browser/mitt/index.ts
+++ b/packages/renderer/src/browser/mitt/index.ts
@@ -48,7 +48,7 @@ export default function mitt(all?: EventHandlerMap): Emitter {
* @param {Function} handler Function to call in response to given event
* @memberOf mitt
*/
- on<T = any>(type: EventType, handler: Handler<T>) {
+ on: <T = any>(type: EventType, handler: Handler<T>) => {
const handlers = all?.get(type);
const added = handlers?.push(handler);
if (!added) {
@@ -56,7 +56,7 @@ export default function mitt(all?: EventHandlerMap): Emitter {
}
},
- off<T = any>(type: EventType, handler: Handler<T>) {
+ off: <T = any>(type: EventType, handler: Handler<T>) => {
const handlers = all?.get(type);
if (handlers) {
// eslint-disable-next-line no-bitwise
@@ -64,7 +64,7 @@ export default function mitt(all?: EventHandlerMap): Emitter {
}
},
- emit<T = any>(type: EventType, evt: T) {
+ emit: <T = any>(type: EventType, evt: T) => {
((all?.get(type) || []) as EventHandlerList)
.slice()
.forEach((handler) => {