@remotion/player 4.0.213 → 4.0.214

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const DefaultPlayPauseButton: React.FC<{
3
2
  playing: boolean;
4
3
  buffering: boolean;
@@ -174,10 +174,10 @@ const Controls = ({ durationInFrames, isFullscreen, fps, player, showVolumeContr
174
174
  onDoubleClick === null || onDoubleClick === void 0 ? void 0 : onDoubleClick(e);
175
175
  }
176
176
  }, [onDoubleClick]);
177
- return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: containerCss, onPointerDown: onPointerDownIfContainer, onDoubleClick: onDoubleClickIfContainer, children: [(0, jsx_runtime_1.jsxs)("div", { ref: flexRef, style: controlsRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftPartStyle, children: [(0, jsx_runtime_1.jsx)("button", { ref: playButtonRef, type: "button", style: PlaybackrateControl_js_1.playerButtonStyle, onClick: player.playing ? player.pause : player.play, "aria-label": player.playing ? 'Pause video' : 'Play video', title: player.playing ? 'Pause video' : 'Play video', children: renderPlayPauseButton === null ? ((0, jsx_runtime_1.jsx)(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: player.playing })) : ((_b = renderPlayPauseButton({
177
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: containerCss, onPointerDown: onPointerDownIfContainer, onDoubleClick: onDoubleClickIfContainer, children: [(0, jsx_runtime_1.jsxs)("div", { ref: flexRef, style: controlsRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftPartStyle, children: [(0, jsx_runtime_1.jsx)("button", { ref: playButtonRef, type: "button", style: PlaybackrateControl_js_1.playerButtonStyle, onClick: player.playing ? player.pause : player.play, "aria-label": player.playing ? 'Pause video' : 'Play video', title: player.playing ? 'Pause video' : 'Play video', children: renderPlayPauseButton === null ? ((0, jsx_runtime_1.jsx)(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: player.playing })) : (((_b = renderPlayPauseButton({
178
178
  playing: player.playing,
179
179
  isBuffering: buffering,
180
- })) !== null && _b !== void 0 ? _b : ((0, jsx_runtime_1.jsx)(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: player.playing }))) }), showVolumeControls ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsx)(MediaVolumeSlider_js_1.MediaVolumeSlider, { renderMuteButton: renderMuteButton, renderVolumeSlider: renderVolumeSlider, displayVerticalVolumeSlider: displayVerticalVolumeSlider })] })) : null, (0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsxs)("div", { style: timeLabel, children: [(0, format_time_js_1.formatTime)(frame / fps), " / ", (0, format_time_js_1.formatTime)(durationInFrames / fps)] }), (0, jsx_runtime_1.jsx)("div", { style: xSpacer })] }), (0, jsx_runtime_1.jsx)("div", { style: flex1 }), playbackRates && canvasSize && ((0, jsx_runtime_1.jsx)(PlaybackrateControl_js_1.PlaybackrateControl, { canvasSize: canvasSize, playbackRates: playbackRates })), playbackRates && supportsFullscreen && allowFullscreen ? ((0, jsx_runtime_1.jsx)("div", { style: xSpacer })) : null, (0, jsx_runtime_1.jsx)("div", { style: fullscreen, children: supportsFullscreen && allowFullscreen ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', title: isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', style: PlaybackrateControl_js_1.playerButtonStyle, onClick: isFullscreen
180
+ })) !== null && _b !== void 0 ? _b : ((0, jsx_runtime_1.jsx)(DefaultPlayPauseButton_js_1.DefaultPlayPauseButton, { buffering: buffering, playing: player.playing })))) }), showVolumeControls ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsx)(MediaVolumeSlider_js_1.MediaVolumeSlider, { renderMuteButton: renderMuteButton, renderVolumeSlider: renderVolumeSlider, displayVerticalVolumeSlider: displayVerticalVolumeSlider })] })) : null, (0, jsx_runtime_1.jsx)("div", { style: xSpacer }), (0, jsx_runtime_1.jsxs)("div", { style: timeLabel, children: [(0, format_time_js_1.formatTime)(frame / fps), " / ", (0, format_time_js_1.formatTime)(durationInFrames / fps)] }), (0, jsx_runtime_1.jsx)("div", { style: xSpacer })] }), (0, jsx_runtime_1.jsx)("div", { style: flex1 }), playbackRates && canvasSize && ((0, jsx_runtime_1.jsx)(PlaybackrateControl_js_1.PlaybackrateControl, { canvasSize: canvasSize, playbackRates: playbackRates })), playbackRates && supportsFullscreen && allowFullscreen ? ((0, jsx_runtime_1.jsx)("div", { style: xSpacer })) : null, (0, jsx_runtime_1.jsx)("div", { style: fullscreen, children: supportsFullscreen && allowFullscreen ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', title: isFullscreen ? 'Exit fullscreen' : 'Enter Fullscreen', style: PlaybackrateControl_js_1.playerButtonStyle, onClick: isFullscreen
181
181
  ? onExitFullscreenButtonClick
182
182
  : onFullscreenButtonClick, children: renderFullscreenButton === null ? ((0, jsx_runtime_1.jsx)(icons_js_1.FullscreenIcon, { isFullscreen: isFullscreen })) : (renderFullscreenButton({ isFullscreen })) })) : null })] }), (0, jsx_runtime_1.jsx)("div", { style: ySpacer }), (0, jsx_runtime_1.jsx)(PlayerSeekBar_js_1.PlayerSeekBar, { onSeekEnd: onSeekEnd, onSeekStart: onSeekStart, durationInFrames: durationInFrames, inFrame: inFrame, outFrame: outFrame })] }));
183
183
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const PlayerSeekBar: React.FC<{
3
2
  durationInFrames: number;
4
3
  onSeekStart: () => void;
@@ -8,9 +8,8 @@ const use_hover_state_js_1 = require("./use-hover-state.js");
8
8
  const use_player_js_1 = require("./use-player.js");
9
9
  const use_element_size_js_1 = require("./utils/use-element-size.js");
10
10
  const getFrameFromX = (clientX, durationInFrames, width) => {
11
- var _a;
12
11
  const pos = clientX;
13
- const frame = Math.round((0, remotion_1.interpolate)(pos, [0, width], [0, (_a = durationInFrames - 1) !== null && _a !== void 0 ? _a : 0], {
12
+ const frame = Math.round((0, remotion_1.interpolate)(pos, [0, width], [0, durationInFrames - 1], {
14
13
  extrapolateLeft: 'clamp',
15
14
  extrapolateRight: 'clamp',
16
15
  }));
@@ -20,14 +20,14 @@ declare const _default: React.ForwardRefExoticComponent<{
20
20
  readonly allowFullscreen: boolean;
21
21
  readonly inputProps: Record<string, unknown>;
22
22
  readonly showVolumeControls: boolean;
23
- readonly style?: React.CSSProperties | undefined;
23
+ readonly style?: React.CSSProperties;
24
24
  readonly clickToPlay: boolean;
25
25
  readonly doubleClickToFullscreen: boolean;
26
26
  readonly spaceKeyToPlayOrPause: boolean;
27
27
  readonly errorFallback: ErrorFallback;
28
28
  readonly playbackRate: number;
29
29
  readonly renderLoading: RenderLoading | undefined;
30
- readonly renderPoster: RenderLoading | undefined;
30
+ readonly renderPoster: RenderPoster | undefined;
31
31
  readonly className: string | undefined;
32
32
  readonly moveToBeginningWhenEnded: boolean;
33
33
  readonly showPosterWhenPaused: boolean;
@@ -45,7 +45,7 @@ declare const _default: React.ForwardRefExoticComponent<{
45
45
  readonly showPlaybackRateControl: boolean | number[];
46
46
  readonly posterFillMode: PosterFillMode;
47
47
  readonly bufferStateDelayInMilliseconds: number;
48
- readonly hideControlsWhenPointerDoesntMove: number | boolean;
48
+ readonly hideControlsWhenPointerDoesntMove: boolean | number;
49
49
  readonly overflowVisible: boolean;
50
50
  } & React.RefAttributes<PlayerRef>>;
51
51
  export default _default;
@@ -317,8 +317,14 @@ const PlayerUI = ({ controls, style, loop, autoPlay, allowFullscreen, inputProps
317
317
  ]);
318
318
  const VideoComponent = video ? video.component : null;
319
319
  const outerStyle = (0, react_1.useMemo)(() => {
320
- return (0, calculate_scale_js_1.calculateOuterStyle)({ canvasSize, config, style, overflowVisible });
321
- }, [canvasSize, config, overflowVisible, style]);
320
+ return (0, calculate_scale_js_1.calculateOuterStyle)({
321
+ canvasSize,
322
+ config,
323
+ style,
324
+ overflowVisible,
325
+ layout,
326
+ });
327
+ }, [canvasSize, config, layout, overflowVisible, style]);
322
328
  const outer = (0, react_1.useMemo)(() => {
323
329
  return (0, calculate_scale_js_1.calculateOuter)({ config, layout, scale, overflowVisible });
324
330
  }, [config, layout, overflowVisible, scale]);
@@ -3,7 +3,7 @@ import type { ThumbnailMethods } from './player-methods.js';
3
3
  import type { ErrorFallback, RenderLoading } from './PlayerUI.js';
4
4
  declare const _default: React.ForwardRefExoticComponent<{
5
5
  inputProps: Record<string, unknown>;
6
- style?: React.CSSProperties | undefined;
6
+ style?: React.CSSProperties;
7
7
  errorFallback: ErrorFallback;
8
8
  renderLoading: RenderLoading | undefined;
9
9
  className: string | undefined;
@@ -70,8 +70,14 @@ const ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, classNam
70
70
  }, [scale, thumbnail.emitter]);
71
71
  const VideoComponent = video ? video.component : null;
72
72
  const outerStyle = (0, react_1.useMemo)(() => {
73
- return (0, calculate_scale_js_1.calculateOuterStyle)({ config, style, canvasSize, overflowVisible });
74
- }, [canvasSize, config, overflowVisible, style]);
73
+ return (0, calculate_scale_js_1.calculateOuterStyle)({
74
+ config,
75
+ style,
76
+ canvasSize,
77
+ overflowVisible,
78
+ layout,
79
+ });
80
+ }, [canvasSize, config, layout, overflowVisible, style]);
75
81
  const outer = (0, react_1.useMemo)(() => {
76
82
  return (0, calculate_scale_js_1.calculateOuter)({ config, layout, scale, overflowVisible });
77
83
  }, [config, layout, overflowVisible, scale]);
@@ -8,16 +8,17 @@ type Layout = {
8
8
  scale: number;
9
9
  };
10
10
  export declare const calculateCanvasTransformation: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
11
- previewSize: PreviewSize['size'];
11
+ previewSize: PreviewSize["size"];
12
12
  compositionWidth: number;
13
13
  compositionHeight: number;
14
14
  canvasSize: Size;
15
15
  }) => Layout;
16
- export declare const calculateOuterStyle: ({ config, style, canvasSize, overflowVisible, }: {
16
+ export declare const calculateOuterStyle: ({ config, style, canvasSize, overflowVisible, layout, }: {
17
17
  config: VideoConfig | null;
18
18
  style: React.CSSProperties | undefined;
19
19
  canvasSize: Size | null;
20
20
  overflowVisible: boolean;
21
+ layout: Layout | null;
21
22
  }) => React.CSSProperties;
22
23
  export declare const calculateContainerStyle: ({ config, canvasSize, layout, scale, overflowVisible, }: {
23
24
  config: VideoConfig | null;
@@ -26,7 +26,7 @@ const calculateCanvasTransformation = ({ previewSize, compositionWidth, composit
26
26
  };
27
27
  };
28
28
  exports.calculateCanvasTransformation = calculateCanvasTransformation;
29
- const calculateOuterStyle = ({ config, style, canvasSize, overflowVisible, }) => {
29
+ const calculateOuterStyle = ({ config, style, canvasSize, overflowVisible, layout, }) => {
30
30
  if (!config) {
31
31
  return {};
32
32
  }
@@ -40,6 +40,7 @@ const calculateOuterStyle = ({ config, style, canvasSize, overflowVisible, }) =>
40
40
  height: style === null || style === void 0 ? void 0 : style.height,
41
41
  width: style === null || style === void 0 ? void 0 : style.width,
42
42
  }),
43
+ opacity: layout ? 1 : 0,
43
44
  ...style,
44
45
  };
45
46
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './_check-rsc.js';
3
2
  import type { CallbackListener, PlayerEventTypes } from './event-emitter.js';
4
3
  import { PlayerEmitter } from './event-emitter.js';
@@ -23,7 +22,7 @@ export declare const PlayerInternals: {
23
22
  isFirstFrame: boolean;
24
23
  emitter: PlayerEmitter;
25
24
  playing: boolean;
26
- play: (e?: PointerEvent | import("react").SyntheticEvent<Element, Event> | undefined) => void;
25
+ play: (e?: import("react").SyntheticEvent | PointerEvent) => void;
27
26
  pause: () => void;
28
27
  pauseAndReturnToPlayStart: () => void;
29
28
  seek: (newFrame: number) => void;
@@ -31,7 +30,7 @@ export declare const PlayerInternals: {
31
30
  isPlaying: () => boolean;
32
31
  hasPlayed: boolean;
33
32
  isBuffering: () => boolean;
34
- remotionInternal_currentFrameRef: import("react").MutableRefObject<number>;
33
+ remotionInternal_currentFrameRef: React.MutableRefObject<number>;
35
34
  };
36
35
  usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, frameRef, }: {
37
36
  loop: boolean;
@@ -39,14 +38,14 @@ export declare const PlayerInternals: {
39
38
  moveToBeginningWhenEnded: boolean;
40
39
  inFrame: number | null;
41
40
  outFrame: number | null;
42
- frameRef: import("react").MutableRefObject<number>;
41
+ frameRef: React.MutableRefObject<number>;
43
42
  }) => void;
44
- useElementSize: (ref: import("react").RefObject<HTMLElement>, options: {
43
+ useElementSize: (ref: React.RefObject<HTMLElement>, options: {
45
44
  triggerOnWindowResize: boolean;
46
45
  shouldApplyCssTransforms: boolean;
47
46
  }) => import("./utils/use-element-size.js").Size | null;
48
47
  calculateCanvasTransformation: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
49
- previewSize: number | "auto";
48
+ previewSize: import("remotion").PreviewSize["size"];
50
49
  compositionWidth: number;
51
50
  compositionHeight: number;
52
51
  canvasSize: import("./utils/use-element-size.js").Size;
@@ -57,10 +56,10 @@ export declare const PlayerInternals: {
57
56
  yCorrection: number;
58
57
  scale: number;
59
58
  };
60
- useHoverState: (ref: import("react").RefObject<HTMLDivElement>, hideControlsWhenPointerDoesntMove: number | boolean) => boolean;
59
+ useHoverState: (ref: React.RefObject<HTMLDivElement>, hideControlsWhenPointerDoesntMove: boolean | number) => boolean;
61
60
  updateAllElementsSizes: () => void;
62
61
  PlayerEmitterProvider: import("react").FC<{
63
- children: import("react").ReactNode;
62
+ children: React.ReactNode;
64
63
  currentPlaybackRate: number | null;
65
64
  }>;
66
65
  BufferingIndicator: import("react").FC<{
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const useIsBackgrounded: () => import("react").MutableRefObject<boolean>;
@@ -1,6 +1,6 @@
1
1
  import type { queries, RenderOptions } from '@testing-library/react';
2
2
  import type { FC, ReactElement } from 'react';
3
3
  declare const HelloWorld: FC;
4
- declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>) => import("@testing-library/react").RenderResult<typeof queries, HTMLElement, HTMLElement>;
4
+ declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions, "queries">) => import("@testing-library/react").RenderResult<typeof queries, HTMLElement, HTMLElement>;
5
5
  export * from '@testing-library/react';
6
6
  export { HelloWorld, customRender as render };
@@ -2,8 +2,8 @@ import type { StandardLonghandProperties } from 'csstype';
2
2
  import type { Size } from './use-element-size.js';
3
3
  export declare const calculatePlayerSize: ({ currentSize, width, height, compositionWidth, compositionHeight, }: {
4
4
  currentSize: Size | null;
5
- width: StandardLonghandProperties['width'] | undefined;
6
- height: StandardLonghandProperties['height'] | undefined;
5
+ width: StandardLonghandProperties["width"] | undefined;
6
+ height: StandardLonghandProperties["height"] | undefined;
7
7
  compositionWidth: number;
8
8
  compositionHeight: number;
9
9
  }) => React.CSSProperties;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function useComponentVisible(initialIsVisible: boolean): {
3
2
  ref: import("react").RefObject<HTMLDivElement>;
4
3
  isComponentVisible: boolean;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = useComponentVisible;
3
4
  const react_1 = require("react");
4
5
  // hook to hide a popup/modal when clicked outside
5
6
  function useComponentVisible(initialIsVisible) {
@@ -18,4 +19,3 @@ function useComponentVisible(initialIsVisible) {
18
19
  }, []);
19
20
  return { ref, isComponentVisible, setIsComponentVisible };
20
21
  }
21
- exports.default = useComponentVisible;
@@ -254,7 +254,8 @@ var calculateOuterStyle = ({
254
254
  config,
255
255
  style,
256
256
  canvasSize,
257
- overflowVisible
257
+ overflowVisible,
258
+ layout
258
259
  }) => {
259
260
  if (!config) {
260
261
  return {};
@@ -269,6 +270,7 @@ var calculateOuterStyle = ({
269
270
  height: style?.height,
270
271
  width: style?.width
271
272
  }),
273
+ opacity: layout ? 1 : 0,
272
274
  ...style
273
275
  };
274
276
  };
@@ -2422,8 +2424,14 @@ var PlayerUI = ({
2422
2424
  ]);
2423
2425
  const VideoComponent = video ? video.component : null;
2424
2426
  const outerStyle = useMemo11(() => {
2425
- return calculateOuterStyle({ canvasSize, config, style, overflowVisible });
2426
- }, [canvasSize, config, overflowVisible, style]);
2427
+ return calculateOuterStyle({
2428
+ canvasSize,
2429
+ config,
2430
+ style,
2431
+ overflowVisible,
2432
+ layout
2433
+ });
2434
+ }, [canvasSize, config, layout, overflowVisible, style]);
2427
2435
  const outer = useMemo11(() => {
2428
2436
  return calculateOuter({ config, layout, scale, overflowVisible });
2429
2437
  }, [config, layout, overflowVisible, scale]);
@@ -3121,8 +3129,14 @@ var ThumbnailUI = ({ style, inputProps, errorFallback, renderLoading, className:
3121
3129
  }, [scale, thumbnail.emitter]);
3122
3130
  const VideoComponent = video ? video.component : null;
3123
3131
  const outerStyle = useMemo15(() => {
3124
- return calculateOuterStyle({ config, style, canvasSize, overflowVisible });
3125
- }, [canvasSize, config, overflowVisible, style]);
3132
+ return calculateOuterStyle({
3133
+ config,
3134
+ style,
3135
+ canvasSize,
3136
+ overflowVisible,
3137
+ layout
3138
+ });
3139
+ }, [canvasSize, config, layout, overflowVisible, style]);
3126
3140
  const outer = useMemo15(() => {
3127
3141
  return calculateOuter({ config, layout, scale, overflowVisible });
3128
3142
  }, [config, layout, overflowVisible, scale]);
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.213",
6
+ "version": "4.0.214",
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.213"
31
+ "remotion": "4.0.214"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=16.8.0",
@@ -57,7 +57,7 @@
57
57
  "scripts": {
58
58
  "formatting": "prettier src --check",
59
59
  "lint": "eslint src --ext ts,tsx",
60
- "build": "bun ensure-correct-version.ts && bun --env-file=../.env.bundle bundle.ts",
60
+ "make": "bun ensure-correct-version.ts && bun --env-file=../.env.bundle bundle.ts",
61
61
  "test": "bun test src",
62
62
  "prerelease": "cp ../../README.md ."
63
63
  }