remotion 4.0.107 → 4.0.108
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.
- package/dist/cjs/use-buffer-state.d.ts +5 -0
- package/dist/cjs/use-buffer-state.js +28 -0
- package/dist/cjs/use-buffer.d.ts +1 -1
- package/dist/cjs/use-buffer.js +12 -4
- package/dist/cjs/use-media-buffering.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBufferState = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const buffering_1 = require("./buffering");
|
|
6
|
+
const CanUseRemotionHooks_1 = require("./CanUseRemotionHooks");
|
|
7
|
+
const useBufferState = () => {
|
|
8
|
+
const canUseRemotionHooks = (0, react_1.useContext)(CanUseRemotionHooks_1.CanUseRemotionHooks);
|
|
9
|
+
if (!canUseRemotionHooks) {
|
|
10
|
+
if (typeof window !== 'undefined' && window.remotion_isPlayer) {
|
|
11
|
+
throw new Error(`useCurrentFrame can only be called inside a component that was passed to <Player>. See: https://www.remotion.dev/docs/player/examples`);
|
|
12
|
+
}
|
|
13
|
+
throw new Error(`useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`);
|
|
14
|
+
}
|
|
15
|
+
const buffer = (0, react_1.useContext)(buffering_1.BufferingContextReact);
|
|
16
|
+
if (!buffer) {
|
|
17
|
+
throw new Error('BufferingContextReact was unexpectedly not found. Most likely your Remotion versions are mismatching.');
|
|
18
|
+
}
|
|
19
|
+
return (0, react_1.useMemo)(() => ({
|
|
20
|
+
delayPlayback: () => {
|
|
21
|
+
const { unblock } = buffer.addBlock({
|
|
22
|
+
id: String(Math.random()),
|
|
23
|
+
});
|
|
24
|
+
return { unblock };
|
|
25
|
+
},
|
|
26
|
+
}), [buffer]);
|
|
27
|
+
};
|
|
28
|
+
exports.useBufferState = useBufferState;
|
package/dist/cjs/use-buffer.d.ts
CHANGED
package/dist/cjs/use-buffer.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useBufferState = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const buffering_1 = require("./buffering");
|
|
6
|
-
const
|
|
6
|
+
const CanUseRemotionHooks_1 = require("./CanUseRemotionHooks");
|
|
7
|
+
const useBufferState = () => {
|
|
8
|
+
const canUseRemotionHooks = (0, react_1.useContext)(CanUseRemotionHooks_1.CanUseRemotionHooks);
|
|
9
|
+
if (!canUseRemotionHooks) {
|
|
10
|
+
if (typeof window !== 'undefined' && window.remotion_isPlayer) {
|
|
11
|
+
throw new Error(`useCurrentFrame can only be called inside a component that was passed to <Player>. See: https://www.remotion.dev/docs/player/examples`);
|
|
12
|
+
}
|
|
13
|
+
throw new Error(`useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`);
|
|
14
|
+
}
|
|
7
15
|
const buffer = (0, react_1.useContext)(buffering_1.BufferingContextReact);
|
|
8
16
|
if (!buffer) {
|
|
9
|
-
throw new
|
|
17
|
+
throw new Error('BufferingContextReact was unexpectedly not found. Most likely your Remotion versions are mismatching.');
|
|
10
18
|
}
|
|
11
19
|
return (0, react_1.useMemo)(() => ({
|
|
12
20
|
delayPlayback: () => {
|
|
@@ -17,4 +25,4 @@ const useBuffer = () => {
|
|
|
17
25
|
},
|
|
18
26
|
}), [buffer]);
|
|
19
27
|
};
|
|
20
|
-
exports.
|
|
28
|
+
exports.useBufferState = useBufferState;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMediaBuffering = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const use_buffer_state_1 = require("./use-buffer-state");
|
|
6
6
|
const useMediaBuffering = (element, shouldBuffer) => {
|
|
7
|
-
const buffer = (0,
|
|
7
|
+
const buffer = (0, use_buffer_state_1.useBufferState)();
|
|
8
8
|
(0, react_1.useEffect)(() => {
|
|
9
9
|
let cleanup = () => undefined;
|
|
10
10
|
const { current } = element;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.108";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.mjs
CHANGED
package/dist/esm/version.mjs
CHANGED