@remotion/player 3.2.2 → 3.2.6

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/Player.js CHANGED
@@ -13,7 +13,6 @@ const player_css_classname_1 = require("./player-css-classname");
13
13
  const PlayerUI_1 = __importDefault(require("./PlayerUI"));
14
14
  const validate_playbackrate_1 = require("./utils/validate-playbackrate");
15
15
  const volume_persistance_1 = require("./volume-persistance");
16
- remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
17
16
  const componentOrNullIfLazy = (props) => {
18
17
  if ('component' in props) {
19
18
  return props.component;
@@ -179,6 +178,10 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
179
178
  const passedInputProps = (0, react_1.useMemo)(() => {
180
179
  return inputProps !== null && inputProps !== void 0 ? inputProps : {};
181
180
  }, [inputProps]);
181
+ (0, react_1.useLayoutEffect)(() => {
182
+ // Inject CSS only on client, and also only after the Player has hydrated
183
+ remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
184
+ }, []);
182
185
  return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManager.Provider, { value: compositionManagerContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SharedAudioContextProvider, { numberOfAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(emitter_context_1.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(PlayerUI_1.default, { ref: rootRef, renderLoading: renderLoading, autoPlay: Boolean(autoPlay), loop: Boolean(loop), controls: Boolean(controls), errorFallback: errorFallback, style: style, inputProps: passedInputProps, allowFullscreen: Boolean(allowFullscreen), moveToBeginningWhenEnded: Boolean(moveToBeginningWhenEnded), clickToPlay: typeof clickToPlay === 'boolean'
183
186
  ? clickToPlay
184
187
  : Boolean(controls), showVolumeControls: Boolean(showVolumeControls), setMediaVolume: setMediaVolumeAndPersist, mediaVolume: mediaVolume, mediaMuted: mediaMuted, doubleClickToFullscreen: Boolean(doubleClickToFullscreen), setMediaMuted: setMediaMuted, spaceKeyToPlayOrPause: Boolean(spaceKeyToPlayOrPause), playbackRate: playbackRate, className: className !== null && className !== void 0 ? className : undefined }) }) }) }) }) }) }) }) }));
@@ -34,6 +34,13 @@ const barBackground = {
34
34
  width: '100%',
35
35
  borderRadius: BAR_HEIGHT / 2,
36
36
  };
37
+ const findBodyInWhichDivIsLocated = (div) => {
38
+ let current = div;
39
+ while (current.parentElement) {
40
+ current = current.parentElement;
41
+ }
42
+ return current;
43
+ };
37
44
  const PlayerSeekBar = ({ durationInFrames }) => {
38
45
  const containerRef = (0, react_1.useRef)(null);
39
46
  const barHovered = (0, use_hover_state_1.useHoverState)(containerRef);
@@ -87,11 +94,12 @@ const PlayerSeekBar = ({ durationInFrames }) => {
87
94
  if (!dragging.dragging) {
88
95
  return;
89
96
  }
90
- window.addEventListener('pointermove', onPointerMove);
91
- window.addEventListener('pointerup', onPointerUp);
97
+ const body = findBodyInWhichDivIsLocated(containerRef.current);
98
+ body.addEventListener('pointermove', onPointerMove);
99
+ body.addEventListener('pointerup', onPointerUp);
92
100
  return () => {
93
- window.removeEventListener('pointermove', onPointerMove);
94
- window.removeEventListener('pointerup', onPointerUp);
101
+ body.removeEventListener('pointermove', onPointerMove);
102
+ body.removeEventListener('pointerup', onPointerUp);
95
103
  };
96
104
  }, [dragging.dragging, onPointerMove, onPointerUp]);
97
105
  const knobStyle = (0, react_1.useMemo)(() => {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { CallbackListener, EventTypes } from './event-emitter';
2
3
  import { PlayerEmitter } from './event-emitter';
3
4
  export { ErrorFallback, Player } from './Player';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/player",
3
- "version": "3.2.2",
3
+ "version": "3.2.6",
4
4
  "description": "Remotion Player",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "license": "SEE LICENSE IN LICENSE.md",
30
30
  "dependencies": {
31
- "remotion": "3.2.2"
31
+ "remotion": "3.2.6"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=16.8.0",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "8e5f2d05adf7ddd3824ea734fa888b4b4761f364"
66
+ "gitHead": "9ecc20c6e7cea22c6a011b60d618ae42349ea19d"
67
67
  }