Skip to content

🎥 Make videos programmatically with React

alright

JonnyBurgerad024ae378dd
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index aab6051e2d..790dd9b4ca 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -132,6 +132,8 @@ const {
enableCrossSiteIsolationOption,
imageSequencePatternOption,
darkModeOption,
+ publicLicenseKeyOption,
+ privateLicenseKeyOption,
} = BrowserSafeApis.options;
declare global {
@@ -535,6 +537,18 @@ declare global {
* @param pattern The pattern string, e.g. 'frame_[frame].[ext]'.
*/
readonly setImageSequencePattern: (pattern: string | null) => void;
+ /**
+ * Set the public license key for your company license.
+ * Obtain it from the "Usage" tab on https://remotion.pro
+ * Pass "free-license" if you are eligible for the free license.
+ */
+ readonly setPublicLicenseKey: (key: string | null) => void;
+ /**
+ * Set the private license key for your company license.
+ * Obtain it from the "Usage" tab on https://remotion.pro
+ * Pass "free-license" if you are eligible for the free license.
+ */
+ readonly setPrivateLicenseKey: (key: string | null) => void;
}
}
@@ -715,6 +729,8 @@ export const Config: FlatConfig = {
setImageSequencePattern: imageSequencePatternOption.setConfig,
setHardwareAcceleration: hardwareAccelerationOption.setConfig,
setEnableCrossSiteIsolation: enableCrossSiteIsolationOption.setConfig,
+ setPublicLicenseKey: publicLicenseKeyOption.setConfig,
+ setPrivateLicenseKey: privateLicenseKeyOption.setConfig,
};
export const ConfigInternals = {
diff --git a/packages/cli/src/get-render-defaults.ts b/packages/cli/src/get-render-defaults.ts
index d3df0ab775..804da74687 100644
--- a/packages/cli/src/get-render-defaults.ts
+++ b/packages/cli/src/get-render-defaults.ts
@@ -31,6 +31,7 @@ const {
chromeModeOption,
mediaCacheSizeInBytesOption,
darkModeOption,
+ publicLicenseKeyOption,
} = BrowserSafeApis.options;
export const getRenderDefaults = (): RenderDefaults => {
@@ -116,6 +117,9 @@ export const getRenderDefaults = (): RenderDefaults => {
const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({
commandLine: parsedCli,
}).value;
+ const publicLicenseKey = publicLicenseKeyOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const everyNthFrame = ConfigInternals.getEveryNthFrame();
const stillImageFormat = ConfigInternals.getUserPreferredStillImageFormat();
@@ -173,5 +177,6 @@ export const getRenderDefaults = (): RenderDefaults => {
hardwareAcceleration,
chromeMode,
mediaCacheSizeInBytes,
+ publicLicenseKey,
};
};
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 4209c74ad5..3a884ea688 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -34,6 +34,8 @@ const {
publicPathOption,
audioLatencyHintOption,
darkModeOption,
+ publicLicenseKeyOption,
+ privateLicenseKeyOption,
} = BrowserSafeApis.options;
export type CommandLineOptions = {
@@ -115,6 +117,9 @@ export type CommandLineOptions = {
>;
repro: boolean;
'image-sequence-pattern': string;
+ 'license-key': string;
+ [publicLicenseKeyOption.cliFlag]: string;
+ [privateLicenseKeyOption.cliFlag]: string;
};
export const parseCommandLine = () => {
@@ -186,6 +191,21 @@ export const parseCommandLine = () => {
);
}
+ if (
+ parsedCli['license-key'] &&
+ parsedCli['license-key'].startsWith('rm_pub_')
+ ) {
+ Config.setPublicLicenseKey(parsedCli['license-key']);
+ }
+
+ if (parsedCli['private-license-key']) {
+ Config.setPrivateLicenseKey(parsedCli['private-license-key']);
+ }
+
+ if (parsedCli['public-license-key']) {
+ Config.setPublicLicenseKey(parsedCli['public-license-key']);
+ }
+
if (typeof parsedCli.quality !== 'undefined') {
Log.warn(
{indent: false, logLevel: 'info'},
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index a22a60eb8a..8ab8c8e9f4 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -34,7 +34,9 @@ import {onBrowserDownloadOption} from './on-browser-download';
import type {AnyRemotionOption} from './option';
import {overwriteOption} from './overwrite';
import {preferLosslessAudioOption} from './prefer-lossless';
+import {privateLicenseKeyOption} from './private-license-key';
import {publicDirOption} from './public-dir';
+import {publicLicenseKeyOption} from './public-license-key';
import {publicPathOption} from './public-path';
import {reproOption} from './repro';
import {scaleOption} from './scale';
@@ -95,6 +97,8 @@ export const allOptions = {
imageSequencePatternOption,
mediaCacheSizeInBytesOption,
darkModeOption,
+ publicLicenseKeyOption,
+ privateLicenseKeyOption,
};
export type AvailableOptions = keyof typeof allOptions;
diff --git a/packages/renderer/src/options/private-license-key.tsx b/packages/renderer/src/options/private-license-key.tsx
new file mode 100644
index 0000000000..1c51f08973
--- /dev/null
+++ b/packages/renderer/src/options/private-license-key.tsx
@@ -0,0 +1,43 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'private-license-key' as const;
+
+let currentPrivateLicenseKey: string | null = null;
+
+export const privateLicenseKeyOption = {
+ name: 'Private License Key',
+ cliFlag,
+ description: () => (
+ <>
+ The private license key for your company license, obtained from the
+ "Usage" tab on <a href="https://remotion.pro/dashboard">remotion.pro</a>.
+ If you are eligible for the free license, pass "free-license".
+ </>
+ ),
+ ssrName: 'privateLicenseKey' as const,
+ docLink: 'https://www.remotion.dev/docs/licensing',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string | null,
+ };
+ }
+
+ if (currentPrivateLicenseKey !== null) {
+ return {
+ source: 'config',
+ value: currentPrivateLicenseKey,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value: string | null) => {
+ currentPrivateLicenseKey = value;
+ },
+ type: null as string | null,
+} satisfies AnyRemotionOption<string | null>;
diff --git a/packages/renderer/src/options/public-license-key.tsx b/packages/renderer/src/options/public-license-key.tsx
new file mode 100644
index 0000000000..751f4bc222
--- /dev/null
+++ b/packages/renderer/src/options/public-license-key.tsx
@@ -0,0 +1,43 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'public-license-key' as const;
+
+let currentPublicLicenseKey: string | null = null;
+
+export const publicLicenseKeyOption = {
+ name: 'Public License Key',
+ cliFlag,
+ description: () => (
+ <>
+ The public license key for your company license, obtained from the "Usage"
+ tab on <a href="https://remotion.pro/dashboard">remotion.pro</a>. If you
+ are eligible for the free license, pass "free-license".
+ </>
+ ),
+ ssrName: 'publicLicenseKey' as const,
+ docLink: 'https://www.remotion.dev/docs/licensing',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string | null,
+ };
+ }
+
+ if (currentPublicLicenseKey !== null) {
+ return {
+ source: 'config',
+ value: currentPublicLicenseKey,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value: string | null) => {
+ currentPublicLicenseKey = value;
+ },
+ type: null as string | null,
+} satisfies AnyRemotionOption<string | null>;
diff --git a/packages/studio-shared/src/render-defaults.ts b/packages/studio-shared/src/render-defaults.ts
index 5936a25356..04070417da 100644
--- a/packages/studio-shared/src/render-defaults.ts
+++ b/packages/studio-shared/src/render-defaults.ts
@@ -55,6 +55,7 @@ export type RenderDefaults = {
metadata: Record<string, string> | null;
hardwareAcceleration: HardwareAccelerationOption;
chromeMode: ChromeMode;
+ publicLicenseKey: string | null;
};
declare global {
diff --git a/packages/studio/src/components/Checkbox.tsx b/packages/studio/src/components/Checkbox.tsx
index ce37c98a96..0ffe79dd45 100644
--- a/packages/studio/src/components/Checkbox.tsx
+++ b/packages/studio/src/components/Checkbox.tsx
@@ -1,7 +1,8 @@
-import React, {useMemo} from 'react';
+import React, {useEffect, useMemo, useRef} from 'react';
import {
INPUT_BACKGROUND,
INPUT_BORDER_COLOR_UNHOVERED,
+ LIGHT_TEXT,
} from '../helpers/colors';
import {Checkmark} from '../icons/Checkmark';
@@ -13,6 +14,13 @@ const background: React.CSSProperties = {
position: 'relative',
};
+const bullet: React.CSSProperties = {
+ width: 10,
+ height: 10,
+ backgroundColor: LIGHT_TEXT,
+ borderRadius: '50%',
+};
+
const box: React.CSSProperties = {
display: 'flex',
justifyContent: 'center',
@@ -30,8 +38,10 @@ export const Checkbox: React.FC<{
readonly checked: boolean;
readonly onChange: React.ChangeEventHandler<HTMLInputElement>;
readonly name: string;
+ readonly rounded?: boolean;
readonly disabled?: boolean;
-}> = ({checked, onChange, disabled, name}) => {
+}> = ({checked, onChange, disabled, name, rounded}) => {
+ const ref = useRef<HTMLInputElement>(null);
const input: React.CSSProperties = useMemo(() => {
return {
appearance: 'none',
@@ -46,9 +56,20 @@ export const Checkbox: React.FC<{
};
}, [disabled]);
+ useEffect(() => {
+ if (ref.current) {
+ ref.current.style.setProperty(
+ 'border-radius',
+ rounded ? '50%' : '0%',
+ 'important',
+ );
+ }
+ }, [rounded]);
+
return (
<div style={background}>
<input
+ ref={ref}
style={input}
type={'checkbox'}
checked={checked}
@@ -56,7 +77,9 @@ export const Checkbox: React.FC<{
disabled={disabled}
name={name}
/>
- <div style={box}>{checked ? <Checkmark /> : null}</div>
+ <div style={box}>
+ {checked ? rounded ? <div style={bullet} /> : <Checkmark /> : null}
+ </div>
</div>
);
};
diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsx
index 087166b47c..a413e42065 100644
--- a/packages/studio/src/components/Modals.tsx
+++ b/packages/studio/src/components/Modals.tsx
@@ -48,6 +48,7 @@ export const Modals: React.FC<{
inFrameMark={modalContextType.inFrameMark}
outFrameMark={modalContextType.outFrameMark}
initialLogLevel={modalContextType.initialLogLevel}
+ initialLicenseKey={modalContextType.initialLicenseKey}
/>
)}
{modalContextType &&
diff --git a/packages/studio/src/components/RenderButton.tsx b/packages/studio/src/components/RenderButton.tsx
index b2bfb3635c..b3b09a9a57 100644
--- a/packages/studio/src/components/RenderButton.tsx
+++ b/packages/studio/src/components/RenderButton.tsx
@@ -247,6 +247,7 @@ export const RenderButton: React.FC<{readonly readOnlyStudio: boolean}> = ({
inFrameMark: inFrame,
outFrameMark: outFrame,
initialLogLevel: defaults.logLevel as LogLevel,
+ initialLicenseKey: defaults.publicLicenseKey,
});
}, [video, setSelectedModal, getCurrentFrame, props, inFrame, outFrame]);
diff --git a/packages/studio/src/components/RenderModal/WebRenderModal.tsx b/packages/studio/src/components/RenderModal/WebRenderModal.tsx
index 198123b67e..e702e019f8 100644
--- a/packages/studio/src/components/RenderModal/WebRenderModal.tsx
+++ b/packages/studio/src/components/RenderModal/WebRenderModal.tsx
@@ -52,6 +52,7 @@ type WebRenderModalProps = {
readonly compositionId: string;
readonly initialFrame: number;
readonly initialLogLevel: LogLevel;
+ readonly initialLicenseKey: string | null;
readonly defaultProps: Record<string, unknown>;
readonly inFrameMark: number | null;
readonly outFrameMark: number | null;
@@ -145,6 +146,7 @@ const WebRenderModal: React.FC<WebRenderModalProps> = ({
inFrameMark,
outFrameMark,
initialLogLevel,
+ initialLicenseKey,
}) => {
const context = useContext(ResolvedCompositionContext);
if (!context) {
@@ -198,9 +200,8 @@ const WebRenderModal: React.FC<WebRenderModalProps> = ({
const [transparent, setTransparent] = useState(false);
const [muted, setMuted] = useState(false);
- // License state
const [freeLicense, setFreeLicense] = useState(false);
- const [licenseKey, setLicenseKey] = useState('');
+ const [licenseKey, setLicenseKey] = useState(initialLicenseKey ?? '');
const finalEndFrame = useMemo(() => {
if (endFrame === null) {
diff --git a/packages/studio/src/components/RenderModal/WebRenderModalLicense.tsx b/packages/studio/src/components/RenderModal/WebRenderModalLicense.tsx
index fea3035974..6c5f2da2bf 100644
--- a/packages/studio/src/components/RenderModal/WebRenderModalLicense.tsx
+++ b/packages/studio/src/components/RenderModal/WebRenderModalLicense.tsx
@@ -2,7 +2,6 @@ import React, {useCallback} from 'react';
import {LIGHT_TEXT} from '../../helpers/colors';
import {Checkbox} from '../Checkbox';
import {RemotionInput} from '../NewComposition/RemInput';
-import {InlineEyeButton} from './InlineEyeIcon';
import {optionRow} from './layout';
type WebRenderModalLicenseProps = {
@@ -61,12 +60,6 @@ export const WebRenderModalLicense: React.FC<WebRenderModalLicenseProps> = ({
setFreeLicense((prev) => !prev);
}, [setFreeLicense]);
- const [showInPlainText, setShowInPlainText] = React.useState(false);
-
- const togglePlainText = useCallback(() => {
- setShowInPlainText((prev) => !prev);
- }, []);
-
const onLicenseKeyChange: React.ChangeEventHandler<HTMLInputElement> =
useCallback(
(e) => {
@@ -91,6 +84,7 @@ export const WebRenderModalLicense: React.FC<WebRenderModalLicenseProps> = ({
checked={freeLicense}
onChange={onFreeLicenseChange}
name="free-license"
+ rounded
/>
<div style={checkboxLabel}>
@@ -130,10 +124,6 @@ export const WebRenderModalLicense: React.FC<WebRenderModalLicenseProps> = ({
style={inputStyle}
disabled={freeLicense}
/>
- <InlineEyeButton
- enabled={!showInPlainText}
- onClick={togglePlainText}
- />
</div>
</div>
</>
diff --git a/packages/studio/src/helpers/inject-css.ts b/packages/studio/src/helpers/inject-css.ts
index 26d31ebabc..0e8b503d7b 100644
--- a/packages/studio/src/helpers/inject-css.ts
+++ b/packages/studio/src/helpers/inject-css.ts
@@ -90,7 +90,6 @@ const makeDefaultGlobalCSS = () => {
inset -1px -1px #555,
inset 1px -1px #555,
inset -1px 1px #555;
- border-radius: 0 !important;
}
input[type='color'].__remotion_color_picker::-webkit-color-swatch-wrapper {
diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.ts
index f2d796abc5..1ff6a3f63a 100644
--- a/packages/studio/src/state/modals.ts
+++ b/packages/studio/src/state/modals.ts
@@ -28,6 +28,7 @@ export type WebRenderModalState = {
inFrameMark: number | null;
outFrameMark: number | null;
initialLogLevel: LogLevel;
+ initialLicenseKey: string | null;
};
export type RenderModalState = {