@remotion/three 4.0.85 → 4.0.87

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.
@@ -50,11 +50,15 @@ const useInnerVideoTexture = ({ playbackRate, src, transparent, }) => {
50
50
  const fetchTexture = (0, react_1.useCallback)(() => {
51
51
  const imageTextureHandle = (0, remotion_1.delayRender)('fetch offthread video frame');
52
52
  let textureLoaded = null;
53
+ let cleanedUp = false;
53
54
  textLoaderPromise.then((loader) => {
54
55
  new loader.TextureLoader()
55
56
  .loadAsync(offthreadVideoFrameSrc)
56
57
  .then((texture) => {
57
58
  textureLoaded = texture;
59
+ if (cleanedUp) {
60
+ return;
61
+ }
58
62
  setImageTexture(texture);
59
63
  (0, remotion_1.continueRender)(imageTextureHandle);
60
64
  })
@@ -63,12 +67,16 @@ const useInnerVideoTexture = ({ playbackRate, src, transparent, }) => {
63
67
  });
64
68
  });
65
69
  return () => {
70
+ cleanedUp = true;
66
71
  textureLoaded === null || textureLoaded === void 0 ? void 0 : textureLoaded.dispose();
67
72
  (0, remotion_1.continueRender)(imageTextureHandle);
68
73
  };
69
74
  }, [offthreadVideoFrameSrc, textLoaderPromise]);
70
75
  (0, react_1.useLayoutEffect)(() => {
71
- fetchTexture();
76
+ const cleanup = fetchTexture();
77
+ return () => {
78
+ cleanup();
79
+ };
72
80
  }, [offthreadVideoFrameSrc, fetchTexture]);
73
81
  return imageTexture;
74
82
  };
@@ -78,11 +78,15 @@ const useInnerVideoTexture = ({ playbackRate, src, transparent, }) => {
78
78
  const fetchTexture = useCallback(() => {
79
79
  const imageTextureHandle = delayRender('fetch offthread video frame');
80
80
  let textureLoaded = null;
81
+ let cleanedUp = false;
81
82
  textLoaderPromise.then((loader) => {
82
83
  new loader.TextureLoader()
83
84
  .loadAsync(offthreadVideoFrameSrc)
84
85
  .then((texture) => {
85
86
  textureLoaded = texture;
87
+ if (cleanedUp) {
88
+ return;
89
+ }
86
90
  setImageTexture(texture);
87
91
  continueRender(imageTextureHandle);
88
92
  })
@@ -91,12 +95,16 @@ const useInnerVideoTexture = ({ playbackRate, src, transparent, }) => {
91
95
  });
92
96
  });
93
97
  return () => {
98
+ cleanedUp = true;
94
99
  textureLoaded === null || textureLoaded === void 0 ? void 0 : textureLoaded.dispose();
95
100
  continueRender(imageTextureHandle);
96
101
  };
97
102
  }, [offthreadVideoFrameSrc, textLoaderPromise]);
98
103
  useLayoutEffect(() => {
99
- fetchTexture();
104
+ const cleanup = fetchTexture();
105
+ return () => {
106
+ cleanup();
107
+ };
100
108
  }, [offthreadVideoFrameSrc, fetchTexture]);
101
109
  return imageTexture;
102
110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/three",
3
- "version": "4.0.85",
3
+ "version": "4.0.87",
4
4
  "description": "Utility functions for using react-three-fiber with remotion",
5
5
  "main": "dist/cjs/index.js",
6
6
  "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.85"
19
+ "remotion": "4.0.87"
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.85"
26
+ "remotion": "4.0.87"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@jonny/eslint-config": "3.0.276",
@@ -41,7 +41,7 @@
41
41
  "react-dom": "18.2.0",
42
42
  "rollup": "^2.70.1",
43
43
  "three": "0.158.0",
44
- "remotion": "4.0.85"
44
+ "remotion": "4.0.87"
45
45
  },
46
46
  "keywords": [
47
47
  "remotion",