Skip to content

🎥 Make videos programmatically with React

drill down instead of hardcoding, works as expected

Hunain Ahmed1c8905a4e295
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.ts
index fbcd4c0dc7..ef49f1bba6 100644
--- a/packages/bundler/src/bundle.ts
+++ b/packages/bundler/src/bundle.ts
@@ -50,6 +50,8 @@ export type MandatoryLegacyBundleOptions = {
publicDir: string | null;
onPublicDirCopyProgress: (bytes: number) => void;
onSymlinkDetected: (path: string) => void;
+ keyboardShortcutsEnabled: boolean;
+ askAIEnabled: boolean;
};
export type LegacyBundleOptions = Partial<MandatoryLegacyBundleOptions>;
@@ -90,11 +92,11 @@ export const getConfig = ({
enableCaching: options?.enableCaching ?? true,
maxTimelineTracks,
remotionRoot: resolvedRemotionRoot,
- keyboardShortcutsEnabled: true,
+ keyboardShortcutsEnabled: options?.keyboardShortcutsEnabled ?? true,
bufferStateDelayInMilliseconds,
poll: null,
experimentalClientSideRenderingEnabled,
- askAIEnabled: true,
+ askAIEnabled: options?.askAIEnabled ?? true,
});
};
@@ -222,9 +224,9 @@ export const internalBundle = async (
// Should be null to keep cache hash working
bufferStateDelayInMilliseconds:
actualArgs.bufferStateDelayInMilliseconds ?? null,
- maxTimelineTracks: actualArgs.maxTimelineTracks ?? null,
+ maxTimelineTracks: actualArgs.maxTimelineTracks,
experimentalClientSideRenderingEnabled:
- actualArgs.experimentalClientSideRenderingEnabled ?? false,
+ actualArgs.experimentalClientSideRenderingEnabled,
});
const output = await promisified([config]);
@@ -362,6 +364,8 @@ export async function bundle(...args: Arguments): Promise<string> {
experimentalClientSideRenderingEnabled:
actualArgs.experimentalClientSideRenderingEnabled ?? false,
renderDefaults: actualArgs.renderDefaults ?? null,
+ askAIEnabled: actualArgs.askAIEnabled ?? true,
+ keyboardShortcutsEnabled: actualArgs.keyboardShortcutsEnabled ?? true,
});
return result;
}
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index d37325bf35..508ac706ae 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -733,6 +733,7 @@ export const Config: FlatConfig = {
};
export const ConfigInternals = {
+ getAskAI: BrowserSafeApis.getCurrentValueOfAskAI,
getRange,
getBrowser,
getPixelFormat,
diff --git a/packages/cli/src/setup-cache.ts b/packages/cli/src/setup-cache.ts
index e73644c3c1..3222a3f8e7 100644
--- a/packages/cli/src/setup-cache.ts
+++ b/packages/cli/src/setup-cache.ts
@@ -202,6 +202,8 @@ export const bundleOnCli = async ({
onSymlinkDetected,
outDir: outDir ?? null,
publicPath,
+ askAIEnabled: ConfigInternals.getAskAI(),
+ keyboardShortcutsEnabled: ConfigInternals.getKeyboardShortcutsEnabled(),
};
const [hash] = await BundlerInternals.getConfig({
diff --git a/packages/renderer/src/client.ts b/packages/renderer/src/client.ts
index 7379e62551..61fbb3046a 100644
--- a/packages/renderer/src/client.ts
+++ b/packages/renderer/src/client.ts
@@ -15,6 +15,7 @@ import {validStillImageFormats, validVideoImageFormats} from './image-format';
import {DEFAULT_JPEG_QUALITY} from './jpeg-quality';
import {logLevels} from './log-level';
import {allOptions} from './options';
+import {getCurrentValueOfAskAI} from './options/ask-ai';
import {
defaultAudioCodecs,
getExtensionFromAudioCodec,
@@ -69,4 +70,5 @@ export const BrowserSafeApis = {
getOutputCodecOrUndefined,
getExtensionFromAudioCodec,
validChromeModeOptions,
+ getCurrentValueOfAskAI,
};
diff --git a/packages/renderer/src/options/ask-ai.tsx b/packages/renderer/src/options/ask-ai.tsx
index baffae3092..88dc21d47e 100644
--- a/packages/renderer/src/options/ask-ai.tsx
+++ b/packages/renderer/src/options/ask-ai.tsx
@@ -3,7 +3,9 @@ import type {AnyRemotionOption} from './option';
let askAIEnabled = true;
const cliFlag = 'disable-ask-ai' as const;
-
+export const getCurrentValueOfAskAI = () => {
+ return askAIEnabled;
+};
export const AskAIOption = {
name: 'Disable or Enable the Ask AI option',
cliFlag,
@@ -18,8 +20,9 @@ export const AskAIOption = {
type: false as boolean,
getValue: ({commandLine}) => {
if (commandLine[cliFlag] !== undefined) {
+ askAIEnabled = false;
return {
- value: commandLine[cliFlag] as boolean,
+ value: askAIEnabled,
source: 'cli',
};
}
@@ -30,6 +33,7 @@ export const AskAIOption = {
};
},
setConfig(value) {
+ console.log('called ', value);
askAIEnabled = value;
},
} satisfies AnyRemotionOption<boolean>;