🎥 Make videos programmatically with React
let's go
Jonny Burger5b720e6a8d7d
diff --git a/TESTING.md b/TESTING.mdindex a6231b2892..041072715d 100644--- a/TESTING.md+++ b/TESTING.md@@ -4,10 +4,10 @@ For general information concerning contribution, please consult [CONTRIBUTION.md### Core Coverage----++++### Running testsdiff --git a/packages/cli/src/still.ts b/packages/cli/src/still.tsindex 95b7615290..a4c507a637 100644--- a/packages/cli/src/still.ts+++ b/packages/cli/src/still.ts@@ -97,11 +97,14 @@ export const still = async () => {const renderProgress = createOverwriteableCliOutput();const renderStart = Date.now();+ const {port, close} = await RenderInternals.serveStatic(bundled);+ const serveUrl = `http://localhost:${port}`;+await renderStill({composition,frame: stillFrame,output: userOutput,- webpackBundle: bundled,+ serveUrl,quality,browser,dumpBrowserLogs: Internals.Logging.isEqualOrBelowLogLevel('verbose'),@@ -121,6 +124,9 @@ export const still = async () => {});const closeBrowserPromise = openedBrowser.close();+ close().catch((err) => {+ Log.error('Could not close web server', err);+ });renderProgress.update(makeRenderingProgress({frames: 1,diff --git a/packages/docs/package.json b/packages/docs/package.jsonindex 8af9f8ebaa..4a2cab5e88 100644--- a/packages/docs/package.json+++ b/packages/docs/package.json@@ -21,6 +21,7 @@"@remotion/gif": "^2.2.4","@remotion/media-utils": "^2.2.4","@remotion/player": "^2.2.4",+ "@remotion/lambda": "^2.2.4","@remotion/renderer": "^2.2.4","@remotion/three": "^2.2.4","@splitbee/web": "^0.2.4",diff --git a/packages/example/src/test/stills.test.ts b/packages/example/src/test/stills.test.tsindex 8a44b14ff5..25cdec03b8 100644--- a/packages/example/src/test/stills.test.ts+++ b/packages/example/src/test/stills.test.ts@@ -1,5 +1,9 @@import {bundle} from '@remotion/bundler';-import {getCompositions, renderStill} from '@remotion/renderer';+import {+ getCompositions,+ RenderInternals,+ renderStill,+} from '@remotion/renderer';import {existsSync, unlinkSync} from 'fs';import {tmpdir} from 'os';import path from 'path';@@ -21,11 +25,15 @@ test('Can render a still using Node.JS APIs', async () => {const testOut = path.join(tmpdir(), 'path/to/still.png');+ const {port, close} = await RenderInternals.serveStatic(bundled);++ const serveUrl = `http://localhost:${port}`;+expect(() =>renderStill({composition,output: testOut,- webpackBundle: bundled,+ serveUrl,frame: 500,})).rejects.toThrow(@@ -36,7 +44,7 @@ test('Can render a still using Node.JS APIs', async () => {renderStill({composition,output: process.platform === 'win32' ? 'D:\\' : '/var',- webpackBundle: bundled,+ serveUrl,})).rejects.toThrow(/already exists, but is not a file/);@@ -44,7 +52,7 @@ test('Can render a still using Node.JS APIs', async () => {renderStill({composition,output: 'src/index.tsx',- webpackBundle: bundled,+ serveUrl,overwrite: false,})).rejects.toThrow(@@ -54,10 +62,12 @@ test('Can render a still using Node.JS APIs', async () => {await renderStill({composition,output: testOut,- webpackBundle: bundled,+ serveUrl,frame: 100,});expect(existsSync(testOut)).toBe(true);unlinkSync(testOut);++ await close();});diff --git a/packages/lambda/package.json b/packages/lambda/package.jsonindex 72ce632375..07829261f7 100644--- a/packages/lambda/package.json+++ b/packages/lambda/package.json@@ -1,6 +1,6 @@{"name": "@remotion/lambda",- "version": "2.2.0",+ "version": "2.2.4","description": "Utility functions for audio and video","main": "dist/index.js","sideEffects": false,diff --git a/packages/renderer/src/index.ts b/packages/renderer/src/index.tsindex a5a362d117..c5dc86e98c 100644--- a/packages/renderer/src/index.ts+++ b/packages/renderer/src/index.ts@@ -27,6 +27,7 @@ export {renderFrames} from './render';export {renderStill} from './render-still';export {stitchFramesToVideo} from './stitcher';export {OnErrorInfo, OnStartData, RenderFramesOutput} from './types';+export const RenderInternals = {ensureLocalBrowser,ffmpegHasFeature,