@remotion/player 4.0.321 → 4.0.323

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.
@@ -338,13 +338,12 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
338
338
  }, [config, layout, overflowVisible, scale]);
339
339
  const containerStyle = (0, react_1.useMemo)(() => {
340
340
  return (0, calculate_scale_js_1.calculateContainerStyle)({
341
- canvasSize,
342
341
  config,
343
342
  layout,
344
343
  scale,
345
344
  overflowVisible,
346
345
  });
347
- }, [canvasSize, config, layout, overflowVisible, scale]);
346
+ }, [config, layout, overflowVisible, scale]);
348
347
  const playerPause = player.pause;
349
348
  const playerDispatchError = player.emitter.dispatchError;
350
349
  const onError = (0, react_1.useCallback)((error) => {
@@ -93,13 +93,12 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
93
93
  }, [config, layout, overflowVisible, scale]);
94
94
  const containerStyle = (0, react_1.useMemo)(() => {
95
95
  return (0, calculate_scale_js_1.calculateContainerStyle)({
96
- canvasSize,
97
96
  config,
98
97
  layout,
99
98
  scale,
100
99
  overflowVisible,
101
100
  });
102
- }, [canvasSize, config, layout, overflowVisible, scale]);
101
+ }, [config, layout, overflowVisible, scale]);
103
102
  const onError = (0, react_1.useCallback)((error) => {
104
103
  // Pay attention to `this context`
105
104
  thumbnail.emitter.dispatchError(error);
@@ -20,9 +20,8 @@ export declare const calculateOuterStyle: ({ config, style, canvasSize, overflow
20
20
  overflowVisible: boolean;
21
21
  layout: Layout | null;
22
22
  }) => React.CSSProperties;
23
- export declare const calculateContainerStyle: ({ config, canvasSize, layout, scale, overflowVisible, }: {
23
+ export declare const calculateContainerStyle: ({ config, layout, scale, overflowVisible, }: {
24
24
  config: VideoConfig | null;
25
- canvasSize: Size | null;
26
25
  layout: Layout | null;
27
26
  scale: number;
28
27
  overflowVisible: boolean;
@@ -38,9 +37,18 @@ export declare const calculateOuter: ({ layout, scale, config, overflowVisible,
38
37
  readonly display?: undefined;
39
38
  readonly flexDirection?: undefined;
40
39
  readonly position?: undefined;
40
+ readonly overflow?: undefined;
41
+ readonly left?: undefined;
42
+ readonly top?: undefined;
43
+ } | {
44
+ readonly width: number;
45
+ readonly height: number;
46
+ readonly display: "flex";
47
+ readonly flexDirection: "column";
48
+ readonly position: "absolute";
49
+ readonly overflow: "hidden" | "visible";
41
50
  readonly left?: undefined;
42
51
  readonly top?: undefined;
43
- readonly overflow?: undefined;
44
52
  } | {
45
53
  readonly width: number;
46
54
  readonly height: number;
@@ -45,10 +45,20 @@ const calculateOuterStyle = ({ config, style, canvasSize, overflowVisible, layou
45
45
  };
46
46
  };
47
47
  exports.calculateOuterStyle = calculateOuterStyle;
48
- const calculateContainerStyle = ({ config, canvasSize, layout, scale, overflowVisible, }) => {
49
- if (!config || !canvasSize || !layout) {
48
+ const calculateContainerStyle = ({ config, layout, scale, overflowVisible, }) => {
49
+ if (!config) {
50
50
  return {};
51
51
  }
52
+ if (!layout) {
53
+ return {
54
+ position: 'absolute',
55
+ width: config.width,
56
+ height: config.height,
57
+ display: 'flex',
58
+ transform: `scale(${scale})`,
59
+ overflow: overflowVisible ? 'visible' : 'hidden',
60
+ };
61
+ }
52
62
  return {
53
63
  position: 'absolute',
54
64
  width: config.width,
@@ -62,9 +72,19 @@ const calculateContainerStyle = ({ config, canvasSize, layout, scale, overflowVi
62
72
  };
63
73
  exports.calculateContainerStyle = calculateContainerStyle;
64
74
  const calculateOuter = ({ layout, scale, config, overflowVisible, }) => {
65
- if (!layout || !config) {
75
+ if (!config) {
66
76
  return {};
67
77
  }
78
+ if (!layout) {
79
+ return {
80
+ width: config.width * scale,
81
+ height: config.height * scale,
82
+ display: 'flex',
83
+ flexDirection: 'column',
84
+ position: 'absolute',
85
+ overflow: overflowVisible ? 'visible' : 'hidden',
86
+ };
87
+ }
68
88
  const { centerX, centerY } = layout;
69
89
  return {
70
90
  width: config.width * scale,
@@ -15,5 +15,5 @@ export declare class ErrorBoundary extends React.Component<{
15
15
  hasError: Error;
16
16
  };
17
17
  componentDidCatch(error: Error): void;
18
- render(): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
18
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
19
19
  }
@@ -4,7 +4,6 @@ exports.usePlayer = void 0;
4
4
  const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const emitter_context_js_1 = require("./emitter-context.js");
7
- const use_frame_imperative_js_1 = require("./use-frame-imperative.js");
8
7
  const usePlayer = () => {
9
8
  var _a;
10
9
  const [playing, setPlaying, imperativePlaying] = remotion_1.Internals.Timeline.usePlayingState();
@@ -136,7 +135,6 @@ const usePlayer = () => {
136
135
  };
137
136
  });
138
137
  }, [videoId, imperativePlaying, lastFrame, setFrame]);
139
- const getCurrentFrame = (0, use_frame_imperative_js_1.useFrameImperative)();
140
138
  const toggle = (0, react_1.useCallback)((e) => {
141
139
  if (imperativePlaying.current) {
142
140
  pause();
@@ -156,12 +154,11 @@ const usePlayer = () => {
156
154
  pause,
157
155
  seek,
158
156
  isFirstFrame,
159
- getCurrentFrame,
157
+ getCurrentFrame: () => frameRef.current,
160
158
  isPlaying: () => imperativePlaying.current,
161
159
  isBuffering: () => buffering.current,
162
160
  pauseAndReturnToPlayStart,
163
161
  hasPlayed,
164
- remotionInternal_currentFrameRef: frameRef,
165
162
  toggle,
166
163
  };
167
164
  }, [
@@ -169,7 +166,6 @@ const usePlayer = () => {
169
166
  emitter,
170
167
  frameBack,
171
168
  frameForward,
172
- getCurrentFrame,
173
169
  hasPlayed,
174
170
  imperativePlaying,
175
171
  isFirstFrame,
@@ -269,14 +269,23 @@ var calculateOuterStyle = ({
269
269
  };
270
270
  var calculateContainerStyle = ({
271
271
  config,
272
- canvasSize,
273
272
  layout,
274
273
  scale,
275
274
  overflowVisible
276
275
  }) => {
277
- if (!config || !canvasSize || !layout) {
276
+ if (!config) {
278
277
  return {};
279
278
  }
279
+ if (!layout) {
280
+ return {
281
+ position: "absolute",
282
+ width: config.width,
283
+ height: config.height,
284
+ display: "flex",
285
+ transform: `scale(${scale})`,
286
+ overflow: overflowVisible ? "visible" : "hidden"
287
+ };
288
+ }
280
289
  return {
281
290
  position: "absolute",
282
291
  width: config.width,
@@ -294,9 +303,19 @@ var calculateOuter = ({
294
303
  config,
295
304
  overflowVisible
296
305
  }) => {
297
- if (!layout || !config) {
306
+ if (!config) {
298
307
  return {};
299
308
  }
309
+ if (!layout) {
310
+ return {
311
+ width: config.width * scale,
312
+ height: config.height * scale,
313
+ display: "flex",
314
+ flexDirection: "column",
315
+ position: "absolute",
316
+ overflow: overflowVisible ? "visible" : "hidden"
317
+ };
318
+ }
300
319
  const { centerX, centerY } = layout;
301
320
  return {
302
321
  width: config.width * scale,
@@ -661,7 +680,6 @@ var usePlayer = () => {
661
680
  };
662
681
  });
663
682
  }, [videoId, imperativePlaying, lastFrame, setFrame]);
664
- const getCurrentFrame = useFrameImperative();
665
683
  const toggle = useCallback2((e) => {
666
684
  if (imperativePlaying.current) {
667
685
  pause();
@@ -680,12 +698,11 @@ var usePlayer = () => {
680
698
  pause,
681
699
  seek,
682
700
  isFirstFrame,
683
- getCurrentFrame,
701
+ getCurrentFrame: () => frameRef.current,
684
702
  isPlaying: () => imperativePlaying.current,
685
703
  isBuffering: () => buffering.current,
686
704
  pauseAndReturnToPlayStart,
687
705
  hasPlayed,
688
- remotionInternal_currentFrameRef: frameRef,
689
706
  toggle
690
707
  };
691
708
  }, [
@@ -693,7 +710,6 @@ var usePlayer = () => {
693
710
  emitter,
694
711
  frameBack,
695
712
  frameForward,
696
- getCurrentFrame,
697
713
  hasPlayed,
698
714
  imperativePlaying,
699
715
  isFirstFrame,
@@ -2652,13 +2668,12 @@ var PlayerUI = ({
2652
2668
  }, [config, layout, overflowVisible, scale]);
2653
2669
  const containerStyle3 = useMemo12(() => {
2654
2670
  return calculateContainerStyle({
2655
- canvasSize,
2656
2671
  config,
2657
2672
  layout,
2658
2673
  scale,
2659
2674
  overflowVisible
2660
2675
  });
2661
- }, [canvasSize, config, layout, overflowVisible, scale]);
2676
+ }, [config, layout, overflowVisible, scale]);
2662
2677
  const playerPause = player.pause;
2663
2678
  const playerDispatchError = player.emitter.dispatchError;
2664
2679
  const onError = useCallback11((error) => {
@@ -3403,13 +3418,12 @@ var ThumbnailUI = ({
3403
3418
  }, [config, layout, overflowVisible, scale]);
3404
3419
  const containerStyle3 = useMemo16(() => {
3405
3420
  return calculateContainerStyle({
3406
- canvasSize,
3407
3421
  config,
3408
3422
  layout,
3409
3423
  scale,
3410
3424
  overflowVisible
3411
3425
  });
3412
- }, [canvasSize, config, layout, overflowVisible, scale]);
3426
+ }, [config, layout, overflowVisible, scale]);
3413
3427
  const onError = useCallback13((error) => {
3414
3428
  thumbnail.emitter.dispatchError(error);
3415
3429
  }, [thumbnail.emitter]);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/player"
4
4
  },
5
5
  "name": "@remotion/player",
6
- "version": "4.0.321",
6
+ "version": "4.0.323",
7
7
  "description": "React component for embedding a Remotion preview into your app",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "license": "SEE LICENSE IN LICENSE.md",
30
30
  "dependencies": {
31
- "remotion": "4.0.321"
31
+ "remotion": "4.0.323"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=16.8.0",
@@ -43,7 +43,7 @@
43
43
  "webpack": "5.96.1",
44
44
  "zod": "3.22.3",
45
45
  "eslint": "9.19.0",
46
- "@remotion/eslint-config-internal": "4.0.321"
46
+ "@remotion/eslint-config-internal": "4.0.323"
47
47
  },
48
48
  "keywords": [
49
49
  "remotion",