remotion 4.0.400 → 4.0.401

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.
@@ -5,7 +5,7 @@ export declare const RemotionRootContexts: React.FC<{
5
5
  readonly numberOfAudioTags: number;
6
6
  readonly logLevel: LogLevel;
7
7
  readonly audioLatencyHint: AudioContextLatencyCategory;
8
- readonly videoEnabled: boolean | null;
9
- readonly audioEnabled: boolean | null;
8
+ readonly videoEnabled: boolean;
9
+ readonly audioEnabled: boolean;
10
10
  readonly frameState: Record<string, number> | null;
11
11
  }>;
@@ -45,6 +45,6 @@ const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLate
45
45
  const logging = (0, react_1.useMemo)(() => {
46
46
  return { logLevel, mountTime: Date.now() };
47
47
  }, [logLevel]);
48
- return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.SetNonceContext.Provider, { value: setNonceContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: (0, jsx_runtime_1.jsx)(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, audioLatencyHint: audioLatencyHint, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(buffering_js_1.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
48
+ return ((0, jsx_runtime_1.jsx)(log_level_context_js_1.LogLevelContext.Provider, { value: logging, children: (0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(nonce_js_1.SetNonceContext.Provider, { value: setNonceContext, children: (0, jsx_runtime_1.jsx)(TimelineContext_js_1.TimelineContextProvider, { frameState: frameState, children: (0, jsx_runtime_1.jsx)(use_media_enabled_js_1.MediaEnabledProvider, { videoEnabled: videoEnabled, audioEnabled: audioEnabled, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManagerProvider, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, audioLatencyHint: audioLatencyHint, audioEnabled: audioEnabled, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: (0, jsx_runtime_1.jsx)(buffering_js_1.BufferingProvider, { children: children }) }) }) }) }) }) }) }) }) }) }));
49
49
  };
50
50
  exports.RemotionRootContexts = RemotionRootContexts;
@@ -82,10 +82,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
82
82
  props.muted,
83
83
  props.loop,
84
84
  ]);
85
- const context = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioContext);
86
- if (!context) {
87
- throw new Error('SharedAudioContext not found');
88
- }
89
85
  const { el: audioRef, mediaElementSourceNode } = (0, shared_audio_tags_js_1.useSharedAudio)({
90
86
  aud: propsToPass,
91
87
  audioId: id,
@@ -46,6 +46,7 @@ export declare const SharedAudioContextProvider: React.FC<{
46
46
  readonly numberOfAudioTags: number;
47
47
  readonly children: React.ReactNode;
48
48
  readonly audioLatencyHint: AudioContextLatencyCategory;
49
+ readonly audioEnabled: boolean;
49
50
  }>;
50
51
  export declare const useSharedAudio: ({ aud, audioId, premounting, postmounting, }: {
51
52
  aud: AudioHTMLAttributes<HTMLAudioElement>;
@@ -74,14 +74,18 @@ const didPropChange = (key, newProp, prevProp) => {
74
74
  return true;
75
75
  };
76
76
  exports.SharedAudioContext = (0, react_1.createContext)(null);
77
- const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
77
+ const SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, audioEnabled }) => {
78
78
  const audios = (0, react_1.useRef)([]);
79
79
  const [initialNumberOfAudioTags] = (0, react_1.useState)(numberOfAudioTags);
80
80
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
81
81
  throw new Error('The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.');
82
82
  }
83
83
  const logLevel = (0, log_level_context_js_1.useLogLevel)();
84
- const audioContext = (0, use_audio_context_js_1.useSingletonAudioContext)(logLevel, audioLatencyHint);
84
+ const audioContext = (0, use_audio_context_js_1.useSingletonAudioContext)({
85
+ logLevel,
86
+ latencyHint: audioLatencyHint,
87
+ audioEnabled,
88
+ });
85
89
  const refs = (0, react_1.useMemo)(() => {
86
90
  return new Array(numberOfAudioTags).fill(true).map(() => {
87
91
  const ref = (0, react_1.createRef)();
@@ -1,2 +1,6 @@
1
1
  import type { LogLevel } from '../log';
2
- export declare const useSingletonAudioContext: (logLevel: LogLevel, latencyHint: AudioContextLatencyCategory) => AudioContext | null;
2
+ export declare const useSingletonAudioContext: ({ logLevel, latencyHint, audioEnabled, }: {
3
+ logLevel: LogLevel;
4
+ latencyHint: AudioContextLatencyCategory;
5
+ audioEnabled: boolean;
6
+ }) => AudioContext | null;
@@ -15,12 +15,15 @@ const warnOnce = (logLevel) => {
15
15
  log_1.Log.warn({ logLevel, tag: null }, 'AudioContext is not supported in this browser');
16
16
  }
17
17
  };
18
- const useSingletonAudioContext = (logLevel, latencyHint) => {
18
+ const useSingletonAudioContext = ({ logLevel, latencyHint, audioEnabled, }) => {
19
19
  const env = (0, use_remotion_environment_1.useRemotionEnvironment)();
20
20
  const audioContext = (0, react_1.useMemo)(() => {
21
21
  if (env.isRendering) {
22
22
  return null;
23
23
  }
24
+ if (!audioEnabled) {
25
+ return null;
26
+ }
24
27
  if (typeof AudioContext === 'undefined') {
25
28
  warnOnce(logLevel);
26
29
  return null;
@@ -32,7 +35,7 @@ const useSingletonAudioContext = (logLevel, latencyHint) => {
32
35
  // we observe some issues that seem to go away when we set the sample rate to 48000 with Sony LinkBuds Bluetooth headphones.
33
36
  sampleRate: 48000,
34
37
  });
35
- }, [logLevel, latencyHint, env.isRendering]);
38
+ }, [logLevel, latencyHint, env.isRendering, audioEnabled]);
36
39
  return audioContext;
37
40
  };
38
41
  exports.useSingletonAudioContext = useSingletonAudioContext;
@@ -77,8 +77,8 @@ export declare const Internals: {
77
77
  readonly numberOfAudioTags: number;
78
78
  readonly logLevel: import("./log.js").LogLevel;
79
79
  readonly audioLatencyHint: AudioContextLatencyCategory;
80
- readonly videoEnabled: boolean | null;
81
- readonly audioEnabled: boolean | null;
80
+ readonly videoEnabled: boolean;
81
+ readonly audioEnabled: boolean;
82
82
  readonly frameState: Record<string, number> | null;
83
83
  }>;
84
84
  readonly CompositionManagerProvider: ({ children, onlyRenderComposition, currentCompositionMetadata, initialCompositions, initialCanvasContent, }: {
@@ -156,6 +156,7 @@ export declare const Internals: {
156
156
  readonly numberOfAudioTags: number;
157
157
  readonly children: React.ReactNode;
158
158
  readonly audioLatencyHint: AudioContextLatencyCategory;
159
+ readonly audioEnabled: boolean;
159
160
  }>;
160
161
  readonly invalidCompositionErrorMessage: string;
161
162
  readonly calculateMediaDuration: ({ trimAfter, mediaDurationInFrames, playbackRate, trimBefore, }: {
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.400";
6
+ export declare const VERSION = "4.0.401";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.400';
10
+ exports.VERSION = '4.0.401';
@@ -110,7 +110,7 @@ function truthy(value) {
110
110
  }
111
111
 
112
112
  // src/version.ts
113
- var VERSION = "4.0.400";
113
+ var VERSION = "4.0.401";
114
114
 
115
115
  // src/multiple-versions-warning.ts
116
116
  var checkMultipleRemotionVersions = () => {
@@ -3117,12 +3117,19 @@ var warnOnce = (logLevel) => {
3117
3117
  Log.warn({ logLevel, tag: null }, "AudioContext is not supported in this browser");
3118
3118
  }
3119
3119
  };
3120
- var useSingletonAudioContext = (logLevel, latencyHint) => {
3120
+ var useSingletonAudioContext = ({
3121
+ logLevel,
3122
+ latencyHint,
3123
+ audioEnabled
3124
+ }) => {
3121
3125
  const env = useRemotionEnvironment();
3122
3126
  const audioContext = useMemo14(() => {
3123
3127
  if (env.isRendering) {
3124
3128
  return null;
3125
3129
  }
3130
+ if (!audioEnabled) {
3131
+ return null;
3132
+ }
3126
3133
  if (typeof AudioContext === "undefined") {
3127
3134
  warnOnce(logLevel);
3128
3135
  return null;
@@ -3131,7 +3138,7 @@ var useSingletonAudioContext = (logLevel, latencyHint) => {
3131
3138
  latencyHint,
3132
3139
  sampleRate: 48000
3133
3140
  });
3134
- }, [logLevel, latencyHint, env.isRendering]);
3141
+ }, [logLevel, latencyHint, env.isRendering, audioEnabled]);
3135
3142
  return audioContext;
3136
3143
  };
3137
3144
 
@@ -3164,14 +3171,18 @@ var didPropChange = (key, newProp, prevProp) => {
3164
3171
  return true;
3165
3172
  };
3166
3173
  var SharedAudioContext = createContext16(null);
3167
- var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint }) => {
3174
+ var SharedAudioContextProvider = ({ children, numberOfAudioTags, audioLatencyHint, audioEnabled }) => {
3168
3175
  const audios = useRef6([]);
3169
3176
  const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
3170
3177
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
3171
3178
  throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
3172
3179
  }
3173
3180
  const logLevel = useLogLevel();
3174
- const audioContext = useSingletonAudioContext(logLevel, audioLatencyHint);
3181
+ const audioContext = useSingletonAudioContext({
3182
+ logLevel,
3183
+ latencyHint: audioLatencyHint,
3184
+ audioEnabled
3185
+ });
3175
3186
  const refs = useMemo15(() => {
3176
3187
  return new Array(numberOfAudioTags).fill(true).map(() => {
3177
3188
  const ref = createRef2();
@@ -4845,10 +4856,6 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
4845
4856
  props.muted,
4846
4857
  props.loop
4847
4858
  ]);
4848
- const context = useContext25(SharedAudioContext);
4849
- if (!context) {
4850
- throw new Error("SharedAudioContext not found");
4851
- }
4852
4859
  const { el: audioRef, mediaElementSourceNode } = useSharedAudio({
4853
4860
  aud: propsToPass,
4854
4861
  audioId: id,
@@ -6235,6 +6242,7 @@ var RemotionRootContexts = ({
6235
6242
  children: /* @__PURE__ */ jsx28(SharedAudioContextProvider, {
6236
6243
  numberOfAudioTags,
6237
6244
  audioLatencyHint,
6245
+ audioEnabled,
6238
6246
  children: /* @__PURE__ */ jsx28(DurationsContextProvider, {
6239
6247
  children: /* @__PURE__ */ jsx28(BufferingProvider, {
6240
6248
  children
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.400";
2
+ var VERSION = "4.0.401";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.400",
6
+ "version": "4.0.401",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "react-dom": "19.2.3",
35
35
  "webpack": "5.96.1",
36
36
  "zod": "3.22.3",
37
- "@remotion/eslint-config-internal": "4.0.400",
37
+ "@remotion/eslint-config-internal": "4.0.401",
38
38
  "eslint": "9.19.0"
39
39
  },
40
40
  "keywords": [