@remotion/studio 4.0.488 → 4.0.489

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -611,11 +611,12 @@ const Canvas = ({ canvasContent, size }) => {
611
611
  (0, react_1.useEffect)(() => {
612
612
  fetchMetadata();
613
613
  }, [fetchMetadata]);
614
- const updateElementInstallTarget = (0, react_1.useCallback)(() => {
614
+ const updateElementInstallTarget = (0, react_1.useCallback)((requestId) => {
615
615
  if (previewServerClientId === null) {
616
616
  return;
617
617
  }
618
618
  (0, call_api_1.callApi)('/api/update-element-install-target', {
619
+ requestId,
619
620
  clientId: previewServerClientId,
620
621
  compositionFile: canInstallElements ? compositionFile : null,
621
622
  compositionId: canInstallElements ? currentCompositionId : null,
@@ -629,17 +630,9 @@ const Canvas = ({ canvasContent, size }) => {
629
630
  currentCompositionId,
630
631
  previewServerClientId,
631
632
  ]);
632
- (0, react_1.useEffect)(() => {
633
- updateElementInstallTarget();
634
- const interval = window.setInterval(updateElementInstallTarget, 2000);
635
- return () => {
636
- window.clearInterval(interval);
637
- };
638
- }, [updateElementInstallTarget]);
639
633
  (0, react_1.useEffect)(() => {
640
634
  const markFocused = () => {
641
635
  lastFocusedAtRef.current = Date.now();
642
- updateElementInstallTarget();
643
636
  };
644
637
  window.addEventListener('focus', markFocused);
645
638
  document.addEventListener('pointerdown', markFocused, { capture: true });
@@ -647,7 +640,15 @@ const Canvas = ({ canvasContent, size }) => {
647
640
  window.removeEventListener('focus', markFocused);
648
641
  document.removeEventListener('pointerdown', markFocused, { capture: true });
649
642
  };
650
- }, [updateElementInstallTarget]);
643
+ }, []);
644
+ (0, react_1.useEffect)(() => {
645
+ return subscribeToEvent('request-element-install-target', (event) => {
646
+ if (event.type !== 'request-element-install-target') {
647
+ return;
648
+ }
649
+ updateElementInstallTarget(event.requestId);
650
+ });
651
+ }, [subscribeToEvent, updateElementInstallTarget]);
651
652
  (0, react_1.useEffect)(() => {
652
653
  if (installingElementName === null) {
653
654
  return;
@@ -40,6 +40,7 @@ const react_1 = __importStar(require("react"));
40
40
  const remotion_1 = require("remotion");
41
41
  const colors_1 = require("../helpers/colors");
42
42
  const noop_1 = require("../helpers/noop");
43
+ const studio_runtime_config_1 = require("../helpers/studio-runtime-config");
43
44
  const canvas_ref_1 = require("../state/canvas-ref");
44
45
  const scale_lock_1 = require("../state/scale-lock");
45
46
  const timeline_zoom_1 = require("../state/timeline-zoom");
@@ -61,11 +62,7 @@ const background = {
61
62
  flexDirection: 'column',
62
63
  position: 'absolute',
63
64
  };
64
- const DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
65
- exports.BUFFER_STATE_DELAY_IN_MILLISECONDS = typeof process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === 'undefined' ||
66
- process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS === null
67
- ? DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS
68
- : Number(process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS);
65
+ exports.BUFFER_STATE_DELAY_IN_MILLISECONDS = (0, studio_runtime_config_1.getStudioBufferStateDelayInMilliseconds)();
69
66
  const Editor = ({ Root, readOnlyStudio }) => {
70
67
  const [drawElement, setDrawElement] = (0, react_1.useState)(null);
71
68
  const size = player_1.PlayerInternals.useElementSize(drawElement, {
@@ -6,6 +6,7 @@ const remotion_1 = require("remotion");
6
6
  const calculate_timeline_1 = require("../helpers/calculate-timeline");
7
7
  const client_id_1 = require("../helpers/client-id");
8
8
  const show_browser_rendering_1 = require("../helpers/show-browser-rendering");
9
+ const studio_runtime_config_1 = require("../helpers/studio-runtime-config");
9
10
  const timeline_node_path_key_1 = require("../helpers/timeline-node-path-key");
10
11
  const use_keybinding_1 = require("../helpers/use-keybinding");
11
12
  const checkerboard_1 = require("../state/checkerboard");
@@ -134,7 +135,7 @@ const GlobalKeybindings = ({ readOnlyStudio }) => {
134
135
  commandCtrlKey: true,
135
136
  preventDefault: true,
136
137
  });
137
- const cmdIKey = process.env.ASK_AI_ENABLED
138
+ const cmdIKey = (0, studio_runtime_config_1.getStudioAskAIEnabled)()
138
139
  ? keybindings.registerKeybinding({
139
140
  event: 'keydown',
140
141
  key: 'i',
@@ -4,6 +4,7 @@ exports.KeyboardShortcutsExplainer = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
6
6
  const colors_1 = require("../helpers/colors");
7
+ const studio_runtime_config_1 = require("../helpers/studio-runtime-config");
7
8
  const use_keybinding_1 = require("../helpers/use-keybinding");
8
9
  const keys_1 = require("../icons/keys");
9
10
  const layout_1 = require("./layout");
@@ -174,7 +175,7 @@ const KeyboardShortcutsExplainer = () => {
174
175
  jsx_runtime_1.jsxs("div", { style: left, children: [
175
176
  jsx_runtime_1.jsx("kbd", { style: key, children: "Del" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.3 }), jsx_runtime_1.jsx("kbd", { style: key, children: "\u232B" })
176
177
  ] }), jsx_runtime_1.jsx("div", { style: right, children: "Delete / reset selection" })
177
- ] }), process.env.ASK_AI_ENABLED && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
178
+ ] }), (0, studio_runtime_config_1.getStudioAskAIEnabled)() && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
178
179
  jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("div", { style: title, children: "AI" }), jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
179
180
  jsx_runtime_1.jsxs("div", { style: left, children: [
180
181
  jsx_runtime_1.jsx("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.3 }), jsx_runtime_1.jsx("kbd", { style: key, children: "I" })
@@ -7,6 +7,7 @@ exports.Modals = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const client_id_1 = require("../helpers/client-id");
10
+ const studio_runtime_config_1 = require("../helpers/studio-runtime-config");
10
11
  const modals_1 = require("../state/modals");
11
12
  const AskAiModal_1 = require("./AskAiModal");
12
13
  const ConfirmationDialog_1 = require("./ConfirmationDialog");
@@ -34,6 +35,6 @@ const Modals = ({ readOnlyStudio }) => {
34
35
  'connected';
35
36
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [modalContextType && modalContextType.type === 'new-comp' && (jsx_runtime_1.jsx(NewComposition_1.NewComposition, { folderName: modalContextType.folderName, parentName: modalContextType.parentName, stack: modalContextType.stack })), modalContextType && modalContextType.type === 'new-folder' && (jsx_runtime_1.jsx(NewFolder_1.NewFolder, { parentName: modalContextType.parentName, stack: modalContextType.stack })), modalContextType && modalContextType.type === 'duplicate-comp' && (jsx_runtime_1.jsx(DuplicateComposition_1.DuplicateComposition, { compositionType: modalContextType.compositionType, compositionId: modalContextType.compositionId })), modalContextType && modalContextType.type === 'delete-comp' && (jsx_runtime_1.jsx(DeleteComposition_1.DeleteComposition, { compositionId: modalContextType.compositionId })), modalContextType && modalContextType.type === 'rename-comp' && (jsx_runtime_1.jsx(RenameComposition_1.RenameComposition, { compositionId: modalContextType.compositionId })), modalContextType && modalContextType.type === 'delete-folder' && (jsx_runtime_1.jsx(DeleteFolder_1.DeleteFolder, { folderName: modalContextType.folderName, parentName: modalContextType.parentName, stack: modalContextType.stack })), modalContextType && modalContextType.type === 'rename-folder' && (jsx_runtime_1.jsx(RenameFolder_1.RenameFolder, { folderName: modalContextType.folderName, parentName: modalContextType.parentName, stack: modalContextType.stack })), modalContextType && modalContextType.type === 'rename-static-file' && (jsx_runtime_1.jsx(RenameStaticFile_1.RenameStaticFileModal, { relativePath: modalContextType.relativePath })), modalContextType && modalContextType.type === 'input-props-override' && (jsx_runtime_1.jsx(OverrideInputProps_1.OverrideInputPropsModal, {})), modalContextType && modalContextType.type === 'keyframe-settings' && (jsx_runtime_1.jsx(KeyframeSettingsModal_1.KeyframeSettingsModal, { state: modalContextType })), modalContextType && modalContextType.type === 'web-render' && (jsx_runtime_1.jsx(WebRenderModal_1.WebRenderModalWithLoader, { ...modalContextType })), modalContextType &&
36
37
  modalContextType.type === 'server-render' &&
37
- (canRender || modalContextType.readOnlyStudio) ? (jsx_runtime_1.jsx(ServerRenderModal_1.RenderModalWithLoader, { readOnlyStudio: (_a = modalContextType.readOnlyStudio) !== null && _a !== void 0 ? _a : false, initialFrame: modalContextType.initialFrame, initialDarkMode: modalContextType.initialDarkMode, compositionId: modalContextType.compositionId, initialVideoImageFormat: modalContextType.initialVideoImageFormat, initialJpegQuality: modalContextType.initialJpegQuality, initialScale: modalContextType.initialScale, initialLogLevel: modalContextType.initialLogLevel, initialOffthreadVideoCacheSizeInBytes: modalContextType.initialOffthreadVideoCacheSizeInBytes, initialOffthreadVideoThreads: modalContextType.initialOffthreadVideoThreads, initialMediaCacheSizeInBytes: modalContextType.initialMediaCacheSizeInBytes, initialConcurrency: modalContextType.initialConcurrency, maxConcurrency: modalContextType.maxConcurrency, minConcurrency: modalContextType.minConcurrency, initialStillImageFormat: modalContextType.initialStillImageFormat, initialMuted: modalContextType.initialMuted, initialEnforceAudioTrack: modalContextType.initialEnforceAudioTrack, initialProResProfile: modalContextType.initialProResProfile, initialx264Preset: modalContextType.initialx264Preset, initialGopSize: modalContextType.initialGopSize, initialPixelFormat: modalContextType.initialPixelFormat, initialAudioBitrate: modalContextType.initialAudioBitrate, initialVideoBitrate: modalContextType.initialVideoBitrate, initialEveryNthFrame: modalContextType.initialEveryNthFrame, initialNumberOfGifLoops: modalContextType.initialNumberOfGifLoops, initialDelayRenderTimeout: modalContextType.initialDelayRenderTimeout, initialEnvVariables: modalContextType.initialEnvVariables, initialDisableWebSecurity: modalContextType.initialDisableWebSecurity, initialGl: modalContextType.initialOpenGlRenderer, initialHeadless: modalContextType.initialHeadless, initialIgnoreCertificateErrors: modalContextType.initialIgnoreCertificateErrors, initialEncodingBufferSize: modalContextType.initialEncodingBufferSize, initialEncodingMaxRate: modalContextType.initialEncodingMaxRate, initialUserAgent: modalContextType.initialUserAgent, initialColorSpace: modalContextType.initialColorSpace, initialMultiProcessOnLinux: modalContextType.initialMultiProcessOnLinux, initialRepro: modalContextType.initialRepro, initialBeep: modalContextType.initialBeep, initialForSeamlessAacConcatenation: modalContextType.initialForSeamlessAacConcatenation, defaultProps: modalContextType.defaultProps, inFrameMark: modalContextType.inFrameMark, outFrameMark: modalContextType.outFrameMark, defaultConfigurationAudioCodec: modalContextType.defaultConfigurationAudioCodec, defaultConfigurationVideoCodec: modalContextType.defaultConfigurationVideoCodec, renderTypeOfLastRender: modalContextType.renderTypeOfLastRender, defaultMetadata: modalContextType.defaulMetadata, initialHardwareAcceleration: modalContextType.initialHardwareAcceleration, initialSampleRate: modalContextType.initialSampleRate, initialChromeMode: modalContextType.initialChromeMode, renderDefaults: modalContextType.renderDefaults })) : null, modalContextType && modalContextType.type === 'render-progress' && (jsx_runtime_1.jsx(RenderStatusModal_1.RenderStatusModal, { jobId: modalContextType.jobId })), modalContextType && modalContextType.type === 'update' && (jsx_runtime_1.jsx(UpdateModal_1.UpdateModal, { info: modalContextType.info, knownBugs: modalContextType.knownBugs })), modalContextType && modalContextType.type === 'install-packages' && (jsx_runtime_1.jsx(InstallPackage_1.InstallPackageModal, { packageManager: modalContextType.packageManager })), modalContextType && modalContextType.type === 'quick-switcher' && (jsx_runtime_1.jsx(QuickSwitcher_1.default, { readOnlyStudio: readOnlyStudio, invocationTimestamp: modalContextType.invocationTimestamp, initialMode: modalContextType.mode })), modalContextType && modalContextType.type === 'add-effect' && (jsx_runtime_1.jsx(EffectPickerModal_1.EffectPickerModal, { state: modalContextType })), modalContextType && modalContextType.type === 'confirmation-dialog' && (jsx_runtime_1.jsx(ConfirmationDialog_1.ConfirmationDialog, { state: modalContextType })), process.env.ASK_AI_ENABLED && jsx_runtime_1.jsx(AskAiModal_1.AskAiModal, {})] }));
38
+ (canRender || modalContextType.readOnlyStudio) ? (jsx_runtime_1.jsx(ServerRenderModal_1.RenderModalWithLoader, { readOnlyStudio: (_a = modalContextType.readOnlyStudio) !== null && _a !== void 0 ? _a : false, initialFrame: modalContextType.initialFrame, initialDarkMode: modalContextType.initialDarkMode, compositionId: modalContextType.compositionId, initialVideoImageFormat: modalContextType.initialVideoImageFormat, initialJpegQuality: modalContextType.initialJpegQuality, initialScale: modalContextType.initialScale, initialLogLevel: modalContextType.initialLogLevel, initialOffthreadVideoCacheSizeInBytes: modalContextType.initialOffthreadVideoCacheSizeInBytes, initialOffthreadVideoThreads: modalContextType.initialOffthreadVideoThreads, initialMediaCacheSizeInBytes: modalContextType.initialMediaCacheSizeInBytes, initialConcurrency: modalContextType.initialConcurrency, maxConcurrency: modalContextType.maxConcurrency, minConcurrency: modalContextType.minConcurrency, initialStillImageFormat: modalContextType.initialStillImageFormat, initialMuted: modalContextType.initialMuted, initialEnforceAudioTrack: modalContextType.initialEnforceAudioTrack, initialProResProfile: modalContextType.initialProResProfile, initialx264Preset: modalContextType.initialx264Preset, initialGopSize: modalContextType.initialGopSize, initialPixelFormat: modalContextType.initialPixelFormat, initialAudioBitrate: modalContextType.initialAudioBitrate, initialVideoBitrate: modalContextType.initialVideoBitrate, initialEveryNthFrame: modalContextType.initialEveryNthFrame, initialNumberOfGifLoops: modalContextType.initialNumberOfGifLoops, initialDelayRenderTimeout: modalContextType.initialDelayRenderTimeout, initialEnvVariables: modalContextType.initialEnvVariables, initialDisableWebSecurity: modalContextType.initialDisableWebSecurity, initialGl: modalContextType.initialOpenGlRenderer, initialHeadless: modalContextType.initialHeadless, initialIgnoreCertificateErrors: modalContextType.initialIgnoreCertificateErrors, initialEncodingBufferSize: modalContextType.initialEncodingBufferSize, initialEncodingMaxRate: modalContextType.initialEncodingMaxRate, initialUserAgent: modalContextType.initialUserAgent, initialColorSpace: modalContextType.initialColorSpace, initialMultiProcessOnLinux: modalContextType.initialMultiProcessOnLinux, initialRepro: modalContextType.initialRepro, initialBeep: modalContextType.initialBeep, initialForSeamlessAacConcatenation: modalContextType.initialForSeamlessAacConcatenation, defaultProps: modalContextType.defaultProps, inFrameMark: modalContextType.inFrameMark, outFrameMark: modalContextType.outFrameMark, defaultConfigurationAudioCodec: modalContextType.defaultConfigurationAudioCodec, defaultConfigurationVideoCodec: modalContextType.defaultConfigurationVideoCodec, renderTypeOfLastRender: modalContextType.renderTypeOfLastRender, defaultMetadata: modalContextType.defaulMetadata, initialHardwareAcceleration: modalContextType.initialHardwareAcceleration, initialSampleRate: modalContextType.initialSampleRate, initialChromeMode: modalContextType.initialChromeMode, renderDefaults: modalContextType.renderDefaults })) : null, modalContextType && modalContextType.type === 'render-progress' && (jsx_runtime_1.jsx(RenderStatusModal_1.RenderStatusModal, { jobId: modalContextType.jobId })), modalContextType && modalContextType.type === 'update' && (jsx_runtime_1.jsx(UpdateModal_1.UpdateModal, { info: modalContextType.info, knownBugs: modalContextType.knownBugs })), modalContextType && modalContextType.type === 'install-packages' && (jsx_runtime_1.jsx(InstallPackage_1.InstallPackageModal, { packageManager: modalContextType.packageManager })), modalContextType && modalContextType.type === 'quick-switcher' && (jsx_runtime_1.jsx(QuickSwitcher_1.default, { readOnlyStudio: readOnlyStudio, invocationTimestamp: modalContextType.invocationTimestamp, initialMode: modalContextType.mode })), modalContextType && modalContextType.type === 'add-effect' && (jsx_runtime_1.jsx(EffectPickerModal_1.EffectPickerModal, { state: modalContextType })), modalContextType && modalContextType.type === 'confirmation-dialog' && (jsx_runtime_1.jsx(ConfirmationDialog_1.ConfirmationDialog, { state: modalContextType })), (0, studio_runtime_config_1.getStudioAskAIEnabled)() && jsx_runtime_1.jsx(AskAiModal_1.AskAiModal, {})] }));
38
39
  };
39
40
  exports.Modals = Modals;
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
7
  const mobile_layout_1 = require("../../helpers/mobile-layout");
8
+ const studio_runtime_config_1 = require("../../helpers/studio-runtime-config");
8
9
  const use_keybinding_1 = require("../../helpers/use-keybinding");
9
10
  const is_menu_item_1 = require("../Menu/is-menu-item");
10
11
  const MenuDivider_1 = require("../Menu/MenuDivider");
@@ -168,8 +169,7 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
168
169
  return containerStyles;
169
170
  }, [fixedHeight, isMobileLayout]);
170
171
  (0, react_1.useEffect)(() => {
171
- if (!keybindings.isHighestContext ||
172
- !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
172
+ if (!keybindings.isHighestContext || !(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
173
173
  return;
174
174
  }
175
175
  const onKeyDown = (event) => {
@@ -2,13 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MaxTimelineTracksReached = exports.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = exports.MAX_TIMELINE_TRACKS = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const studio_shared_1 = require("@remotion/studio-shared");
6
5
  const colors_1 = require("../../helpers/colors");
6
+ const studio_runtime_config_1 = require("../../helpers/studio-runtime-config");
7
7
  const timeline_layout_1 = require("../../helpers/timeline-layout");
8
- exports.MAX_TIMELINE_TRACKS = typeof process.env.MAX_TIMELINE_TRACKS === 'undefined' ||
9
- process.env.MAX_TIMELINE_TRACKS === null
10
- ? studio_shared_1.DEFAULT_TIMELINE_TRACKS
11
- : Number(process.env.MAX_TIMELINE_TRACKS);
8
+ exports.MAX_TIMELINE_TRACKS = (0, studio_runtime_config_1.getStudioMaxTimelineTracks)();
12
9
  exports.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
13
10
  const container = {
14
11
  height: exports.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT,
@@ -41,6 +41,7 @@ const client_id_1 = require("../../helpers/client-id");
41
41
  const colors_1 = require("../../helpers/colors");
42
42
  const format_file_location_1 = require("../../helpers/format-file-location");
43
43
  const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
44
+ const studio_runtime_config_1 = require("../../helpers/studio-runtime-config");
44
45
  const timeline_layout_1 = require("../../helpers/timeline-layout");
45
46
  const use_keybinding_1 = require("../../helpers/use-keybinding");
46
47
  const modals_1 = require("../../state/modals");
@@ -558,7 +559,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
558
559
  await saveName(name);
559
560
  }, [saveName]);
560
561
  react_1.default.useEffect(() => {
561
- if (!canRenameSelectedSequence || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
562
+ if (!canRenameSelectedSequence || !(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
562
563
  setIsRenaming(false);
563
564
  return;
564
565
  }
@@ -123,6 +123,42 @@ var noop = () => {
123
123
  return;
124
124
  };
125
125
 
126
+ // src/helpers/studio-runtime-config.ts
127
+ import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
128
+ var DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
129
+ var defaultStudioRuntimeConfig = {
130
+ askAIEnabled: false,
131
+ bufferStateDelayInMilliseconds: null,
132
+ experimentalClientSideRenderingEnabled: false,
133
+ interactivityEnabled: true,
134
+ keyboardShortcutsEnabled: true,
135
+ maxTimelineTracks: null
136
+ };
137
+ var getStudioRuntimeConfig = () => {
138
+ if (typeof window === "undefined") {
139
+ return defaultStudioRuntimeConfig;
140
+ }
141
+ return window.remotion_studioConfig ?? defaultStudioRuntimeConfig;
142
+ };
143
+ var getStudioAskAIEnabled = () => {
144
+ return getStudioRuntimeConfig().askAIEnabled;
145
+ };
146
+ var getStudioInteractivityEnabled = () => {
147
+ return getStudioRuntimeConfig().interactivityEnabled;
148
+ };
149
+ var getStudioKeyboardShortcutsEnabled = () => {
150
+ return getStudioRuntimeConfig().keyboardShortcutsEnabled;
151
+ };
152
+ var getStudioExperimentalClientSideRenderingEnabled = () => {
153
+ return getStudioRuntimeConfig().experimentalClientSideRenderingEnabled;
154
+ };
155
+ var getStudioMaxTimelineTracks = () => {
156
+ return getStudioRuntimeConfig().maxTimelineTracks ?? DEFAULT_TIMELINE_TRACKS;
157
+ };
158
+ var getStudioBufferStateDelayInMilliseconds = () => {
159
+ return getStudioRuntimeConfig().bufferStateDelayInMilliseconds ?? DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS;
160
+ };
161
+
126
162
  // src/state/canvas-ref.ts
127
163
  import { createRef } from "react";
128
164
  var canvasRef = createRef();
@@ -942,18 +978,18 @@ var KeybindingContextProvider = ({ children }) => {
942
978
  };
943
979
 
944
980
  // src/helpers/use-keybinding.ts
945
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
981
+ if (!getStudioKeyboardShortcutsEnabled()) {
946
982
  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.");
947
983
  }
948
984
  var areKeyboardShortcutsDisabled = () => {
949
- return !process.env.KEYBOARD_SHORTCUTS_ENABLED;
985
+ return !getStudioKeyboardShortcutsEnabled();
950
986
  };
951
987
  var useKeybinding = () => {
952
988
  const [paneId] = useState3(() => String(Math.random()));
953
989
  const context = useContext4(KeybindingContext);
954
990
  const { isHighestContext } = useZIndex();
955
991
  const registerKeybinding = useCallback4((options) => {
956
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
992
+ if (!getStudioKeyboardShortcutsEnabled()) {
957
993
  return {
958
994
  unregister: () => {
959
995
  return;
@@ -1989,7 +2025,7 @@ var PreviewServerConnection = ({ children, readOnlyStudio }) => {
1989
2025
  };
1990
2026
 
1991
2027
  // src/helpers/show-browser-rendering.ts
1992
- var SHOW_BROWSER_RENDERING = Boolean(process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED);
2028
+ var SHOW_BROWSER_RENDERING = getStudioExperimentalClientSideRenderingEnabled();
1993
2029
 
1994
2030
  // src/helpers/timeline-node-path-key.ts
1995
2031
  import { stringifySequenceExpandedRowKey } from "@remotion/studio-shared";
@@ -3734,7 +3770,7 @@ var MenuContent = ({
3734
3770
  return containerStyles;
3735
3771
  }, [fixedHeight, isMobileLayout]);
3736
3772
  useEffect11(() => {
3737
- if (!keybindings.isHighestContext || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
3773
+ if (!keybindings.isHighestContext || !getStudioKeyboardShortcutsEnabled()) {
3738
3774
  return;
3739
3775
  }
3740
3776
  const onKeyDown = (event) => {
@@ -6090,8 +6126,7 @@ import {
6090
6126
  } from "remotion";
6091
6127
 
6092
6128
  // src/helpers/interactivity-enabled.ts
6093
- var interactivityEnabled = process.env.INTERACTIVITY_ENABLED;
6094
- var studioInteractivityEnabled = interactivityEnabled === undefined || interactivityEnabled === null ? true : interactivityEnabled !== false && interactivityEnabled !== "false";
6129
+ var studioInteractivityEnabled = getStudioInteractivityEnabled();
6095
6130
 
6096
6131
  // src/components/ExpandedTracksProvider.tsx
6097
6132
  import { createContext as createContext13, useCallback as useCallback24, useMemo as useMemo24, useState as useState20 } from "react";
@@ -10092,7 +10127,7 @@ var GlobalKeybindings = ({ readOnlyStudio }) => {
10092
10127
  commandCtrlKey: true,
10093
10128
  preventDefault: true
10094
10129
  });
10095
- const cmdIKey = process.env.ASK_AI_ENABLED ? keybindings.registerKeybinding({
10130
+ const cmdIKey = getStudioAskAIEnabled() ? keybindings.registerKeybinding({
10096
10131
  event: "keydown",
10097
10132
  key: "i",
10098
10133
  callback: () => {
@@ -11717,7 +11752,7 @@ var useMenuStructure = (closeMenu, readOnlyStudio) => {
11717
11752
  label: "Tools",
11718
11753
  leaveLeftPadding: false,
11719
11754
  items: [
11720
- process.env.ASK_AI_ENABLED ? {
11755
+ getStudioAskAIEnabled() ? {
11721
11756
  id: "ask-ai",
11722
11757
  value: "ask-ai",
11723
11758
  label: "Ask AI",
@@ -24739,11 +24774,12 @@ var Canvas = ({ canvasContent, size: size2 }) => {
24739
24774
  useEffect42(() => {
24740
24775
  fetchMetadata();
24741
24776
  }, [fetchMetadata]);
24742
- const updateElementInstallTarget = useCallback51(() => {
24777
+ const updateElementInstallTarget = useCallback51((requestId) => {
24743
24778
  if (previewServerClientId === null) {
24744
24779
  return;
24745
24780
  }
24746
24781
  callApi("/api/update-element-install-target", {
24782
+ requestId,
24747
24783
  clientId: previewServerClientId,
24748
24784
  compositionFile: canInstallElements ? compositionFile : null,
24749
24785
  compositionId: canInstallElements ? currentCompositionId : null,
@@ -24759,17 +24795,9 @@ var Canvas = ({ canvasContent, size: size2 }) => {
24759
24795
  currentCompositionId,
24760
24796
  previewServerClientId
24761
24797
  ]);
24762
- useEffect42(() => {
24763
- updateElementInstallTarget();
24764
- const interval = window.setInterval(updateElementInstallTarget, 2000);
24765
- return () => {
24766
- window.clearInterval(interval);
24767
- };
24768
- }, [updateElementInstallTarget]);
24769
24798
  useEffect42(() => {
24770
24799
  const markFocused = () => {
24771
24800
  lastFocusedAtRef.current = Date.now();
24772
- updateElementInstallTarget();
24773
24801
  };
24774
24802
  window.addEventListener("focus", markFocused);
24775
24803
  document.addEventListener("pointerdown", markFocused, { capture: true });
@@ -24777,7 +24805,15 @@ var Canvas = ({ canvasContent, size: size2 }) => {
24777
24805
  window.removeEventListener("focus", markFocused);
24778
24806
  document.removeEventListener("pointerdown", markFocused, { capture: true });
24779
24807
  };
24780
- }, [updateElementInstallTarget]);
24808
+ }, []);
24809
+ useEffect42(() => {
24810
+ return subscribeToEvent("request-element-install-target", (event) => {
24811
+ if (event.type !== "request-element-install-target") {
24812
+ return;
24813
+ }
24814
+ updateElementInstallTarget(event.requestId);
24815
+ });
24816
+ }, [subscribeToEvent, updateElementInstallTarget]);
24781
24817
  useEffect42(() => {
24782
24818
  if (installingElementName === null) {
24783
24819
  return;
@@ -47715,9 +47751,8 @@ import React207, { useCallback as useCallback166, useContext as useContext120, u
47715
47751
  import { Internals as Internals98 } from "remotion";
47716
47752
 
47717
47753
  // src/components/Timeline/MaxTimelineTracks.tsx
47718
- import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
47719
47754
  import { jsxs as jsxs128 } from "react/jsx-runtime";
47720
- var 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);
47755
+ var MAX_TIMELINE_TRACKS = getStudioMaxTimelineTracks();
47721
47756
  var MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
47722
47757
  var container39 = {
47723
47758
  height: MAX_TIMELINE_TRACKS_NOTICE_HEIGHT,
@@ -49734,7 +49769,7 @@ var TimelineSequenceItem = ({
49734
49769
  await saveName(name);
49735
49770
  }, [saveName]);
49736
49771
  React194.useEffect(() => {
49737
- if (!canRenameSelectedSequence || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
49772
+ if (!canRenameSelectedSequence || !getStudioKeyboardShortcutsEnabled()) {
49738
49773
  setIsRenaming(false);
49739
49774
  return;
49740
49775
  }
@@ -57007,7 +57042,7 @@ var KeyboardShortcutsExplainer = () => {
57007
57042
  })
57008
57043
  ]
57009
57044
  }),
57010
- process.env.ASK_AI_ENABLED && /* @__PURE__ */ jsxs164(Fragment57, {
57045
+ getStudioAskAIEnabled() && /* @__PURE__ */ jsxs164(Fragment57, {
57011
57046
  children: [
57012
57047
  /* @__PURE__ */ jsx304("br", {}),
57013
57048
  /* @__PURE__ */ jsx304("div", {
@@ -65586,7 +65621,7 @@ var Modals = ({ readOnlyStudio }) => {
65586
65621
  modalContextType && modalContextType.type === "confirmation-dialog" && /* @__PURE__ */ jsx360(ConfirmationDialog, {
65587
65622
  state: modalContextType
65588
65623
  }),
65589
- process.env.ASK_AI_ENABLED && /* @__PURE__ */ jsx360(AskAiModal, {})
65624
+ getStudioAskAIEnabled() && /* @__PURE__ */ jsx360(AskAiModal, {})
65590
65625
  ]
65591
65626
  });
65592
65627
  };
@@ -65674,8 +65709,7 @@ var background = {
65674
65709
  flexDirection: "column",
65675
65710
  position: "absolute"
65676
65711
  };
65677
- var DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
65678
- var 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);
65712
+ var BUFFER_STATE_DELAY_IN_MILLISECONDS = getStudioBufferStateDelayInMilliseconds();
65679
65713
  var Editor = ({ Root, readOnlyStudio }) => {
65680
65714
  const [drawElement, setDrawElement] = useState125(null);
65681
65715
  const size3 = PlayerInternals23.useElementSize(drawElement, {
@@ -584,8 +584,28 @@ import {
584
584
  import { jsx as jsx2 } from "react/jsx-runtime";
585
585
  var ZodContext = createContext(null);
586
586
 
587
+ // src/helpers/studio-runtime-config.ts
588
+ import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
589
+ var defaultStudioRuntimeConfig = {
590
+ askAIEnabled: false,
591
+ bufferStateDelayInMilliseconds: null,
592
+ experimentalClientSideRenderingEnabled: false,
593
+ interactivityEnabled: true,
594
+ keyboardShortcutsEnabled: true,
595
+ maxTimelineTracks: null
596
+ };
597
+ var getStudioRuntimeConfig = () => {
598
+ if (typeof window === "undefined") {
599
+ return defaultStudioRuntimeConfig;
600
+ }
601
+ return window.remotion_studioConfig ?? defaultStudioRuntimeConfig;
602
+ };
603
+ var getStudioInteractivityEnabled = () => {
604
+ return getStudioRuntimeConfig().interactivityEnabled;
605
+ };
606
+
587
607
  // src/helpers/interactivity-enabled.ts
588
- var interactivityEnabled = process.env.INTERACTIVITY_ENABLED;
608
+ var studioInteractivityEnabled = getStudioInteractivityEnabled();
589
609
 
590
610
  // src/visual-controls/VisualControls.tsx
591
611
  import { jsx as jsx3 } from "react/jsx-runtime";
@@ -176,6 +176,42 @@ var noop = () => {
176
176
  return;
177
177
  };
178
178
 
179
+ // src/helpers/studio-runtime-config.ts
180
+ import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
181
+ var DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
182
+ var defaultStudioRuntimeConfig = {
183
+ askAIEnabled: false,
184
+ bufferStateDelayInMilliseconds: null,
185
+ experimentalClientSideRenderingEnabled: false,
186
+ interactivityEnabled: true,
187
+ keyboardShortcutsEnabled: true,
188
+ maxTimelineTracks: null
189
+ };
190
+ var getStudioRuntimeConfig = () => {
191
+ if (typeof window === "undefined") {
192
+ return defaultStudioRuntimeConfig;
193
+ }
194
+ return window.remotion_studioConfig ?? defaultStudioRuntimeConfig;
195
+ };
196
+ var getStudioAskAIEnabled = () => {
197
+ return getStudioRuntimeConfig().askAIEnabled;
198
+ };
199
+ var getStudioInteractivityEnabled = () => {
200
+ return getStudioRuntimeConfig().interactivityEnabled;
201
+ };
202
+ var getStudioKeyboardShortcutsEnabled = () => {
203
+ return getStudioRuntimeConfig().keyboardShortcutsEnabled;
204
+ };
205
+ var getStudioExperimentalClientSideRenderingEnabled = () => {
206
+ return getStudioRuntimeConfig().experimentalClientSideRenderingEnabled;
207
+ };
208
+ var getStudioMaxTimelineTracks = () => {
209
+ return getStudioRuntimeConfig().maxTimelineTracks ?? DEFAULT_TIMELINE_TRACKS;
210
+ };
211
+ var getStudioBufferStateDelayInMilliseconds = () => {
212
+ return getStudioRuntimeConfig().bufferStateDelayInMilliseconds ?? DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS;
213
+ };
214
+
179
215
  // src/state/canvas-ref.ts
180
216
  import { createRef } from "react";
181
217
  var canvasRef = createRef();
@@ -995,18 +1031,18 @@ var KeybindingContextProvider = ({ children }) => {
995
1031
  };
996
1032
 
997
1033
  // src/helpers/use-keybinding.ts
998
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
1034
+ if (!getStudioKeyboardShortcutsEnabled()) {
999
1035
  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.");
1000
1036
  }
1001
1037
  var areKeyboardShortcutsDisabled = () => {
1002
- return !process.env.KEYBOARD_SHORTCUTS_ENABLED;
1038
+ return !getStudioKeyboardShortcutsEnabled();
1003
1039
  };
1004
1040
  var useKeybinding = () => {
1005
1041
  const [paneId] = useState3(() => String(Math.random()));
1006
1042
  const context = useContext4(KeybindingContext);
1007
1043
  const { isHighestContext } = useZIndex();
1008
1044
  const registerKeybinding = useCallback4((options) => {
1009
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
1045
+ if (!getStudioKeyboardShortcutsEnabled()) {
1010
1046
  return {
1011
1047
  unregister: () => {
1012
1048
  return;
@@ -2042,7 +2078,7 @@ var PreviewServerConnection = ({ children, readOnlyStudio }) => {
2042
2078
  };
2043
2079
 
2044
2080
  // src/helpers/show-browser-rendering.ts
2045
- var SHOW_BROWSER_RENDERING = Boolean(process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED);
2081
+ var SHOW_BROWSER_RENDERING = getStudioExperimentalClientSideRenderingEnabled();
2046
2082
 
2047
2083
  // src/helpers/timeline-node-path-key.ts
2048
2084
  import { stringifySequenceExpandedRowKey } from "@remotion/studio-shared";
@@ -3787,7 +3823,7 @@ var MenuContent = ({
3787
3823
  return containerStyles;
3788
3824
  }, [fixedHeight, isMobileLayout]);
3789
3825
  useEffect11(() => {
3790
- if (!keybindings.isHighestContext || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
3826
+ if (!keybindings.isHighestContext || !getStudioKeyboardShortcutsEnabled()) {
3791
3827
  return;
3792
3828
  }
3793
3829
  const onKeyDown = (event) => {
@@ -6143,8 +6179,7 @@ import {
6143
6179
  } from "remotion";
6144
6180
 
6145
6181
  // src/helpers/interactivity-enabled.ts
6146
- var interactivityEnabled = process.env.INTERACTIVITY_ENABLED;
6147
- var studioInteractivityEnabled = interactivityEnabled === undefined || interactivityEnabled === null ? true : interactivityEnabled !== false && interactivityEnabled !== "false";
6182
+ var studioInteractivityEnabled = getStudioInteractivityEnabled();
6148
6183
 
6149
6184
  // src/components/ExpandedTracksProvider.tsx
6150
6185
  import { createContext as createContext13, useCallback as useCallback24, useMemo as useMemo24, useState as useState20 } from "react";
@@ -10145,7 +10180,7 @@ var GlobalKeybindings = ({ readOnlyStudio }) => {
10145
10180
  commandCtrlKey: true,
10146
10181
  preventDefault: true
10147
10182
  });
10148
- const cmdIKey = process.env.ASK_AI_ENABLED ? keybindings.registerKeybinding({
10183
+ const cmdIKey = getStudioAskAIEnabled() ? keybindings.registerKeybinding({
10149
10184
  event: "keydown",
10150
10185
  key: "i",
10151
10186
  callback: () => {
@@ -11770,7 +11805,7 @@ var useMenuStructure = (closeMenu, readOnlyStudio) => {
11770
11805
  label: "Tools",
11771
11806
  leaveLeftPadding: false,
11772
11807
  items: [
11773
- process.env.ASK_AI_ENABLED ? {
11808
+ getStudioAskAIEnabled() ? {
11774
11809
  id: "ask-ai",
11775
11810
  value: "ask-ai",
11776
11811
  label: "Ask AI",
@@ -24792,11 +24827,12 @@ var Canvas = ({ canvasContent, size: size2 }) => {
24792
24827
  useEffect42(() => {
24793
24828
  fetchMetadata();
24794
24829
  }, [fetchMetadata]);
24795
- const updateElementInstallTarget = useCallback51(() => {
24830
+ const updateElementInstallTarget = useCallback51((requestId) => {
24796
24831
  if (previewServerClientId === null) {
24797
24832
  return;
24798
24833
  }
24799
24834
  callApi("/api/update-element-install-target", {
24835
+ requestId,
24800
24836
  clientId: previewServerClientId,
24801
24837
  compositionFile: canInstallElements ? compositionFile : null,
24802
24838
  compositionId: canInstallElements ? currentCompositionId : null,
@@ -24812,17 +24848,9 @@ var Canvas = ({ canvasContent, size: size2 }) => {
24812
24848
  currentCompositionId,
24813
24849
  previewServerClientId
24814
24850
  ]);
24815
- useEffect42(() => {
24816
- updateElementInstallTarget();
24817
- const interval = window.setInterval(updateElementInstallTarget, 2000);
24818
- return () => {
24819
- window.clearInterval(interval);
24820
- };
24821
- }, [updateElementInstallTarget]);
24822
24851
  useEffect42(() => {
24823
24852
  const markFocused = () => {
24824
24853
  lastFocusedAtRef.current = Date.now();
24825
- updateElementInstallTarget();
24826
24854
  };
24827
24855
  window.addEventListener("focus", markFocused);
24828
24856
  document.addEventListener("pointerdown", markFocused, { capture: true });
@@ -24830,7 +24858,15 @@ var Canvas = ({ canvasContent, size: size2 }) => {
24830
24858
  window.removeEventListener("focus", markFocused);
24831
24859
  document.removeEventListener("pointerdown", markFocused, { capture: true });
24832
24860
  };
24833
- }, [updateElementInstallTarget]);
24861
+ }, []);
24862
+ useEffect42(() => {
24863
+ return subscribeToEvent("request-element-install-target", (event) => {
24864
+ if (event.type !== "request-element-install-target") {
24865
+ return;
24866
+ }
24867
+ updateElementInstallTarget(event.requestId);
24868
+ });
24869
+ }, [subscribeToEvent, updateElementInstallTarget]);
24834
24870
  useEffect42(() => {
24835
24871
  if (installingElementName === null) {
24836
24872
  return;
@@ -47768,9 +47804,8 @@ import React207, { useCallback as useCallback166, useContext as useContext120, u
47768
47804
  import { Internals as Internals98 } from "remotion";
47769
47805
 
47770
47806
  // src/components/Timeline/MaxTimelineTracks.tsx
47771
- import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
47772
47807
  import { jsxs as jsxs128 } from "react/jsx-runtime";
47773
- var 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);
47808
+ var MAX_TIMELINE_TRACKS = getStudioMaxTimelineTracks();
47774
47809
  var MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
47775
47810
  var container39 = {
47776
47811
  height: MAX_TIMELINE_TRACKS_NOTICE_HEIGHT,
@@ -49787,7 +49822,7 @@ var TimelineSequenceItem = ({
49787
49822
  await saveName(name);
49788
49823
  }, [saveName]);
49789
49824
  React194.useEffect(() => {
49790
- if (!canRenameSelectedSequence || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
49825
+ if (!canRenameSelectedSequence || !getStudioKeyboardShortcutsEnabled()) {
49791
49826
  setIsRenaming(false);
49792
49827
  return;
49793
49828
  }
@@ -57060,7 +57095,7 @@ var KeyboardShortcutsExplainer = () => {
57060
57095
  })
57061
57096
  ]
57062
57097
  }),
57063
- process.env.ASK_AI_ENABLED && /* @__PURE__ */ jsxs164(Fragment57, {
57098
+ getStudioAskAIEnabled() && /* @__PURE__ */ jsxs164(Fragment57, {
57064
57099
  children: [
57065
57100
  /* @__PURE__ */ jsx304("br", {}),
57066
57101
  /* @__PURE__ */ jsx304("div", {
@@ -65639,7 +65674,7 @@ var Modals = ({ readOnlyStudio }) => {
65639
65674
  modalContextType && modalContextType.type === "confirmation-dialog" && /* @__PURE__ */ jsx360(ConfirmationDialog, {
65640
65675
  state: modalContextType
65641
65676
  }),
65642
- process.env.ASK_AI_ENABLED && /* @__PURE__ */ jsx360(AskAiModal, {})
65677
+ getStudioAskAIEnabled() && /* @__PURE__ */ jsx360(AskAiModal, {})
65643
65678
  ]
65644
65679
  });
65645
65680
  };
@@ -65727,8 +65762,7 @@ var background = {
65727
65762
  flexDirection: "column",
65728
65763
  position: "absolute"
65729
65764
  };
65730
- var DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
65731
- var 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);
65765
+ var BUFFER_STATE_DELAY_IN_MILLISECONDS = getStudioBufferStateDelayInMilliseconds();
65732
65766
  var Editor = ({ Root, readOnlyStudio }) => {
65733
65767
  const [drawElement, setDrawElement] = useState125(null);
65734
65768
  const size3 = PlayerInternals23.useElementSize(drawElement, {
@@ -447,19 +447,55 @@ var KeybindingContextProvider = ({ children }) => {
447
447
  });
448
448
  };
449
449
 
450
+ // src/helpers/studio-runtime-config.ts
451
+ import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
452
+ var DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
453
+ var defaultStudioRuntimeConfig = {
454
+ askAIEnabled: false,
455
+ bufferStateDelayInMilliseconds: null,
456
+ experimentalClientSideRenderingEnabled: false,
457
+ interactivityEnabled: true,
458
+ keyboardShortcutsEnabled: true,
459
+ maxTimelineTracks: null
460
+ };
461
+ var getStudioRuntimeConfig = () => {
462
+ if (typeof window === "undefined") {
463
+ return defaultStudioRuntimeConfig;
464
+ }
465
+ return window.remotion_studioConfig ?? defaultStudioRuntimeConfig;
466
+ };
467
+ var getStudioAskAIEnabled = () => {
468
+ return getStudioRuntimeConfig().askAIEnabled;
469
+ };
470
+ var getStudioInteractivityEnabled = () => {
471
+ return getStudioRuntimeConfig().interactivityEnabled;
472
+ };
473
+ var getStudioKeyboardShortcutsEnabled = () => {
474
+ return getStudioRuntimeConfig().keyboardShortcutsEnabled;
475
+ };
476
+ var getStudioExperimentalClientSideRenderingEnabled = () => {
477
+ return getStudioRuntimeConfig().experimentalClientSideRenderingEnabled;
478
+ };
479
+ var getStudioMaxTimelineTracks = () => {
480
+ return getStudioRuntimeConfig().maxTimelineTracks ?? DEFAULT_TIMELINE_TRACKS;
481
+ };
482
+ var getStudioBufferStateDelayInMilliseconds = () => {
483
+ return getStudioRuntimeConfig().bufferStateDelayInMilliseconds ?? DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS;
484
+ };
485
+
450
486
  // src/helpers/use-keybinding.ts
451
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
487
+ if (!getStudioKeyboardShortcutsEnabled()) {
452
488
  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.");
453
489
  }
454
490
  var areKeyboardShortcutsDisabled = () => {
455
- return !process.env.KEYBOARD_SHORTCUTS_ENABLED;
491
+ return !getStudioKeyboardShortcutsEnabled();
456
492
  };
457
493
  var useKeybinding = () => {
458
494
  const [paneId] = useState3(() => String(Math.random()));
459
495
  const context = useContext(KeybindingContext);
460
496
  const { isHighestContext } = useZIndex();
461
497
  const registerKeybinding = useCallback2((options) => {
462
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
498
+ if (!getStudioKeyboardShortcutsEnabled()) {
463
499
  return {
464
500
  unregister: () => {
465
501
  return;
@@ -2278,7 +2314,7 @@ var MenuContent = ({
2278
2314
  return containerStyles;
2279
2315
  }, [fixedHeight, isMobileLayout]);
2280
2316
  useEffect8(() => {
2281
- if (!keybindings.isHighestContext || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
2317
+ if (!keybindings.isHighestContext || !getStudioKeyboardShortcutsEnabled()) {
2282
2318
  return;
2283
2319
  }
2284
2320
  const onKeyDown = (event) => {
@@ -4168,7 +4204,7 @@ var pickColor = () => {
4168
4204
  };
4169
4205
 
4170
4206
  // src/helpers/show-browser-rendering.ts
4171
- var SHOW_BROWSER_RENDERING = Boolean(process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED);
4207
+ var SHOW_BROWSER_RENDERING = getStudioExperimentalClientSideRenderingEnabled();
4172
4208
 
4173
4209
  // src/helpers/use-menu-structure.tsx
4174
4210
  import { jsx as jsx29 } from "react/jsx-runtime";
@@ -4812,7 +4848,7 @@ var useMenuStructure = (closeMenu, readOnlyStudio) => {
4812
4848
  label: "Tools",
4813
4849
  leaveLeftPadding: false,
4814
4850
  items: [
4815
- process.env.ASK_AI_ENABLED ? {
4851
+ getStudioAskAIEnabled() ? {
4816
4852
  id: "ask-ai",
4817
4853
  value: "ask-ai",
4818
4854
  label: "Ask AI",
@@ -8591,8 +8627,7 @@ import {
8591
8627
  } from "remotion";
8592
8628
 
8593
8629
  // src/helpers/interactivity-enabled.ts
8594
- var interactivityEnabled = process.env.INTERACTIVITY_ENABLED;
8595
- var studioInteractivityEnabled = interactivityEnabled === undefined || interactivityEnabled === null ? true : interactivityEnabled !== false && interactivityEnabled !== "false";
8630
+ var studioInteractivityEnabled = getStudioInteractivityEnabled();
8596
8631
 
8597
8632
  // src/helpers/timeline-node-path-key.ts
8598
8633
  import { stringifySequenceExpandedRowKey } from "@remotion/studio-shared";
@@ -23117,11 +23152,12 @@ var Canvas = ({ canvasContent, size: size2 }) => {
23117
23152
  useEffect40(() => {
23118
23153
  fetchMetadata();
23119
23154
  }, [fetchMetadata]);
23120
- const updateElementInstallTarget = useCallback43(() => {
23155
+ const updateElementInstallTarget = useCallback43((requestId) => {
23121
23156
  if (previewServerClientId === null) {
23122
23157
  return;
23123
23158
  }
23124
23159
  callApi("/api/update-element-install-target", {
23160
+ requestId,
23125
23161
  clientId: previewServerClientId,
23126
23162
  compositionFile: canInstallElements ? compositionFile : null,
23127
23163
  compositionId: canInstallElements ? currentCompositionId : null,
@@ -23137,17 +23173,9 @@ var Canvas = ({ canvasContent, size: size2 }) => {
23137
23173
  currentCompositionId,
23138
23174
  previewServerClientId
23139
23175
  ]);
23140
- useEffect40(() => {
23141
- updateElementInstallTarget();
23142
- const interval = window.setInterval(updateElementInstallTarget, 2000);
23143
- return () => {
23144
- window.clearInterval(interval);
23145
- };
23146
- }, [updateElementInstallTarget]);
23147
23176
  useEffect40(() => {
23148
23177
  const markFocused = () => {
23149
23178
  lastFocusedAtRef.current = Date.now();
23150
- updateElementInstallTarget();
23151
23179
  };
23152
23180
  window.addEventListener("focus", markFocused);
23153
23181
  document.addEventListener("pointerdown", markFocused, { capture: true });
@@ -23155,7 +23183,15 @@ var Canvas = ({ canvasContent, size: size2 }) => {
23155
23183
  window.removeEventListener("focus", markFocused);
23156
23184
  document.removeEventListener("pointerdown", markFocused, { capture: true });
23157
23185
  };
23158
- }, [updateElementInstallTarget]);
23186
+ }, []);
23187
+ useEffect40(() => {
23188
+ return subscribeToEvent("request-element-install-target", (event) => {
23189
+ if (event.type !== "request-element-install-target") {
23190
+ return;
23191
+ }
23192
+ updateElementInstallTarget(event.requestId);
23193
+ });
23194
+ }, [subscribeToEvent, updateElementInstallTarget]);
23159
23195
  useEffect40(() => {
23160
23196
  if (installingElementName === null) {
23161
23197
  return;
@@ -48286,7 +48322,7 @@ var GlobalKeybindings = ({ readOnlyStudio }) => {
48286
48322
  commandCtrlKey: true,
48287
48323
  preventDefault: true
48288
48324
  });
48289
- const cmdIKey = process.env.ASK_AI_ENABLED ? keybindings.registerKeybinding({
48325
+ const cmdIKey = getStudioAskAIEnabled() ? keybindings.registerKeybinding({
48290
48326
  event: "keydown",
48291
48327
  key: "i",
48292
48328
  callback: () => {
@@ -48384,9 +48420,8 @@ import React208, { useCallback as useCallback166, useContext as useContext120, u
48384
48420
  import { Internals as Internals98 } from "remotion";
48385
48421
 
48386
48422
  // src/components/Timeline/MaxTimelineTracks.tsx
48387
- import { DEFAULT_TIMELINE_TRACKS } from "@remotion/studio-shared";
48388
48423
  import { jsxs as jsxs129 } from "react/jsx-runtime";
48389
- var 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);
48424
+ var MAX_TIMELINE_TRACKS = getStudioMaxTimelineTracks();
48390
48425
  var MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
48391
48426
  var container40 = {
48392
48427
  height: MAX_TIMELINE_TRACKS_NOTICE_HEIGHT,
@@ -50403,7 +50438,7 @@ var TimelineSequenceItem = ({
50403
50438
  await saveName(name);
50404
50439
  }, [saveName]);
50405
50440
  React195.useEffect(() => {
50406
- if (!canRenameSelectedSequence || !process.env.KEYBOARD_SHORTCUTS_ENABLED) {
50441
+ if (!canRenameSelectedSequence || !getStudioKeyboardShortcutsEnabled()) {
50407
50442
  setIsRenaming(false);
50408
50443
  return;
50409
50444
  }
@@ -57676,7 +57711,7 @@ var KeyboardShortcutsExplainer = () => {
57676
57711
  })
57677
57712
  ]
57678
57713
  }),
57679
- process.env.ASK_AI_ENABLED && /* @__PURE__ */ jsxs165(Fragment57, {
57714
+ getStudioAskAIEnabled() && /* @__PURE__ */ jsxs165(Fragment57, {
57680
57715
  children: [
57681
57716
  /* @__PURE__ */ jsx306("br", {}),
57682
57717
  /* @__PURE__ */ jsx306("div", {
@@ -66255,7 +66290,7 @@ var Modals = ({ readOnlyStudio }) => {
66255
66290
  modalContextType && modalContextType.type === "confirmation-dialog" && /* @__PURE__ */ jsx362(ConfirmationDialog, {
66256
66291
  state: modalContextType
66257
66292
  }),
66258
- process.env.ASK_AI_ENABLED && /* @__PURE__ */ jsx362(AskAiModal, {})
66293
+ getStudioAskAIEnabled() && /* @__PURE__ */ jsx362(AskAiModal, {})
66259
66294
  ]
66260
66295
  });
66261
66296
  };
@@ -66343,8 +66378,7 @@ var background = {
66343
66378
  flexDirection: "column",
66344
66379
  position: "absolute"
66345
66380
  };
66346
- var DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
66347
- var 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);
66381
+ var BUFFER_STATE_DELAY_IN_MILLISECONDS = getStudioBufferStateDelayInMilliseconds();
66348
66382
  var Editor = ({ Root, readOnlyStudio }) => {
66349
66383
  const [drawElement, setDrawElement] = useState126(null);
66350
66384
  const size3 = PlayerInternals23.useElementSize(drawElement, {
@@ -212,7 +212,7 @@ var renderContent = (Root) => {
212
212
  renderToDOM(/* @__PURE__ */ jsx("div", {
213
213
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
214
214
  }));
215
- import("./chunk-nn36hyt1.js").then(({ StudioInternals }) => {
215
+ import("./chunk-jrta3xaf.js").then(({ StudioInternals }) => {
216
216
  window.remotion_isStudio = true;
217
217
  window.remotion_isReadOnlyStudio = true;
218
218
  window.remotion_inputProps = "{}";
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.studioInteractivityEnabled = void 0;
4
- const interactivityEnabled = process.env.INTERACTIVITY_ENABLED;
5
- exports.studioInteractivityEnabled = interactivityEnabled === undefined || interactivityEnabled === null
6
- ? true
7
- : interactivityEnabled !== false && interactivityEnabled !== 'false';
4
+ const studio_runtime_config_1 = require("./studio-runtime-config");
5
+ exports.studioInteractivityEnabled = (0, studio_runtime_config_1.getStudioInteractivityEnabled)();
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SHOW_BROWSER_RENDERING = void 0;
4
- exports.SHOW_BROWSER_RENDERING = Boolean(process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED);
4
+ const studio_runtime_config_1 = require("./studio-runtime-config");
5
+ exports.SHOW_BROWSER_RENDERING = (0, studio_runtime_config_1.getStudioExperimentalClientSideRenderingEnabled)();
@@ -0,0 +1,7 @@
1
+ export declare const DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
2
+ export declare const getStudioAskAIEnabled: () => boolean;
3
+ export declare const getStudioInteractivityEnabled: () => boolean;
4
+ export declare const getStudioKeyboardShortcutsEnabled: () => boolean;
5
+ export declare const getStudioExperimentalClientSideRenderingEnabled: () => boolean;
6
+ export declare const getStudioMaxTimelineTracks: () => number;
7
+ export declare const getStudioBufferStateDelayInMilliseconds: () => number;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStudioBufferStateDelayInMilliseconds = exports.getStudioMaxTimelineTracks = exports.getStudioExperimentalClientSideRenderingEnabled = exports.getStudioKeyboardShortcutsEnabled = exports.getStudioInteractivityEnabled = exports.getStudioAskAIEnabled = exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS = 300;
6
+ const defaultStudioRuntimeConfig = {
7
+ askAIEnabled: false,
8
+ bufferStateDelayInMilliseconds: null,
9
+ experimentalClientSideRenderingEnabled: false,
10
+ interactivityEnabled: true,
11
+ keyboardShortcutsEnabled: true,
12
+ maxTimelineTracks: null,
13
+ };
14
+ const getStudioRuntimeConfig = () => {
15
+ var _a;
16
+ if (typeof window === 'undefined') {
17
+ return defaultStudioRuntimeConfig;
18
+ }
19
+ return (_a = window.remotion_studioConfig) !== null && _a !== void 0 ? _a : defaultStudioRuntimeConfig;
20
+ };
21
+ const getStudioAskAIEnabled = () => {
22
+ return getStudioRuntimeConfig().askAIEnabled;
23
+ };
24
+ exports.getStudioAskAIEnabled = getStudioAskAIEnabled;
25
+ const getStudioInteractivityEnabled = () => {
26
+ return getStudioRuntimeConfig().interactivityEnabled;
27
+ };
28
+ exports.getStudioInteractivityEnabled = getStudioInteractivityEnabled;
29
+ const getStudioKeyboardShortcutsEnabled = () => {
30
+ return getStudioRuntimeConfig().keyboardShortcutsEnabled;
31
+ };
32
+ exports.getStudioKeyboardShortcutsEnabled = getStudioKeyboardShortcutsEnabled;
33
+ const getStudioExperimentalClientSideRenderingEnabled = () => {
34
+ return getStudioRuntimeConfig().experimentalClientSideRenderingEnabled;
35
+ };
36
+ exports.getStudioExperimentalClientSideRenderingEnabled = getStudioExperimentalClientSideRenderingEnabled;
37
+ const getStudioMaxTimelineTracks = () => {
38
+ var _a;
39
+ return (_a = getStudioRuntimeConfig().maxTimelineTracks) !== null && _a !== void 0 ? _a : studio_shared_1.DEFAULT_TIMELINE_TRACKS;
40
+ };
41
+ exports.getStudioMaxTimelineTracks = getStudioMaxTimelineTracks;
42
+ const getStudioBufferStateDelayInMilliseconds = () => {
43
+ var _a;
44
+ return ((_a = getStudioRuntimeConfig().bufferStateDelayInMilliseconds) !== null && _a !== void 0 ? _a : exports.DEFAULT_BUFFER_STATE_DELAY_IN_MILLISECONDS);
45
+ };
46
+ exports.getStudioBufferStateDelayInMilliseconds = getStudioBufferStateDelayInMilliseconds;
@@ -4,12 +4,13 @@ exports.useKeybinding = exports.areKeyboardShortcutsDisabled = void 0;
4
4
  const react_1 = require("react");
5
5
  const keybindings_1 = require("../state/keybindings");
6
6
  const z_index_1 = require("../state/z-index");
7
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
7
+ const studio_runtime_config_1 = require("./studio-runtime-config");
8
+ if (!(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
8
9
  // eslint-disable-next-line no-console
9
10
  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.');
10
11
  }
11
12
  const areKeyboardShortcutsDisabled = () => {
12
- return !process.env.KEYBOARD_SHORTCUTS_ENABLED;
13
+ return !(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)();
13
14
  };
14
15
  exports.areKeyboardShortcutsDisabled = areKeyboardShortcutsDisabled;
15
16
  const useKeybinding = () => {
@@ -17,7 +18,7 @@ const useKeybinding = () => {
17
18
  const context = (0, react_1.useContext)(keybindings_1.KeybindingContext);
18
19
  const { isHighestContext } = (0, z_index_1.useZIndex)();
19
20
  const registerKeybinding = (0, react_1.useCallback)((options) => {
20
- if (!process.env.KEYBOARD_SHORTCUTS_ENABLED) {
21
+ if (!(0, studio_runtime_config_1.getStudioKeyboardShortcutsEnabled)()) {
21
22
  return {
22
23
  unregister: () => undefined,
23
24
  };
@@ -32,6 +32,7 @@ const mobile_layout_1 = require("./mobile-layout");
32
32
  const open_in_editor_1 = require("./open-in-editor");
33
33
  const pick_color_1 = require("./pick-color");
34
34
  const show_browser_rendering_1 = require("./show-browser-rendering");
35
+ const studio_runtime_config_1 = require("./studio-runtime-config");
35
36
  const use_keybinding_1 = require("./use-keybinding");
36
37
  const openExternal = (link) => {
37
38
  window.open(link, '_blank');
@@ -682,7 +683,7 @@ const useMenuStructure = (closeMenu, readOnlyStudio) => {
682
683
  label: 'Tools',
683
684
  leaveLeftPadding: false,
684
685
  items: [
685
- process.env.ASK_AI_ENABLED
686
+ (0, studio_runtime_config_1.getStudioAskAIEnabled)()
686
687
  ? {
687
688
  id: 'ask-ai',
688
689
  value: 'ask-ai',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
4
4
  },
5
5
  "name": "@remotion/studio",
6
- "version": "4.0.488",
6
+ "version": "4.0.489",
7
7
  "description": "APIs for interacting with the Remotion Studio",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -25,15 +25,15 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "semver": "7.5.3",
28
- "remotion": "4.0.488",
29
- "@remotion/canvas-capture": "4.0.488",
30
- "@remotion/player": "4.0.488",
31
- "@remotion/media-utils": "4.0.488",
32
- "@remotion/renderer": "4.0.488",
33
- "@remotion/web-renderer": "4.0.488",
34
- "@remotion/studio-shared": "4.0.488",
35
- "@remotion/timeline-utils": "4.0.488",
36
- "@remotion/zod-types": "4.0.488",
28
+ "remotion": "4.0.489",
29
+ "@remotion/canvas-capture": "4.0.489",
30
+ "@remotion/player": "4.0.489",
31
+ "@remotion/media-utils": "4.0.489",
32
+ "@remotion/renderer": "4.0.489",
33
+ "@remotion/web-renderer": "4.0.489",
34
+ "@remotion/studio-shared": "4.0.489",
35
+ "@remotion/timeline-utils": "4.0.489",
36
+ "@remotion/zod-types": "4.0.489",
37
37
  "@jridgewell/trace-mapping": "0.3.31",
38
38
  "mediabunny": "1.50.8",
39
39
  "memfs": "3.4.3",
@@ -44,7 +44,7 @@
44
44
  "react": "19.2.3",
45
45
  "react-dom": "19.2.3",
46
46
  "@types/semver": "7.5.3",
47
- "@remotion/eslint-config-internal": "4.0.488",
47
+ "@remotion/eslint-config-internal": "4.0.489",
48
48
  "eslint": "9.19.0",
49
49
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
50
50
  },