@remotion/three 4.0.341 → 4.0.344

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.
@@ -25,14 +25,14 @@ const FiberFrameInvalidator = () => {
25
25
  }, [frame, invalidate]);
26
26
  return null;
27
27
  };
28
- const { isRendering } = (0, remotion_1.getRemotionEnvironment)();
29
- // https://r3f.docs.pmnd.rs/advanced/scaling-performance#on-demand-rendering
30
- const shouldUseFrameloopDemand = isRendering;
31
28
  /*
32
29
  * @description A wrapper for React Three Fiber's <Canvas /> which synchronizes with Remotion's useCurrentFrame().
33
30
  * @see [Documentation](https://www.remotion.dev/docs/three-canvas)
34
31
  */
35
32
  const ThreeCanvas = (props) => {
33
+ const { isRendering } = (0, remotion_1.useRemotionEnvironment)();
34
+ // https://r3f.docs.pmnd.rs/advanced/scaling-performance#on-demand-rendering
35
+ const shouldUseFrameloopDemand = isRendering;
36
36
  const { children, width, height, style, onCreated, ...rest } = props;
37
37
  const [waitForCreated] = (0, react_1.useState)(() => (0, remotion_1.delayRender)('Waiting for <ThreeCanvas/> to be created'));
38
38
  (0, validate_1.validateDimension)(width, 'width', 'of the <ThreeCanvas /> component');
@@ -109,9 +109,10 @@ function useOffthreadVideoTexture({ src, playbackRate = 1, transparent = false,
109
109
  if (!src) {
110
110
  throw new Error('src must be provided to useOffthreadVideoTexture');
111
111
  }
112
- const { isRendering } = (0, remotion_1.getRemotionEnvironment)();
112
+ const env = (0, remotion_1.useRemotionEnvironment)();
113
+ const { isRendering } = env;
113
114
  if (!isRendering) {
114
- throw new Error('useOffthreadVideoTexture() can only be used during rendering. Use getRemotionEnvironment().isRendering to render it conditionally.');
115
+ throw new Error('useOffthreadVideoTexture() can only be used during rendering. Use useRemotionEnvironment().isRendering to render it conditionally.');
115
116
  }
116
117
  return (0, exports.useInnerVideoTexture)({
117
118
  playbackRate,
@@ -29,8 +29,8 @@ import {
29
29
  Internals,
30
30
  continueRender as continueRender2,
31
31
  delayRender as delayRender2,
32
- getRemotionEnvironment,
33
- useCurrentFrame
32
+ useCurrentFrame,
33
+ useRemotionEnvironment
34
34
  } from "remotion";
35
35
 
36
36
  // src/SuspenseLoader.tsx
@@ -82,9 +82,9 @@ var FiberFrameInvalidator = () => {
82
82
  }, [frame, invalidate]);
83
83
  return null;
84
84
  };
85
- var { isRendering } = getRemotionEnvironment();
86
- var shouldUseFrameloopDemand = isRendering;
87
85
  var ThreeCanvas = (props) => {
86
+ const { isRendering } = useRemotionEnvironment();
87
+ const shouldUseFrameloopDemand = isRendering;
88
88
  const { children, width, height, style, onCreated, ...rest } = props;
89
89
  const [waitForCreated] = useState(() => delayRender2("Waiting for <ThreeCanvas/> to be created"));
90
90
  validateDimension(width, "width", "of the <ThreeCanvas /> component");
@@ -128,8 +128,8 @@ import {
128
128
  cancelRender,
129
129
  continueRender as continueRender3,
130
130
  delayRender as delayRender3,
131
- getRemotionEnvironment as getRemotionEnvironment2,
132
131
  useCurrentFrame as useCurrentFrame2,
132
+ useRemotionEnvironment as useRemotionEnvironment2,
133
133
  useVideoConfig
134
134
  } from "remotion";
135
135
  import { NoReactInternals as NoReactInternals2 } from "remotion/no-react";
@@ -210,9 +210,10 @@ function useOffthreadVideoTexture({
210
210
  if (!src) {
211
211
  throw new Error("src must be provided to useOffthreadVideoTexture");
212
212
  }
213
- const { isRendering: isRendering2 } = getRemotionEnvironment2();
214
- if (!isRendering2) {
215
- throw new Error("useOffthreadVideoTexture() can only be used during rendering. Use getRemotionEnvironment().isRendering to render it conditionally.");
213
+ const env = useRemotionEnvironment2();
214
+ const { isRendering } = env;
215
+ if (!isRendering) {
216
+ throw new Error("useOffthreadVideoTexture() can only be used during rendering. Use useRemotionEnvironment().isRendering to render it conditionally.");
216
217
  }
217
218
  return useInnerVideoTexture({
218
219
  playbackRate,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/three"
4
4
  },
5
5
  "name": "@remotion/three",
6
- "version": "4.0.341",
6
+ "version": "4.0.344",
7
7
  "description": "Include React Three Fiber components in a Remotion video",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -16,14 +16,14 @@
16
16
  "url": "https://github.com/remotion-dev/remotion/issues"
17
17
  },
18
18
  "dependencies": {
19
- "remotion": "4.0.341"
19
+ "remotion": "4.0.344"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@react-three/fiber": ">=8.0.0",
23
23
  "react": ">=16.8.0",
24
24
  "react-dom": ">=16.8.0",
25
25
  "three": ">=0.137.0",
26
- "remotion": "4.0.341"
26
+ "remotion": "4.0.344"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@react-three/fiber": "9.2.0",
@@ -34,8 +34,8 @@
34
34
  "react-dom": "19.0.0",
35
35
  "three": "0.178.0",
36
36
  "eslint": "9.19.0",
37
- "remotion": "4.0.341",
38
- "@remotion/eslint-config-internal": "4.0.341"
37
+ "@remotion/eslint-config-internal": "4.0.344",
38
+ "remotion": "4.0.344"
39
39
  },
40
40
  "keywords": [
41
41
  "remotion",