🎥 Make videos programmatically with React
Add licenseKey to licensing and renderer
Pramoda7877356b6d9
diff --git a/packages/licensing/src/register-usage-point.ts b/packages/licensing/src/register-usage-point.tsindex d5b67e62e5..359eb56f0b 100644--- a/packages/licensing/src/register-usage-point.ts+++ b/packages/licensing/src/register-usage-point.ts@@ -25,11 +25,16 @@ export const registerUsageEvent = async ({host,succeeded,event,+ licenseKey,}: {+ /**+ * @deprecated Use `licenseKey` instead+ */apiKey: string | null;host: string | null;succeeded: boolean;event: UsageEventType;+ licenseKey?: string | null;}): Promise<RegisterUsageEventResponse> => {const abortController = new AbortController();const timeout = setTimeout(() => {@@ -41,7 +46,7 @@ export const registerUsageEvent = async ({method: 'POST',body: JSON.stringify({event,- apiKey,+ apiKey: licenseKey ?? apiKey,host,succeeded,}),diff --git a/packages/renderer/src/options/license-key.tsx b/packages/renderer/src/options/license-key.tsxnew file mode 100644index 0000000000..3d6d1b6875--- /dev/null+++ b/packages/renderer/src/options/license-key.tsx@@ -0,0 +1,35 @@+import type {AnyRemotionOption} from './option';++let currentLicenseKey: string | null = null;++const cliFlag = 'licenseKey-key' as const;++export const licenseKeyOption = {+ name: 'License key',+ cliFlag,+ description: () => (+ <>+ License key for sending a usage event using{' '}+ <code>@remotion/licensing</code>.+ </>+ ),+ ssrName: 'licenseKey' as const,+ docLink: 'https://www.remotion.dev/docs/licensing',+ type: null as string | null,+ getValue: ({commandLine}) => {+ if (commandLine[cliFlag] !== undefined) {+ return {+ source: 'cli',+ value: commandLine[cliFlag] as string | null,+ };+ }++ return {+ source: 'default',+ value: currentLicenseKey,+ };+ },+ setConfig: (value: string | null) => {+ currentLicenseKey = value;+ },+} satisfies AnyRemotionOption<string | null>;diff --git a/packages/renderer/src/options/options-map.ts b/packages/renderer/src/options/options-map.tsindex 63bac372d7..a7b96c4cd0 100644--- a/packages/renderer/src/options/options-map.ts+++ b/packages/renderer/src/options/options-map.ts@@ -14,6 +14,7 @@ import {forSeamlessAacConcatenationOption} from './for-seamless-aac-concatenatioimport {hardwareAccelerationOption} from './hardware-acceleration';import {imageSequencePatternOption} from './image-sequence-pattern';import {jpegQualityOption} from './jpeg-quality';+import {licenseKeyOption} from './license-key';import {logLevelOption} from './log-level';import {mutedOption} from './mute';import {numberOfGifLoopsOption} from './number-of-gif-loops';@@ -58,6 +59,7 @@ export const optionsMap = {hardwareAcceleration: hardwareAccelerationOption,chromeMode: chromeModeOption,apiKey: apiKeyOption,+ licenseKey: licenseKeyOption,},stitchFramesToVideo: {separateAudioTo: separateAudioOption,diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.tsindex 9a06766a82..1b25137140 100644--- a/packages/renderer/src/render-media.ts+++ b/packages/renderer/src/render-media.ts@@ -134,7 +134,11 @@ export type InternalRenderMediaOptions = {compositionStart: number;onArtifact: OnArtifact | null;metadata: Record<string, string> | null;+ /**+ * @deprecated Use `licenseKey` instead+ */apiKey: string | null;+ licenseKey: string | null;onLog: OnLog;} & MoreRenderMediaOptions;@@ -263,6 +267,7 @@ const internalRenderMediaRaw = ({mediaCacheSizeInBytes,onLog,apiKey,+ licenseKey,}: InternalRenderMediaOptions): Promise<RenderMediaResult> => {const pixelFormat =userPixelFormat ??@@ -819,6 +824,7 @@ const internalRenderMediaRaw = ({event: 'cloud-render',host: null,succeeded: true,+ licenseKey,}).then(() => {Log.verbose({indent, logLevel}, 'Usage event sent successfully');@@ -976,6 +982,7 @@ export const renderMedia = ({compositionStart,mediaCacheSizeInBytes,apiKey,+ licenseKey,}: RenderMediaOptions): Promise<RenderMediaResult> => {const indent = false;const logLevel =@@ -1063,6 +1070,7 @@ export const renderMedia = ({chromeMode: chromeMode ?? 'headless-shell',mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,apiKey: apiKey ?? null,+ licenseKey: licenseKey ?? null,onLog: defaultOnLog,});};