remotion 4.0.340 → 4.0.342

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.
@@ -14,6 +14,7 @@ const seek_js_1 = require("./seek.js");
14
14
  const timeline_position_state_js_1 = require("./timeline-position-state.js");
15
15
  const use_current_frame_js_1 = require("./use-current-frame.js");
16
16
  const use_media_buffering_js_1 = require("./use-media-buffering.js");
17
+ const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
17
18
  const use_request_video_callback_time_js_1 = require("./use-request-video-callback-time.js");
18
19
  const use_video_config_js_1 = require("./use-video-config.js");
19
20
  const get_current_time_js_1 = require("./video/get-current-time.js");
@@ -128,6 +129,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
128
129
  playing,
129
130
  isPostmounting,
130
131
  ]);
132
+ const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
131
133
  // This must be a useLayoutEffect, because afterwards, useVolume() looks at the playbackRate
132
134
  // and it is also in a useLayoutEffect.
133
135
  (0, react_1.useLayoutEffect)(() => {
@@ -186,6 +188,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
186
188
  logLevel,
187
189
  mountTime,
188
190
  reason: 'player is playing but media tag is paused, and just seeked',
191
+ isPlayer: env.isPlayer,
189
192
  });
190
193
  }
191
194
  }
@@ -241,6 +244,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
241
244
  logLevel,
242
245
  mountTime,
243
246
  reason: `player is playing and ${reason}`,
247
+ isPlayer: env.isPlayer,
244
248
  });
245
249
  if (!isVariableFpsVideo && playbackRate > 0) {
246
250
  bufferUntilFirstFrame(shouldBeTime);
@@ -268,6 +272,7 @@ const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybac
268
272
  pauseWhenBuffering,
269
273
  mountTime,
270
274
  mediaTagCurrentTime,
275
+ env.isPlayer,
271
276
  ]);
272
277
  };
273
278
  exports.useMediaPlayback = useMediaPlayback;
@@ -0,0 +1,6 @@
1
+ import { type RemotionEnvironment } from './get-remotion-environment';
2
+ /**
3
+ * @description A React hook that provides information about the current Remotion Environment. This is the preferred way to access environment information in React components as it will support future scoped contexts.
4
+ * @see [Documentation](https://remotion.dev/docs/use-remotion-environment)
5
+ */
6
+ export declare const useRemotionEnvironment: () => RemotionEnvironment;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useRemotionEnvironment = void 0;
4
+ const react_1 = require("react");
5
+ const get_remotion_environment_1 = require("./get-remotion-environment");
6
+ /**
7
+ * @description A React hook that provides information about the current Remotion Environment. This is the preferred way to access environment information in React components as it will support future scoped contexts.
8
+ * @see [Documentation](https://remotion.dev/docs/use-remotion-environment)
9
+ */
10
+ const useRemotionEnvironment = () => {
11
+ const [env] = (0, react_1.useState)(() => (0, get_remotion_environment_1.getRemotionEnvironment)());
12
+ return env;
13
+ };
14
+ exports.useRemotionEnvironment = useRemotionEnvironment;
@@ -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.340";
6
+ export declare const VERSION = "4.0.342";
@@ -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.340';
10
+ exports.VERSION = '4.0.342';
@@ -4,7 +4,7 @@ exports.OffthreadVideo = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const Sequence_js_1 = require("../Sequence.js");
7
- const get_remotion_environment_js_1 = require("../get-remotion-environment.js");
7
+ const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
8
8
  const validate_media_props_js_1 = require("../validate-media-props.js");
9
9
  const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
10
10
  const OffthreadVideoForRendering_js_1 = require("./OffthreadVideoForRendering.js");
@@ -17,7 +17,7 @@ const OffthreadVideo = (props) => {
17
17
  // Should only destruct `startFrom` and `endAt` from props,
18
18
  // rest gets drilled down
19
19
  const { startFrom, endAt, trimBefore, trimAfter, name, pauseWhenBuffering, stack, showInTimeline, ...otherProps } = props;
20
- const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
20
+ const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
21
21
  const onDuration = (0, react_1.useCallback)(() => undefined, []);
22
22
  if (typeof props.src !== 'string') {
23
23
  throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -8,9 +8,9 @@ const Sequence_js_1 = require("../Sequence.js");
8
8
  const absolute_src_js_1 = require("../absolute-src.js");
9
9
  const calculate_loop_js_1 = require("../calculate-loop.js");
10
10
  const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
11
- const get_remotion_environment_js_1 = require("../get-remotion-environment.js");
12
11
  const index_js_1 = require("../loop/index.js");
13
12
  const prefetch_js_1 = require("../prefetch.js");
13
+ const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
14
14
  const use_video_config_js_1 = require("../use-video-config.js");
15
15
  const validate_media_props_js_1 = require("../validate-media-props.js");
16
16
  const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
@@ -22,7 +22,7 @@ const VideoForwardingFunction = (props, ref) => {
22
22
  const { startFrom, endAt, trimBefore, trimAfter, name, pauseWhenBuffering, stack, _remotionInternalNativeLoopPassed, showInTimeline, onAutoPlayError, ...otherProps } = props;
23
23
  const { loop, ...propsOtherThanLoop } = props;
24
24
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
25
- const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
25
+ const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
26
26
  const { durations, setDurations } = (0, react_1.useContext)(duration_state_js_1.DurationsContext);
27
27
  if (typeof ref === 'string') {
28
28
  throw new Error('string refs are not supported');
@@ -8,12 +8,12 @@ const SequenceContext_js_1 = require("../SequenceContext.js");
8
8
  const absolute_src_js_1 = require("../absolute-src.js");
9
9
  const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
10
10
  const delay_render_js_1 = require("../delay-render.js");
11
- const get_remotion_environment_js_1 = require("../get-remotion-environment.js");
12
11
  const is_approximately_the_same_js_1 = require("../is-approximately-the-same.js");
13
12
  const log_level_context_js_1 = require("../log-level-context.js");
14
13
  const random_js_1 = require("../random.js");
15
14
  const timeline_position_state_js_1 = require("../timeline-position-state.js");
16
15
  const use_current_frame_js_1 = require("../use-current-frame.js");
16
+ const use_remotion_environment_js_1 = require("../use-remotion-environment.js");
17
17
  const use_unsafe_video_config_js_1 = require("../use-unsafe-video-config.js");
18
18
  const volume_prop_js_1 = require("../volume-prop.js");
19
19
  const get_current_time_js_1 = require("./get-current-time.js");
@@ -26,7 +26,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
26
26
  const videoRef = (0, react_1.useRef)(null);
27
27
  const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
28
28
  const mediaStartsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
29
- const environment = (0, get_remotion_environment_js_1.getRemotionEnvironment)();
29
+ const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
30
30
  const logLevel = (0, log_level_context_js_1.useLogLevel)();
31
31
  const mountTime = (0, log_level_context_js_1.useMountTime)();
32
32
  const { registerRenderAsset, unregisterRenderAsset } = (0, react_1.useContext)(RenderAssetManager_js_1.RenderAssetManager);