Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Use runtime Studio config (#9022)

Jonny Burgerf3dce8a35b5a
diff --git a/packages/browser-studio/src/BrowserStudio.tsx b/packages/browser-studio/src/BrowserStudio.tsx
index 68565cbb6e..a520e98f54 100644
--- a/packages/browser-studio/src/BrowserStudio.tsx
+++ b/packages/browser-studio/src/BrowserStudio.tsx
@@ -144,6 +144,14 @@ export const BrowserStudio: React.FC<BrowserStudioProps> = ({
renderQueue: [],
sampleRate: null,
staticHash: '',
+ studioRuntimeConfig: {
+ askAIEnabled: false,
+ bufferStateDelayInMilliseconds: null,
+ experimentalClientSideRenderingEnabled: false,
+ interactivityEnabled: true,
+ keyboardShortcutsEnabled: true,
+ maxTimelineTracks: null,
+ },
studioServerCommand: null,
title: 'Remotion Studio',
});
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.ts
index 7ac5a7d48c..4278dbe620 100644
--- a/packages/bundler/src/bundle.ts
+++ b/packages/bundler/src/bundle.ts
@@ -422,6 +422,15 @@ export const internalBundle = async (
mode: 'bundle',
audioLatencyHint: actualArgs.audioLatencyHint ?? 'playback',
sampleRate: actualArgs.renderDefaults?.sampleRate ?? 48000,
+ studioRuntimeConfig: {
+ askAIEnabled: actualArgs.askAIEnabled,
+ bufferStateDelayInMilliseconds: actualArgs.bufferStateDelayInMilliseconds,
+ experimentalClientSideRenderingEnabled:
+ actualArgs.experimentalClientSideRenderingEnabled,
+ interactivityEnabled: actualArgs.interactivityEnabled,
+ keyboardShortcutsEnabled: actualArgs.keyboardShortcutsEnabled,
+ maxTimelineTracks: actualArgs.maxTimelineTracks,
+ },
});
fs.writeFileSync(path.join(outDir, 'index.html'), html);
diff --git a/packages/cli/src/studio.ts b/packages/cli/src/studio.ts
index 3d602a4667..4632155230 100644
--- a/packages/cli/src/studio.ts
+++ b/packages/cli/src/studio.ts
@@ -155,6 +155,25 @@ export const studioCommand = async (
);
}
+ const getStudioRuntimeConfig = () => ({
+ maxTimelineTracks: ConfigInternals.getMaxTimelineTracks(),
+ askAIEnabled: askAIOption.getValue({
+ commandLine: parsedCli,
+ }).value,
+ interactivityEnabled: interactivityOption.getValue({
+ commandLine: parsedCli,
+ }).value,
+ keyboardShortcutsEnabled: keyboardShortcutsOption.getValue({
+ commandLine: parsedCli,
+ }).value,
+ bufferStateDelayInMilliseconds:
+ ConfigInternals.getBufferStateDelayInMilliseconds(),
+ experimentalClientSideRenderingEnabled:
+ experimentalClientSideRenderingOption.getValue({
+ commandLine: parsedCli,
+ }).value,
+ });
+
const result = await StudioServerInternals.startStudio({
previewEntry: require.resolve('@remotion/studio/previewEntry'),
browserArgs: parsedCli['browser-args'],
@@ -198,6 +217,7 @@ export const studioCommand = async (
interactivityEnabled,
forceNew: forceNewStudioOption.getValue({commandLine: parsedCli}).value,
rspack: useRspack,
+ getStudioRuntimeConfig,
});
if (result.type === 'already-running') {
diff --git a/packages/studio-server/src/preview-server/start-server.ts b/packages/studio-server/src/preview-server/start-server.ts
index fb6c317e19..50e2a748ed 100644
--- a/packages/studio-server/src/preview-server/start-server.ts
+++ b/packages/studio-server/src/preview-server/start-server.ts
@@ -12,6 +12,7 @@ import type {
GitSource,
RenderDefaults,
RenderJob,
+ StudioRuntimeConfig,
} from '@remotion/studio-shared';
import {detectRemotionServer} from '../detect-remotion-server';
import {handleRoutes} from '../routes';
@@ -69,6 +70,7 @@ export const startServer = async (options: {
interactivityEnabled: boolean;
forceNew: boolean;
rspack: boolean;
+ getStudioRuntimeConfig: () => StudioRuntimeConfig;
}): Promise<StartServerResult> => {
const desiredPort =
options?.port ??
@@ -177,6 +179,7 @@ export const startServer = async (options: {
audioLatencyHint: options.audioLatencyHint,
previewSampleRate: options.previewSampleRate,
enableCrossSiteIsolation: options.enableCrossSiteIsolation,
+ getStudioRuntimeConfig: options.getStudioRuntimeConfig,
});
})
.catch((err) => {
diff --git a/packages/studio-server/src/routes.ts b/packages/studio-server/src/routes.ts
index 11f05e5166..b07aebb69e 100644
--- a/packages/studio-server/src/routes.ts
+++ b/packages/studio-server/src/routes.ts
@@ -12,6 +12,7 @@ import type {
GitSource,
RenderDefaults,
RenderJob,
+ StudioRuntimeConfig,
} from '@remotion/studio-shared';
import {getProjectName, parseElementDragData} from '@remotion/studio-shared';
import {getCompletedClientRenders} from './client-render-queue';
@@ -284,6 +285,7 @@ const handleFallback = async ({
gitSource,
logLevel,
enableCrossSiteIsolation,
+ getStudioRuntimeConfig,
}: {
remotionRoot: string;
hash: string;
@@ -300,6 +302,7 @@ const handleFallback = async ({
gitSource: GitSource | null;
logLevel: LogLevel;
enableCrossSiteIsolation: boolean;
+ getStudioRuntimeConfig: () => StudioRuntimeConfig;
}) => {
const acceptsHtml = (request.headers.accept ?? '').includes('text/html');
if (request.method === 'GET' && acceptsHtml) {
@@ -378,6 +381,7 @@ const handleFallback = async ({
mode: 'dev',
audioLatencyHint: audioLatencyHint ?? 'playback',
sampleRate: previewSampleRate,
+ studioRuntimeConfig: getStudioRuntimeConfig(),
}),
);
};
@@ -571,6 +575,7 @@ export const handleRoutes = ({
audioLatencyHint,
previewSampleRate,
enableCrossSiteIsolation,
+ getStudioRuntimeConfig,
}: {
staticHash: string;
staticHashPrefix: string;
@@ -594,6 +599,7 @@ export const handleRoutes = ({
audioLatencyHint: AudioContextLatencyCategory | null;
previewSampleRate: number | null;
enableCrossSiteIsolation: boolean;
+ getStudioRuntimeConfig: () => StudioRuntimeConfig;
}): Promise<void> => {
const url = new URL(request.url as string, 'http://localhost');
@@ -740,5 +746,6 @@ export const handleRoutes = ({
audioLatencyHint,
previewSampleRate,
enableCrossSiteIsolation,
+ getStudioRuntimeConfig,
});
};
diff --git a/packages/studio-server/src/start-studio.ts b/packages/studio-server/src/start-studio.ts
index f44ff0b132..8421bb34e7 100644
--- a/packages/studio-server/src/start-studio.ts
+++ b/packages/studio-server/src/start-studio.ts
@@ -8,6 +8,7 @@ import type {
GitSource,
RenderDefaults,
RenderJob,
+ StudioRuntimeConfig,
} from '@remotion/studio-shared';
import {getFileWatcherRegistry} from './file-watcher';
import {getNetworkAddress} from './get-network-address';
@@ -59,6 +60,7 @@ export const startStudio = async ({
interactivityEnabled,
forceNew,
rspack,
+ getStudioRuntimeConfig,
}: {
browserArgs: string;
browserFlag: string;
@@ -91,6 +93,7 @@ export const startStudio = async ({
interactivityEnabled: boolean;
forceNew: boolean;
rspack: boolean;
+ getStudioRuntimeConfig: () => StudioRuntimeConfig;
}): Promise<StartStudioResult> => {
try {
if (typeof Bun === 'undefined') {
@@ -172,6 +175,7 @@ export const startStudio = async ({
interactivityEnabled,
forceNew,
rspack,
+ getStudioRuntimeConfig,
});
if (result.type === 'already-running') {
diff --git a/packages/studio-server/src/test/file-source-route.test.ts b/packages/studio-server/src/test/file-source-route.test.ts
index ca36fd7144..dc88ffd6a6 100644
--- a/packages/studio-server/src/test/file-source-route.test.ts
+++ b/packages/studio-server/src/test/file-source-route.test.ts
@@ -76,6 +76,14 @@ test('serves file source from an origin-less GET request', async () => {
getEnvVariables: () => ({}),
getRenderDefaults: () => ({}) as RenderDefaults,
getRenderQueue: () => [],
+ getStudioRuntimeConfig: () => ({
+ askAIEnabled: false,
+ bufferStateDelayInMilliseconds: null,
+ experimentalClientSideRenderingEnabled: false,
+ interactivityEnabled: true,
+ keyboardShortcutsEnabled: true,
+ maxTimelineTracks: null,
+ }),
gitSource: null,
liveEventsServer: noopLiveEventsServer,
logLevel: 'info',
diff --git a/packages/studio-shared/src/index.ts b/packages/studio-shared/src/index.ts
index 703a956fc4..1f2766f0e5 100644
--- a/packages/studio-shared/src/index.ts
+++ b/packages/studio-shared/src/index.ts
@@ -310,6 +310,7 @@ export {
type StudioEntryPointPaths,
} from './studio-entry-points';
export {studioHtml, type StudioHtmlOptions} from './studio-html';
+export type {StudioRuntimeConfig} from './studio-runtime-config';
export type {VisualControlChange} from './codemods';
export {
diff --git a/packages/studio-shared/src/render-defaults.ts b/packages/studio-shared/src/render-defaults.ts
index 1e5aefbd0f..20330043c3 100644
--- a/packages/studio-shared/src/render-defaults.ts
+++ b/packages/studio-shared/src/render-defaults.ts
@@ -14,6 +14,7 @@ import type {HardwareAccelerationOption} from '@remotion/renderer/client';
import type {_InternalTypes} from 'remotion';
import type {GitSource} from './git-source';
import type {PackageManager} from './package-manager';
+import type {StudioRuntimeConfig} from './studio-runtime-config';
export type RenderDefaults = {
jpegQuality: number;
@@ -68,5 +69,6 @@ declare global {
remotion_gitSource: GitSource | null;
remotion_installedPackages: string[] | null;
remotion_packageManager: PackageManager | 'unknown';
+ remotion_studioConfig: StudioRuntimeConfig | null;
}
}
diff --git a/packages/studio-shared/src/studio-html.ts b/packages/studio-shared/src/studio-html.ts
index a733085dc0..25e092b7f8 100644
--- a/packages/studio-shared/src/studio-html.ts
+++ b/packages/studio-shared/src/studio-html.ts
@@ -3,6 +3,7 @@ import {Internals, VERSION} from 'remotion';
import type {GitSource} from './git-source';
import type {PackageManager} from './package-manager';
import type {RenderDefaults} from './render-defaults';
+import type {StudioRuntimeConfig} from './studio-runtime-config';
export type StudioHtmlOptions = {
staticHash: string;
@@ -30,6 +31,7 @@ export type StudioHtmlOptions = {
mode: 'dev' | 'bundle';
bundleScriptUrl?: string;
readOnlyStudio?: boolean;
+ studioRuntimeConfig?: StudioRuntimeConfig;
};
export const studioHtml = ({
@@ -58,6 +60,7 @@ export const studioHtml = ({
mode,
bundleScriptUrl,
readOnlyStudio,
+ studioRuntimeConfig,
}: StudioHtmlOptions) => {
const scriptUrl = bundleScriptUrl ?? `${publicPath}bundle.js`;
@@ -90,6 +93,9 @@ export const studioHtml = ({
<script>window.remotion_publicPath = ${JSON.stringify(publicPath)};</script>
<script>window.remotion_audioEnabled = true;</script>
<script>window.remotion_videoEnabled = true;</script>
+ <script>window.remotion_studioConfig = ${JSON.stringify(
+ studioRuntimeConfig ?? null,
+ )};</script>
<script>window.remotion_renderDefaults = ${JSON.stringify(
renderDefaults,
)};</script>
diff --git a/packages/studio-shared/src/studio-runtime-config.ts b/packages/studio-shared/src/studio-runtime-config.ts
new file mode 100644
index 0000000000..ac5612d48e
--- /dev/null
+++ b/packages/studio-shared/src/studio-runtime-config.ts
@@ -0,0 +1,8 @@
+export type StudioRuntimeConfig = {
+ readonly maxTimelineTracks: number | null;
+ readonly askAIEnabled: boolean;
+ readonly interactivityEnabled: boolean;
+ readonly keyboardShortcutsEnabled: boolean;
+ readonly bufferStateDelayInMilliseconds: number | null;
+ readonly experimentalClientSideRenderingEnabled: boolean;
+};
diff --git a/packages/studio/src/components/Editor.tsx b/packages/studio/src/components/Editor.tsx
index c3e716d8e3..4b4daa0cfc 100644
--- a/packages/studio/src/components/Editor.tsx
+++ b/packages/studio/src/components/Editor.tsx
@@ -4,6 +4,7 @@ import type {CurrentScaleContextType} from 'remotion';
import {Internals} from 'remotion';
import {BACKGROUND} from '../helpers/colors';
import {noop} from '../helpers/noop';
+import {getStudioBufferStateDelayInMilliseconds} from '../helpers/studio-runtime-config';
import {drawRef} from '../state/canvas-ref';
import {ScaleLockProvider} from '../state/scale-lock';
import {TimelineZoomContext} from '../state/timeline-zoom';
@@ -27,13 +28,8 @@ const background: React.CSSProperties = {
position: 'absolute',
};
-const DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
-
export const BUFFER_STATE_DELAY_IN_MILLISECONDS =
- typeof process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === 'undefined' ||
- process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === null
- ? DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS
- : Number(process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS);
+ getStudioBufferStateDelayInMilliseconds();
export const Editor: React.FC<{
readonly Root: React.FC;
diff --git a/packages/studio/src/components/GlobalKeybindings.tsx b/packages/studio/src/components/GlobalKeybindings.tsx
index 53069e906f..f06e85b64b 100644
--- a/packages/studio/src/components/GlobalKeybindings.tsx
+++ b/packages/studio/src/components/GlobalKeybindings.tsx
@@ -4,6 +4,7 @@ import {Internals} from 'remotion';
import {calculateTimeline} from '../helpers/calculate-timeline';
import {StudioServerConnectionCtx} from '../helpers/client-id';
import {SHOW_BROWSER_RENDERING} from '../helpers/show-browser-rendering';
+import {getStudioAskAIEnabled} from '../helpers/studio-runtime-config';
import {timelineNodePathInfoToKey} from '../helpers/timeline-node-path-key';
import {useKeybinding} from '../helpers/use-keybinding';
import {CheckerboardContext} from '../state/checkerboard';
@@ -175,7 +176,7 @@ export const GlobalKeybindings: React.FC<{
commandCtrlKey: true,
preventDefault: true,
});
- const cmdIKey = process.env.ASK_AI_ENABLED
+ const cmdIKey = getStudioAskAIEnabled()
? keybindings.registerKeybinding({
event: 'keydown',
key: 'i',
diff --git a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx b/packages/studio/src/components/KeyboardShortcutsExplainer.tsx
index 0549090c60..6f14b0ee66 100644
--- a/packages/studio/src/components/KeyboardShortcutsExplainer.tsx
+++ b/packages/studio/src/components/KeyboardShortcutsExplainer.tsx
@@ -7,6 +7,7 @@ import {
WHITE,
WHITE_ALPHA_10,
} from '../helpers/colors';
+import {getStudioAskAIEnabled} from '../helpers/studio-runtime-config';
import {areKeyboardShortcutsDisabled} from '../helpers/use-keybinding';
import {ArrowLeft, ArrowRight, ShiftIcon} from '../icons/keys';
import {Column, Row, Spacing} from './layout';
@@ -401,7 +402,7 @@ export const KeyboardShortcutsExplainer: React.FC = () => {
</div>
<div style={right}>Delete / reset selection</div>
</Row>
- {process.env.ASK_AI_ENABLED && (
+ {getStudioAskAIEnabled() && (
<>
<br />
<div style={title}>AI</div>
diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsx
index daf7700890..a484198c35 100644
--- a/packages/studio/src/components/Modals.tsx
+++ b/packages/studio/src/components/Modals.tsx
@@ -1,5 +1,6 @@
import React, {useContext} from 'react';
import {StudioServerConnectionCtx} from '../helpers/client-id';
+import {getStudioAskAIEnabled} from '../helpers/studio-runtime-config';
import {ModalsContext} from '../state/modals';
import {AskAiModal} from './AskAiModal';
import {ConfirmationDialog} from './ConfirmationDialog';
@@ -185,7 +186,7 @@ export const Modals: React.FC<{
{modalContextType && modalContextType.type === 'confirmation-dialog' && (
<ConfirmationDialog state={modalContextType} />
)}
- {process.env.ASK_AI_ENABLED && <AskAiModal />}
+ {getStudioAskAIEnabled() && <AskAiModal />}
</>
);
};
diff --git a/packages/studio/src/components/NewComposition/MenuContent.tsx b/packages/studio/src/components/NewComposition/MenuContent.tsx
index afd18a4fbd..78ef30a7d0 100644
--- a/packages/studio/src/components/NewComposition/MenuContent.tsx
+++ b/packages/studio/src/components/NewComposition/MenuContent.tsx
@@ -2,6 +2,7 @@ import type {PointerEvent, SetStateAction} from 'react';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {BLACK_ALPHA_60} from '../../helpers/colors';
import {useMobileLayout} from '../../helpers/mobile-layout';
+import {getStudioKeyboardShortcutsEnabled} from '../../helpers/studio-runtime-config';
import {useKeybinding} from '../../helpers/use-keybinding';
import {VERTICAL_SCROLLBAR_CLASSNAME} from '../Menu/is-menu-item';
import {MenuDivider} from '../Menu/MenuDivider';
@@ -240,10 +241,7 @@ export const MenuContent: React.FC<{
}, [fixedHeight, isMobileLayout]);
useEffect(() => {
- if (
- !keybindings.isHighestContext ||
- !process.env.KEYBOARD_SHORTCUTS_ENABLED
- ) {
+ if (!keybindings.isHighestContext || !getStudioKeyboardShortcutsEnabled()) {
return;
}
diff --git a/packages/studio/src/components/Timeline/MaxTimelineTracks.tsx b/packages/studio/src/components/Timeline/MaxTimelineTracks.tsx
index dce3add5a3..bb6dcdaff9 100644
--- a/packages/studio/src/components/Timeline/MaxTimelineTracks.tsx
+++ b/packages/studio/src/components/Timeline/MaxTimelineTracks.tsx
@@ -1,13 +1,9 @@
-import {DEFAULT_TIMELINE_TRACKS} from '@remotion/studio-shared';
import React from 'react';
import {WHITE_ALPHA_10, WHITE_ALPHA_60} from '../../helpers/colors';
+import {getStudioMaxTimelineTracks} from '../../helpers/studio-runtime-config';
import {TIMELINE_PADDING} from '../../helpers/timeline-layout';
-export const MAX_TIMELINE_TRACKS =
- typeof process.env.MAX_TIMELINE_TRACKS === 'undefined' ||
- process.env.MAX_TIMELINE_TRACKS === null
- ? DEFAULT_TIMELINE_TRACKS
- : Number(process.env.MAX_TIMELINE_TRACKS);
+export const MAX_TIMELINE_TRACKS = getStudioMaxTimelineTracks();
export const MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
diff --git a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
index 2b4f843bf2..d7919fed00 100644
--- a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx
@@ -14,6 +14,7 @@ import {
import {formatFileLocation} from '../../helpers/format-file-location';
import type {SequenceNodePathInfo} from '../../helpers/get-timeline-sequence-sort-key';
import {studioInteractivityEnabled} from '../../helpers/interactivity-enabled';
+import {getStudioKeyboardShortcutsEnabled} from '../../helpers/studio-runtime-config';
import {
getTimelineLayerHeight,
TIMELINE_ITEM_BORDER_BOTTOM,
@@ -760,7 +761,7 @@ export const TimelineSequenceItem: React.FC<{
);
React.useEffect(() => {
- if (!canRenameSelectedSequence || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
+ if (!canRenameSelectedSequence || !getStudioKeyboardShortcutsEnabled()) {
setIsRenaming(false);
return;
}
diff --git a/packages/studio/src/helpers/interactivity-enabled.ts b/packages/studio/src/helpers/interactivity-enabled.ts
index 60fda4e4a7..3f77dbed19 100644
--- a/packages/studio/src/helpers/interactivity-enabled.ts
+++ b/packages/studio/src/helpers/interactivity-enabled.ts
@@ -1,6 +1,3 @@
-const interactivityEnabled = process.env.INTERACTIVITY_ENABLED as unknown;
+import {getStudioInteractivityEnabled} from './studio-runtime-config';
-export const studioInteractivityEnabled =
- interactivityEnabled === undefined || interactivityEnabled === null
- ? true
- : interactivityEnabled !== false && interactivityEnabled !== 'false';
+export const studioInteractivityEnabled = getStudioInteractivityEnabled();
diff --git a/packages/studio/src/helpers/show-browser-rendering.ts b/packages/studio/src/helpers/show-browser-rendering.ts
index c362bc3651..61b7f97a4b 100644
--- a/packages/studio/src/helpers/show-browser-rendering.ts
+++ b/packages/studio/src/helpers/show-browser-rendering.ts
@@ -1,3 +1,4 @@
-export const SHOW_BROWSER_RENDERING = Boolean(
- process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED,
-);
+import {getStudioExperimentalClientSideRenderingEnabled} from './studio-runtime-config';
+
+export const SHOW_BROWSER_RENDERING =
+ getStudioExperimentalClientSideRenderingEnabled();
diff --git a/packages/studio/src/helpers/studio-runtime-config.ts b/packages/studio/src/helpers/studio-runtime-config.ts
new file mode 100644
index 0000000000..2e2d0e013a
--- /dev/null
+++ b/packages/studio/src/helpers/studio-runtime-config.ts
@@ -0,0 +1,48 @@
+import type {StudioRuntimeConfig} from '@remotion/studio-shared';
+import {DEFAULT_TIMELINE_TRACKS} from '@remotion/studio-shared';
+
+export const DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
+
+const defaultStudioRuntimeConfig: StudioRuntimeConfig = {
+ askAIEnabled: false,
+ bufferStateDelayInMilliseconds: null,
+ experimentalClientSideRenderingEnabled: false,
+ interactivityEnabled: true,
+ keyboardShortcutsEnabled: true,
+ maxTimelineTracks: null,
+};
+
+const getStudioRuntimeConfig = (): StudioRuntimeConfig => {
+ if (typeof window === 'undefined') {
+ return defaultStudioRuntimeConfig;
+ }
+
+ return window.remotion_studioConfig ?? defaultStudioRuntimeConfig;
+};
+
+export const getStudioAskAIEnabled = () => {
+ return getStudioRuntimeConfig().askAIEnabled;
+};
+
+export const getStudioInteractivityEnabled = () => {
+ return getStudioRuntimeConfig().interactivityEnabled;
+};
+
+export const getStudioKeyboardShortcutsEnabled = () => {
+ return getStudioRuntimeConfig().keyboardShortcutsEnabled;
+};
+
+export const getStudioExperimentalClientSideRenderingEnabled = () => {
+ return getStudioRuntimeConfig().experimentalClientSideRenderingEnabled;
+};
+
+export const getStudioMaxTimelineTracks = () => {
+ return getStudioRuntimeConfig().maxTimelineTracks ?? DEFAULT_TIMELINE_TRACKS;
+};
+
+export const getStudioBufferStateDelayInMilliseconds = () => {
+ return (
+ getStudioRuntimeConfig().bufferStateDelayInMilliseconds ??
+ DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS
+ );
+};
diff --git a/packages/studio/src/helpers/use-keybinding.ts b/packages/studio/src/helpers/use-keybinding.ts
index 6dda262e22..f62a63ac40 100644
--- a/packages/studio/src/helpers/use-keybinding.ts
+++ b/packages/studio/src/helpers/use-keybinding.ts
@@ -2,8 +2,9 @@ import {useCallback, useContext, useEffect, useMemo, useState} from 'react';
import type {KeyEventType, RegisteredKeybinding} from '../state/keybindings';
import {KeybindingContext} from '../state/keybindings';
import {useZIndex} from '../state/z-index';
+import {getStudioKeyboardShortcutsEnabled} from './studio-runtime-config';
-if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
+if (!getStudioKeyboardShortcutsEnabled()) {
// eslint-disable-next-line no-console
console.warn(
'Keyboard shortcuts disabled either due to: a) --disable-keyboard-shortcuts being passed b) Config.setKeyboardShortcutsEnabled(false) being set or c) a Remotion version mismatch.',
@@ -11,7 +12,7 @@ if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
}
export const areKeyboardShortcutsDisabled = () => {
- return !process.env.KEYBOARD_SHORTCUTS_ENABLED;
+ return !getStudioKeyboardShortcutsEnabled();
};
export const useKeybinding = () => {
@@ -29,7 +30,7 @@ export const useKeybinding = () => {
triggerIfInputFieldFocused: boolean;
keepRegisteredWhenNotHighestContext: boolean;
}) => {
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
+ if (!getStudioKeyboardShortcutsEnabled()) {
return {
unregister: () => undefined,
};
diff --git a/packages/studio/src/helpers/use-menu-structure.tsx b/packages/studio/src/helpers/use-menu-structure.tsx
index 525ca5a946..5efcbb7358 100644
--- a/packages/studio/src/helpers/use-menu-structure.tsx
+++ b/packages/studio/src/helpers/use-menu-structure.tsx
@@ -36,6 +36,7 @@ import {useMobileLayout} from './mobile-layout';
import {openInEditor, preloadCompositionComponentInfo} from './open-in-editor';
import {pickColor} from './pick-color';
import {SHOW_BROWSER_RENDERING} from './show-browser-rendering';
+import {getStudioAskAIEnabled} from './studio-runtime-config';
import {areKeyboardShortcutsDisabled} from './use-keybinding';
type Structure = Menu[];
@@ -785,7 +786,7 @@ export const useMenuStructure = (
label: 'Tools',
leaveLeftPadding: false,
items: [
- process.env.ASK_AI_ENABLED
+ getStudioAskAIEnabled()
? {
id: 'ask-ai',
value: 'ask-ai',