@remotion/player 3.2.32 → 3.2.34

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.
Files changed (71) hide show
  1. package/dist/MediaVolumeSlider.d.ts +0 -0
  2. package/dist/MediaVolumeSlider.js +3 -1
  3. package/dist/Player.d.ts +0 -0
  4. package/dist/Player.js +0 -0
  5. package/dist/PlayerControls.d.ts +0 -0
  6. package/dist/PlayerControls.js +0 -0
  7. package/dist/PlayerSeekBar.d.ts +0 -0
  8. package/dist/PlayerSeekBar.js +0 -0
  9. package/dist/PlayerUI.d.ts +0 -0
  10. package/dist/PlayerUI.js +0 -0
  11. package/dist/calculate-next-frame.d.ts +0 -0
  12. package/dist/calculate-next-frame.js +0 -0
  13. package/dist/calculate-scale.d.ts +0 -0
  14. package/dist/calculate-scale.js +0 -0
  15. package/dist/emitter-context.d.ts +0 -0
  16. package/dist/emitter-context.js +0 -0
  17. package/dist/error-boundary.d.ts +0 -0
  18. package/dist/error-boundary.js +0 -0
  19. package/dist/event-emitter.d.ts +0 -0
  20. package/dist/event-emitter.js +0 -0
  21. package/dist/format-time.d.ts +0 -0
  22. package/dist/format-time.js +0 -0
  23. package/dist/icons.d.ts +0 -0
  24. package/dist/icons.js +0 -0
  25. package/dist/index.d.ts +0 -0
  26. package/dist/index.js +0 -0
  27. package/dist/player-css-classname.d.ts +0 -0
  28. package/dist/player-css-classname.js +0 -0
  29. package/dist/player-methods.d.ts +0 -0
  30. package/dist/player-methods.js +0 -0
  31. package/dist/test/index.test.d.ts +0 -0
  32. package/dist/test/index.test.js +3 -2
  33. package/dist/test/test-utils.d.ts +0 -0
  34. package/dist/test/test-utils.js +0 -0
  35. package/dist/test/validate-in-out-frames.test.d.ts +0 -0
  36. package/dist/test/validate-in-out-frames.test.js +12 -11
  37. package/dist/test/validate-prop.test.d.ts +0 -0
  38. package/dist/test/validate-prop.test.js +24 -23
  39. package/dist/use-hover-state.d.ts +0 -0
  40. package/dist/use-hover-state.js +0 -0
  41. package/dist/use-playback.d.ts +0 -0
  42. package/dist/use-playback.js +0 -0
  43. package/dist/use-player.d.ts +0 -0
  44. package/dist/use-player.js +0 -0
  45. package/dist/use-video-controls-resize.d.ts +0 -0
  46. package/dist/use-video-controls-resize.js +0 -0
  47. package/dist/utils/calculate-player-size.d.ts +0 -0
  48. package/dist/utils/calculate-player-size.js +0 -0
  49. package/dist/utils/cancellable-promise.d.ts +0 -0
  50. package/dist/utils/cancellable-promise.js +0 -0
  51. package/dist/utils/delay.d.ts +0 -0
  52. package/dist/utils/delay.js +0 -0
  53. package/dist/utils/is-node.d.ts +0 -0
  54. package/dist/utils/is-node.js +0 -0
  55. package/dist/utils/preview-size.d.ts +0 -0
  56. package/dist/utils/preview-size.js +0 -0
  57. package/dist/utils/use-cancellable-promises.d.ts +0 -0
  58. package/dist/utils/use-cancellable-promises.js +0 -0
  59. package/dist/utils/use-click-prevention-on-double-click.d.ts +0 -0
  60. package/dist/utils/use-click-prevention-on-double-click.js +0 -0
  61. package/dist/utils/use-element-size.d.ts +0 -0
  62. package/dist/utils/use-element-size.js +0 -0
  63. package/dist/utils/validate-in-out-frame.d.ts +0 -0
  64. package/dist/utils/validate-in-out-frame.js +0 -0
  65. package/dist/utils/validate-initial-frame.d.ts +0 -0
  66. package/dist/utils/validate-initial-frame.js +0 -0
  67. package/dist/utils/validate-playbackrate.d.ts +0 -0
  68. package/dist/utils/validate-playbackrate.js +0 -0
  69. package/dist/volume-persistance.d.ts +0 -0
  70. package/dist/volume-persistance.js +0 -0
  71. package/package.json +8 -9
File without changes
@@ -16,7 +16,9 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
16
16
  const parentDivRef = (0, react_1.useRef)(null);
17
17
  const inputRef = (0, react_1.useRef)(null);
18
18
  const hover = (0, use_hover_state_1.useHoverState)(parentDivRef);
19
- const [randomClass] = (0, react_1.useState)(() => `slider-${(0, remotion_1.random)(null)}`.replace('.', ''));
19
+ // eslint-disable-next-line react-hooks/rules-of-hooks
20
+ const randomId = typeof react_1.useId === 'undefined' ? 'volume-slider' : (0, react_1.useId)();
21
+ const [randomClass] = (0, react_1.useState)(() => `__remotion-volume-slider-${(0, remotion_1.random)(randomId)}`.replace('.', ''));
20
22
  const isMutedOrZero = mediaMuted || mediaVolume === 0;
21
23
  const onVolumeChange = (e) => {
22
24
  setMediaVolume(parseFloat(e.target.value));
package/dist/Player.d.ts CHANGED
File without changes
package/dist/Player.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/PlayerUI.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/icons.d.ts CHANGED
File without changes
package/dist/icons.js CHANGED
File without changes
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
3
4
  const use_player_1 = require("../use-player");
4
- test('It should throw an error if not being used inside a RemotionRoot', () => {
5
- expect(() => {
5
+ (0, vitest_1.test)('It should throw an error if not being used inside a RemotionRoot', () => {
6
+ (0, vitest_1.expect)(() => {
6
7
  (0, use_player_1.usePlayer)();
7
8
  }).toThrow();
8
9
  });
File without changes
File without changes
File without changes
@@ -1,53 +1,54 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
3
4
  const validate_in_out_frame_1 = require("../utils/validate-in-out-frame");
4
- test('Validate in out frames', () => {
5
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
5
+ (0, vitest_1.test)('Validate in out frames', () => {
6
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
6
7
  durationInFrames: 200,
7
8
  inFrame: 201,
8
9
  outFrame: undefined,
9
10
  })).toThrow(/inFrame must be less than \(durationInFrames - 1\)/);
10
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
11
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
11
12
  durationInFrames: 200,
12
13
  inFrame: 199,
13
14
  outFrame: 201,
14
15
  })).toThrow(/outFrame must be less than \(durationInFrames - 1\)/);
15
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
16
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
16
17
  durationInFrames: 200,
17
18
  inFrame: -10,
18
19
  outFrame: null,
19
20
  })).toThrow(/inFrame must be greater than 0, but is -10/);
20
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
21
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
21
22
  durationInFrames: 200,
22
23
  inFrame: null,
23
24
  outFrame: -10,
24
25
  })).toThrow(/outFrame must be greater than 0, but is -10/);
25
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
26
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
26
27
  durationInFrames: 200,
27
28
  inFrame: 1.5,
28
29
  outFrame: null,
29
30
  })).toThrow(/"inFrame" must be an integer, but is 1.5/);
30
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
31
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
31
32
  durationInFrames: 200,
32
33
  inFrame: 20,
33
34
  outFrame: 20,
34
35
  })).toThrow(/outFrame must be greater than inFrame, but is 20/);
35
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
36
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
36
37
  durationInFrames: 200,
37
38
  inFrame: 21,
38
39
  outFrame: 20,
39
40
  })).toThrow(/outFrame must be greater than inFrame, but is 20 <= 21/);
40
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
41
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
41
42
  durationInFrames: 200,
42
43
  inFrame: null,
43
44
  outFrame: 20,
44
45
  })).not.toThrow();
45
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
46
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
46
47
  durationInFrames: 200,
47
48
  inFrame: null,
48
49
  outFrame: null,
49
50
  })).not.toThrow();
50
- expect(() => (0, validate_in_out_frame_1.validateInOutFrames)({
51
+ (0, vitest_1.expect)(() => (0, validate_in_out_frame_1.validateInOutFrames)({
51
52
  durationInFrames: 200,
52
53
  inFrame: 10,
53
54
  outFrame: 20,
File without changes
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const remotion_1 = require("remotion");
5
+ const vitest_1 = require("vitest");
5
6
  const index_1 = require("../index");
6
7
  const test_utils_1 = require("./test-utils");
7
- test('no compositionWidth should give errors', () => {
8
+ (0, vitest_1.test)('no compositionWidth should give errors', () => {
8
9
  try {
9
10
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player
10
11
  // @ts-expect-error
@@ -13,27 +14,27 @@ test('no compositionWidth should give errors', () => {
13
14
  compositionWidth: null, errorFallback: () => 'something went wrong', compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
14
15
  }
15
16
  catch (e) {
16
- expect(e.message).toMatch(/'compositionWidth' must be a number but got 'object' instead/);
17
+ (0, vitest_1.expect)(e.message).toMatch(/'compositionWidth' must be a number but got 'object' instead/);
17
18
  }
18
19
  });
19
- test('no compositionHeight should give errors', () => {
20
+ (0, vitest_1.test)('no compositionHeight should give errors', () => {
20
21
  try {
21
22
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 400, errorFallback: () => 'something went wrong',
22
23
  // @ts-expect-error
23
24
  compositionHeight: undefined, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
24
25
  }
25
26
  catch (e) {
26
- expect(e.message).toMatch(/'compositionHeight' must be a number but got 'undefined' instead/);
27
+ (0, vitest_1.expect)(e.message).toMatch(/'compositionHeight' must be a number but got 'undefined' instead/);
27
28
  }
28
29
  });
29
- test('No fps should give errors', () => {
30
+ (0, vitest_1.test)('No fps should give errors', () => {
30
31
  try {
31
32
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong',
32
33
  // @ts-expect-error
33
34
  fps: null, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
34
35
  }
35
36
  catch (e) {
36
- expect(e.message).toMatch(/"fps" must be a number, but you passed a value of type object/);
37
+ (0, vitest_1.expect)(e.message).toMatch(/"fps" must be a number, but you passed a value of type object/);
37
38
  }
38
39
  try {
39
40
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong',
@@ -41,51 +42,51 @@ test('No fps should give errors', () => {
41
42
  fps: undefined, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
42
43
  }
43
44
  catch (e) {
44
- expect(e.message).toMatch(/"fps" must be a number, but you passed a value of type undefined/);
45
+ (0, vitest_1.expect)(e.message).toMatch(/"fps" must be a number, but you passed a value of type undefined/);
45
46
  }
46
47
  });
47
- test('No durationInFrames should give errors', () => {
48
+ (0, vitest_1.test)('No durationInFrames should give errors', () => {
48
49
  try {
49
50
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong', fps: 30,
50
51
  // @ts-expect-error
51
52
  durationInFrames: undefined, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
52
53
  }
53
54
  catch (e) {
54
- expect(e.message).toMatch(/durationInFrames` must be a number, but is undefined/);
55
+ (0, vitest_1.expect)(e.message).toMatch(/durationInFrames` must be a number, but is undefined/);
55
56
  }
56
57
  });
57
- test('Invalid playbackRate should give error', () => {
58
+ (0, vitest_1.test)('Invalid playbackRate should give error', () => {
58
59
  try {
59
60
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true, playbackRate: -5 }));
60
61
  }
61
62
  catch (e) {
62
- expect(e.message).toMatch(/The lowest possible playback rate is -4. You passed: -5/);
63
+ (0, vitest_1.expect)(e.message).toMatch(/The lowest possible playback rate is -4. You passed: -5/);
63
64
  }
64
65
  });
65
- test('playbackRate of 0 should not be possible', () => {
66
+ (0, vitest_1.test)('playbackRate of 0 should not be possible', () => {
66
67
  try {
67
68
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true, playbackRate: 0 }));
68
69
  }
69
70
  catch (e) {
70
- expect(e.message).toMatch(/A playback rate of 0 is not supported./);
71
+ (0, vitest_1.expect)(e.message).toMatch(/A playback rate of 0 is not supported./);
71
72
  }
72
73
  });
73
- test('playbackRate of wrong type should not be possible', () => {
74
+ (0, vitest_1.test)('playbackRate of wrong type should not be possible', () => {
74
75
  try {
75
76
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true,
76
77
  // @ts-expect-error
77
78
  playbackRate: 'hi' }));
78
79
  }
79
80
  catch (e) {
80
- expect(e.message).toMatch(/A playback rate of 0 is not supported./);
81
+ (0, vitest_1.expect)(e.message).toMatch(/A playback rate of 0 is not supported./);
81
82
  }
82
83
  });
83
- test('playbackRate of undefined should be okay', () => {
84
+ (0, vitest_1.test)('playbackRate of undefined should be okay', () => {
84
85
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: test_utils_1.HelloWorld, controls: true, showVolumeControls: true }));
85
- expect(true).toBe(true);
86
+ (0, vitest_1.expect)(true).toBe(true);
86
87
  });
87
- test('passing in <Composition /> instance should not be possible', () => {
88
- expect(() => {
88
+ (0, vitest_1.test)('passing in <Composition /> instance should not be possible', () => {
89
+ (0, vitest_1.expect)(() => {
89
90
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500, component: remotion_1.Composition, controls: true, showVolumeControls: true, inputProps: {
90
91
  id: 'HelloWorld',
91
92
  width: 500,
@@ -96,8 +97,8 @@ test('passing in <Composition /> instance should not be possible', () => {
96
97
  } }));
97
98
  }).toThrow(/'component' must not be the 'Composition' component\. Pass your own React/);
98
99
  });
99
- test('passing in <Composition /> instance should not be possible', () => {
100
- expect(() => {
100
+ (0, vitest_1.test)('passing in <Composition /> instance should not be possible', () => {
101
+ (0, vitest_1.expect)(() => {
101
102
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, fps: 30, durationInFrames: 500,
102
103
  // @ts-expect-error
103
104
  component: (0, jsx_runtime_1.jsx)(remotion_1.Composition, { durationInFrames: 30, fps: 30, height: 10, width: 10, id: "hello", component: test_utils_1.HelloWorld }), controls: true, showVolumeControls: true, inputProps: {
@@ -110,7 +111,7 @@ test('passing in <Composition /> instance should not be possible', () => {
110
111
  } }));
111
112
  }).toThrow(/'component' should not be an instance of <Composition\/>\. Pass the React component dir/);
112
113
  });
113
- test.each([
114
+ vitest_1.test.each([
114
115
  ['controls'],
115
116
  ['loop'],
116
117
  ['autoPlay'],
@@ -125,6 +126,6 @@ test.each([
125
126
  (0, test_utils_1.render)((0, jsx_runtime_1.jsx)(index_1.Player, { compositionWidth: 500, compositionHeight: 400, errorFallback: () => 'something went wrong', fps: 30, durationInFrames: 100, component: test_utils_1.HelloWorld, ...props }));
126
127
  }
127
128
  catch (e) {
128
- expect(e.message).toMatch(`'${a}' must be a boolean or undefined but got 'string' instead`);
129
+ (0, vitest_1.expect)(e.message).toMatch(`'${a}' must be a boolean or undefined but got 'string' instead`);
129
130
  }
130
131
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@remotion/player",
3
- "version": "3.2.32",
3
+ "version": "3.2.34",
4
4
  "description": "Remotion Player",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "lint": "eslint src --ext ts,tsx",
9
- "test": "jest",
10
9
  "build": "tsc -d",
11
10
  "watch": "tsc -w",
12
11
  "prerelease": "cp ../../README.md ."
@@ -28,7 +27,7 @@
28
27
  ],
29
28
  "license": "SEE LICENSE IN LICENSE.md",
30
29
  "dependencies": {
31
- "remotion": "3.2.32"
30
+ "remotion": "3.2.34"
32
31
  },
33
32
  "peerDependencies": {
34
33
  "react": ">=16.8.0",
@@ -37,19 +36,19 @@
37
36
  "devDependencies": {
38
37
  "@jonny/eslint-config": "3.0.266",
39
38
  "@testing-library/react": "13.1.1",
40
- "@types/jest": "^27.4.0",
41
39
  "@types/node": "^14.14.14",
42
40
  "@types/react": "18.0.1",
43
41
  "@types/react-dom": "18.0.0",
42
+ "@vitejs/plugin-react": "^2.0.0",
44
43
  "csstype": "^3.0.9",
45
- "eslint": "8.13.0",
46
- "jest": "^27.2.4",
47
- "prettier": "^2.0.5",
44
+ "eslint": "8.25.0",
45
+ "jsdom": "20.0.1",
46
+ "prettier": "^2.7.1",
48
47
  "prettier-plugin-organize-imports": "^2.3.4",
49
48
  "react": "^18.0.0",
50
49
  "react-dom": "^18.0.0",
51
- "ts-jest": "^27.0.5",
52
50
  "typescript": "^4.7.0",
51
+ "vitest": "0.24.3",
53
52
  "webpack": "5.74.0"
54
53
  },
55
54
  "keywords": [
@@ -63,5 +62,5 @@
63
62
  "publishConfig": {
64
63
  "access": "public"
65
64
  },
66
- "gitHead": "4f7ab3637405d140041f898f95f78c99943d1b40"
65
+ "gitHead": "82f5d37510dfdf0630c5836cbe5655d7d3ebb2b2"
67
66
  }