🎥 Make videos programmatically with React
initial
Hunain Ahmed69ed916839a1
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.tsindex 79dbde1ff7..7298307abc 100644--- a/packages/bundler/src/bundle.ts+++ b/packages/bundler/src/bundle.ts@@ -94,6 +94,7 @@ export const getConfig = ({bufferStateDelayInMilliseconds,poll: null,experimentalClientSideRenderingEnabled,+ disableAskAI: false});};diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.tsindex 92dc67d251..bab7686d28 100644--- a/packages/bundler/src/webpack-config.ts+++ b/packages/bundler/src/webpack-config.ts@@ -54,6 +54,7 @@ export const webpackConfig = async ({bufferStateDelayInMilliseconds,poll,experimentalClientSideRenderingEnabled,+ disableAskAI}: {entry: string;userDefinedComponent: string;@@ -67,6 +68,7 @@ export const webpackConfig = async ({bufferStateDelayInMilliseconds: number | null;remotionRoot: string;poll: number | null;+ disableAskAI: boolean,experimentalClientSideRenderingEnabled: boolean;}): Promise<[string, WebpackConfiguration]> => {const esbuildLoaderOptions: LoaderOptions = {@@ -82,6 +84,7 @@ export const webpackConfig = async ({const define = new webpack.DefinePlugin({'process.env.MAX_TIMELINE_TRACKS': maxTimelineTracks,+ 'process.env.DISABLE_ASK_AI': disableAskAI,'process.env.KEYBOARD_SHORTCUTS_ENABLED': keyboardShortcutsEnabled,'process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS':bufferStateDelayInMilliseconds,diff --git a/packages/cli/src/studio.ts b/packages/cli/src/studio.tsindex e32f23f17d..7fd149d1ab 100644--- a/packages/cli/src/studio.ts+++ b/packages/cli/src/studio.ts@@ -36,6 +36,7 @@ const {publicDirOption,disableGitSourceOption,enableCrossSiteIsolationOption,+ disableAskAIOption} = BrowserSafeApis.options;export const studioCommand = async (@@ -127,6 +128,10 @@ export const studioCommand = async (commandLine: parsedCli,}).value;+ const disableAskAIModal = disableAskAIOption.getValue({+ commandLine: parsedCli+ }).value+const gitSource = getGitSource({remotionRoot, disableGitSource, logLevel});await StudioServerInternals.startStudio({@@ -165,6 +170,7 @@ export const studioCommand = async (forceIPv4: parsedCli.ipv4,audioLatencyHint: parsedCli['audio-latency-hint'],enableCrossSiteIsolation,+ disableAskAI: disableAskAIModal});// If the server is restarted through the UI, let's do the whole thing again.diff --git a/packages/renderer/src/options/disable-ask-ai.tsx b/packages/renderer/src/options/disable-ask-ai.tsxnew file mode 100644index 0000000000..c760da6adc--- /dev/null+++ b/packages/renderer/src/options/disable-ask-ai.tsx@@ -0,0 +1,34 @@+import type {AnyRemotionOption} from './option';++let disableAskAI = false;++const cliFlag = 'disable-ask-ai' as const;++export const disableAskAIOption = {+ name: 'Disable the Ask AI option',+ cliFlag,+ description: () => (+ <>+ If the Cmd + I shortcut of the Ask AI modal conflicts with your studio, you can disable it.+ </>+ ),+ ssrName: null,+ docLink: 'https://www.remotion.dev/docs/config#setdisabledaskai',+ type: false as boolean,+ getValue: ({commandLine}) => {+ if (commandLine[cliFlag] !== undefined) {+ return {+ value: commandLine[cliFlag] as boolean,+ source: 'cli',+ };+ }++ return {+ value: disableAskAI,+ source: 'config',+ };+ },+ setConfig(value) {+ disableAskAI = value;+ },+} satisfies AnyRemotionOption<boolean>;diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsxindex 7b1c24d303..0bf55c76bb 100644--- a/packages/renderer/src/options/index.tsx+++ b/packages/renderer/src/options/index.tsx@@ -9,6 +9,7 @@ import {crfOption} from './crf';import {enableCrossSiteIsolationOption} from './cross-site-isolation';import {darkModeOption} from './dark-mode';import {deleteAfterOption} from './delete-after';+import { disableAskAIOption } from './disable-ask-ai';import {disableGitSourceOption} from './disable-git-source';import {disallowParallelEncodingOption} from './disallow-parallel-encoding';import {enableLambdaInsights} from './enable-lambda-insights';@@ -99,6 +100,7 @@ export const allOptions = {mediaCacheSizeInBytesOption,darkModeOption,publicLicenseKeyOption,+ disableAskAIOption};export type AvailableOptions = keyof typeof allOptions;diff --git a/packages/studio-server/src/preview-server/start-server.ts b/packages/studio-server/src/preview-server/start-server.tsindex 70a15a3193..c50ac18c46 100644--- a/packages/studio-server/src/preview-server/start-server.ts+++ b/packages/studio-server/src/preview-server/start-server.ts@@ -44,6 +44,7 @@ export const startServer = async (options: {forceIPv4: boolean;audioLatencyHint: AudioContextLatencyCategory | null;enableCrossSiteIsolation: boolean;+ disableAskAI: boolean}): Promise<{port: number;liveEventsServer: LiveEventsServer;@@ -62,6 +63,7 @@ export const startServer = async (options: {options.experimentalClientSideRenderingEnabled,poll: options.poll,bufferStateDelayInMilliseconds: options.bufferStateDelayInMilliseconds,+ disableAskAI: options.disableAskAI});const compiler = webpack(config);diff --git a/packages/studio-server/src/start-studio.ts b/packages/studio-server/src/start-studio.tsindex 3cc9e4e280..e1091325cb 100644--- a/packages/studio-server/src/start-studio.ts+++ b/packages/studio-server/src/start-studio.ts@@ -82,6 +82,7 @@ export const startStudio = async ({forceIPv4,audioLatencyHint,enableCrossSiteIsolation,+ disableAskAI}: {browserArgs: string;browserFlag: string;@@ -110,6 +111,7 @@ export const startStudio = async ({gitSource: GitSource | null;binariesDirectory: string | null;forceIPv4: boolean;+ disableAskAI: boolean}) => {try {if (typeof Bun === 'undefined') {@@ -183,6 +185,7 @@ export const startStudio = async ({forceIPv4,audioLatencyHint,enableCrossSiteIsolation,+ disableAskAI});const cleanupLiveEventsListener = setLiveEventsListener(liveEventsServer);diff --git a/packages/studio/src/components/GlobalKeybindings.tsx b/packages/studio/src/components/GlobalKeybindings.tsxindex 993c205310..bd6fe916b2 100644--- a/packages/studio/src/components/GlobalKeybindings.tsx+++ b/packages/studio/src/components/GlobalKeybindings.tsx@@ -44,7 +44,7 @@ export const GlobalKeybindings: React.FC = () => {commandCtrlKey: true,preventDefault: true,});- const cmdIKey = keybindings.registerKeybinding({+ const cmdIKey = !process.env.DISABLE_ASK_AI ? keybindings.registerKeybinding({event: 'keydown',key: 'i',callback: () => {@@ -54,7 +54,7 @@ export const GlobalKeybindings: React.FC = () => {keepRegisteredWhenNotHighestContext: true,commandCtrlKey: true,preventDefault: true,- });+ }) : null;const cKey = keybindings.registerKeybinding({event: 'keypress',@@ -108,7 +108,7 @@ export const GlobalKeybindings: React.FC = () => {cKey.unregister();questionMark.unregister();cmdKKey.unregister();- cmdIKey.unregister();+ cmdIKey?.unregister();pageDown.unregister();pageUp.unregister();};diff --git a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx b/packages/studio/src/components/KeyboardShortcutsExplainer.tsxindex 4d27f9d48d..f31e9c78d6 100644--- a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx+++ b/packages/studio/src/components/KeyboardShortcutsExplainer.tsx@@ -298,7 +298,9 @@ export const KeyboardShortcutsExplainer: React.FC = () => {</div><div style={right}>Save</div></Row>- <br />+ { !process.env.DISABLE_ASK_AI &&+ <>+ <br /><div style={title}>AI</div><Row align="center"><div style={left}>@@ -308,6 +310,8 @@ export const KeyboardShortcutsExplainer: React.FC = () => {</div><div style={right}>Ask AI</div></Row>+ </>+ }</Column></Row></div>diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsxindex a413e42065..2ae15e5d9e 100644--- a/packages/studio/src/components/Modals.tsx+++ b/packages/studio/src/components/Modals.tsx@@ -152,7 +152,7 @@ export const Modals: React.FC<{initialMode={modalContextType.mode}/>)}- <AskAiModal />+ { !process.env.DISABLE_ASK_AI && <AskAiModal />}</>);};diff --git a/packages/studio/src/helpers/use-menu-structure.tsx b/packages/studio/src/helpers/use-menu-structure.tsxindex e1d4a68636..054c91b4c6 100644--- a/packages/studio/src/helpers/use-menu-structure.tsx+++ b/packages/studio/src/helpers/use-menu-structure.tsx@@ -667,7 +667,7 @@ export const useMenuStructure = (label: 'Tools',leaveLeftPadding: false,items: [- {+ !process.env.DISABLE_ASK_AI ? {id: 'ask-ai',value: 'ask-ai',label: 'Ask AI',@@ -680,7 +680,7 @@ export const useMenuStructure = (subMenu: null,type: 'item' as const,quickSwitcherLabel: 'Ask AI',- },+ } : null,'EyeDropper' in window? {id: 'color-picker',