@remotion/player 3.2.21 → 3.2.23-ensure-ffmpeg.123
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/LICENSE.md +8 -8
- package/README.md +1 -1
- package/dist/MediaVolumeSlider.d.ts +4 -1
- package/dist/MediaVolumeSlider.js +82 -55
- package/dist/Player.d.ts +7 -9
- package/dist/Player.js +6 -69
- package/dist/PlayerControls.d.ts +13 -1
- package/dist/PlayerControls.js +56 -13
- package/dist/PlayerSeekBar.d.ts +0 -0
- package/dist/PlayerSeekBar.js +0 -0
- package/dist/PlayerUI.d.ts +5 -5
- package/dist/PlayerUI.js +32 -71
- package/dist/SharedPlayerContext.d.ts +14 -0
- package/dist/SharedPlayerContext.js +71 -0
- package/dist/Thumbnail.d.ts +23 -0
- package/dist/Thumbnail.js +41 -0
- package/dist/ThumbnailUI.d.ts +11 -0
- package/dist/ThumbnailUI.js +107 -0
- package/dist/calculate-next-frame.d.ts +0 -0
- package/dist/calculate-next-frame.js +0 -0
- package/dist/calculate-scale.d.ts +25 -6
- package/dist/calculate-scale.js +53 -1
- package/dist/emitter-context.d.ts +2 -1
- package/dist/emitter-context.js +2 -1
- package/dist/error-boundary.d.ts +0 -0
- package/dist/error-boundary.js +0 -0
- package/dist/event-emitter.d.ts +28 -9
- package/dist/event-emitter.js +29 -1
- package/dist/format-time.d.ts +0 -0
- package/dist/format-time.js +0 -0
- package/dist/icons.d.ts +2 -1
- package/dist/icons.js +7 -7
- package/dist/index.d.ts +7 -5
- package/dist/index.js +3 -1
- package/dist/player-css-classname.d.ts +0 -1
- package/dist/player-css-classname.js +1 -2
- package/dist/player-methods.d.ts +6 -2
- package/dist/player-methods.js +0 -0
- package/dist/test/index.test.d.ts +0 -0
- package/dist/test/index.test.js +3 -2
- package/dist/test/test-utils.d.ts +0 -0
- package/dist/test/test-utils.js +0 -0
- package/dist/test/validate-in-out-frames.test.d.ts +0 -0
- package/dist/test/validate-in-out-frames.test.js +12 -11
- package/dist/test/validate-prop.test.d.ts +0 -0
- package/dist/test/validate-prop.test.js +24 -23
- package/dist/use-hover-state.d.ts +0 -0
- package/dist/use-hover-state.js +0 -0
- package/dist/use-playback.d.ts +0 -0
- package/dist/use-playback.js +3 -0
- package/dist/use-player.d.ts +0 -0
- package/dist/use-player.js +0 -0
- package/dist/use-thumbnail.d.ts +6 -0
- package/dist/use-thumbnail.js +18 -0
- package/dist/use-video-controls-resize.d.ts +7 -0
- package/dist/use-video-controls-resize.js +36 -0
- package/dist/utils/calculate-player-size.d.ts +0 -0
- package/dist/utils/calculate-player-size.js +0 -0
- package/dist/utils/cancellable-promise.d.ts +0 -0
- package/dist/utils/cancellable-promise.js +0 -0
- package/dist/utils/delay.d.ts +0 -0
- package/dist/utils/delay.js +0 -0
- package/dist/utils/is-node.d.ts +0 -0
- package/dist/utils/is-node.js +0 -0
- package/dist/utils/preview-size.d.ts +0 -0
- package/dist/utils/preview-size.js +0 -0
- package/dist/utils/props-if-has-props.d.ts +5 -0
- package/dist/utils/props-if-has-props.js +2 -0
- package/dist/utils/use-cancellable-promises.d.ts +0 -0
- package/dist/utils/use-cancellable-promises.js +0 -0
- package/dist/utils/use-click-prevention-on-double-click.d.ts +0 -0
- package/dist/utils/use-click-prevention-on-double-click.js +0 -0
- package/dist/utils/use-element-size.d.ts +0 -0
- package/dist/utils/use-element-size.js +0 -0
- package/dist/utils/validate-in-out-frame.d.ts +0 -0
- package/dist/utils/validate-in-out-frame.js +0 -0
- package/dist/utils/validate-initial-frame.d.ts +0 -0
- package/dist/utils/validate-initial-frame.js +0 -0
- package/dist/utils/validate-playbackrate.d.ts +0 -0
- package/dist/utils/validate-playbackrate.js +0 -0
- package/dist/volume-persistance.d.ts +0 -0
- package/dist/volume-persistance.js +0 -0
- package/package.json +11 -12
package/dist/event-emitter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlayerEmitter = void 0;
|
|
3
|
+
exports.ThumbnailEmitter = exports.PlayerEmitter = void 0;
|
|
4
4
|
class PlayerEmitter {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.listeners = {
|
|
@@ -11,6 +11,7 @@ class PlayerEmitter {
|
|
|
11
11
|
ratechange: [],
|
|
12
12
|
seeked: [],
|
|
13
13
|
timeupdate: [],
|
|
14
|
+
frameupdate: [],
|
|
14
15
|
fullscreenchange: [],
|
|
15
16
|
};
|
|
16
17
|
}
|
|
@@ -52,8 +53,35 @@ class PlayerEmitter {
|
|
|
52
53
|
dispatchTimeUpdate(event) {
|
|
53
54
|
this.dispatchEvent('timeupdate', event);
|
|
54
55
|
}
|
|
56
|
+
dispatchFrameUpdate(event) {
|
|
57
|
+
this.dispatchEvent('frameupdate', event);
|
|
58
|
+
}
|
|
55
59
|
dispatchFullscreenChangeUpdate(event) {
|
|
56
60
|
this.dispatchEvent('fullscreenchange', event);
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
exports.PlayerEmitter = PlayerEmitter;
|
|
64
|
+
class ThumbnailEmitter {
|
|
65
|
+
constructor() {
|
|
66
|
+
this.listeners = {
|
|
67
|
+
error: [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
addEventListener(name, callback) {
|
|
71
|
+
this.listeners[name].push(callback);
|
|
72
|
+
}
|
|
73
|
+
removeEventListener(name, callback) {
|
|
74
|
+
this.listeners[name] = this.listeners[name].filter((l) => l !== callback);
|
|
75
|
+
}
|
|
76
|
+
dispatchEvent(dispatchName, context) {
|
|
77
|
+
this.listeners[dispatchName].forEach((callback) => {
|
|
78
|
+
callback({ detail: context });
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
dispatchError(error) {
|
|
82
|
+
this.dispatchEvent('error', {
|
|
83
|
+
error,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.ThumbnailEmitter = ThumbnailEmitter;
|
package/dist/format-time.d.ts
CHANGED
|
File without changes
|
package/dist/format-time.js
CHANGED
|
File without changes
|
package/dist/icons.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const ICON_SIZE = 25;
|
|
3
|
+
export declare const fullscreenIconSize = 16;
|
|
3
4
|
export declare const PlayIcon: React.FC;
|
|
4
5
|
export declare const PauseIcon: React.FC;
|
|
5
6
|
export declare const FullscreenIcon: React.FC<{
|
|
6
|
-
|
|
7
|
+
isFullscreen: boolean;
|
|
7
8
|
}>;
|
|
8
9
|
export declare const VolumeOffIcon: React.FC;
|
|
9
10
|
export declare const VolumeOnIcon: React.FC;
|
package/dist/icons.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VolumeOnIcon = exports.VolumeOffIcon = exports.FullscreenIcon = exports.PauseIcon = exports.PlayIcon = exports.ICON_SIZE = void 0;
|
|
3
|
+
exports.VolumeOnIcon = exports.VolumeOffIcon = exports.FullscreenIcon = exports.PauseIcon = exports.PlayIcon = exports.fullscreenIconSize = exports.ICON_SIZE = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
exports.ICON_SIZE = 25;
|
|
6
|
-
|
|
6
|
+
exports.fullscreenIconSize = 16;
|
|
7
7
|
const rotate = {
|
|
8
8
|
transform: `rotate(90deg)`,
|
|
9
9
|
};
|
|
@@ -15,13 +15,13 @@ const PauseIcon = () => {
|
|
|
15
15
|
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 100 100", width: exports.ICON_SIZE, height: exports.ICON_SIZE, children: [(0, jsx_runtime_1.jsx)("rect", { x: "25", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" }), (0, jsx_runtime_1.jsx)("rect", { x: "55", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" })] }));
|
|
16
16
|
};
|
|
17
17
|
exports.PauseIcon = PauseIcon;
|
|
18
|
-
const FullscreenIcon = ({
|
|
18
|
+
const FullscreenIcon = ({ isFullscreen, }) => {
|
|
19
19
|
const strokeWidth = 6;
|
|
20
20
|
const viewSize = 32;
|
|
21
|
-
const out =
|
|
22
|
-
const middleInset =
|
|
23
|
-
const inset =
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${viewSize} ${viewSize}`, height: fullscreenIconSize, width: fullscreenIconSize, children: [(0, jsx_runtime_1.jsx)("path", { d: `
|
|
21
|
+
const out = isFullscreen ? 0 : strokeWidth / 2;
|
|
22
|
+
const middleInset = isFullscreen ? strokeWidth * 1.6 : strokeWidth / 2;
|
|
23
|
+
const inset = isFullscreen ? strokeWidth * 1.6 : strokeWidth * 2;
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${viewSize} ${viewSize}`, height: exports.fullscreenIconSize, width: exports.fullscreenIconSize, children: [(0, jsx_runtime_1.jsx)("path", { d: `
|
|
25
25
|
M ${out} ${inset}
|
|
26
26
|
L ${middleInset} ${middleInset}
|
|
27
27
|
L ${inset} ${out}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { CallbackListener,
|
|
2
|
+
import type { CallbackListener, PlayerEventTypes } from './event-emitter';
|
|
3
3
|
import { PlayerEmitter } from './event-emitter';
|
|
4
|
-
export {
|
|
5
|
-
export { PlayerMethods, PlayerRef } from './player-methods';
|
|
6
|
-
export type {
|
|
4
|
+
export { Player, PlayerProps } from './Player';
|
|
5
|
+
export { PlayerMethods, PlayerRef, ThumbnailMethods, ThumbnailRef, } from './player-methods';
|
|
6
|
+
export type { RenderFullscreenButton, RenderPlayPauseButton, } from './PlayerControls';
|
|
7
|
+
export type { ErrorFallback, RenderLoading, RenderPoster } from './PlayerUI';
|
|
8
|
+
export { Thumbnail } from './Thumbnail';
|
|
7
9
|
export { PreviewSize, Translation } from './utils/preview-size';
|
|
8
10
|
export { Size } from './utils/use-element-size';
|
|
9
|
-
export type { CallbackListener, EventTypes };
|
|
11
|
+
export type { CallbackListener, PlayerEventTypes as EventTypes };
|
|
10
12
|
export declare const PlayerInternals: {
|
|
11
13
|
PlayerEventEmitterContext: import("react").Context<PlayerEmitter | undefined>;
|
|
12
14
|
PlayerEmitter: typeof PlayerEmitter;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlayerInternals = exports.Player = void 0;
|
|
3
|
+
exports.PlayerInternals = exports.Thumbnail = exports.Player = void 0;
|
|
4
4
|
const calculate_scale_1 = require("./calculate-scale");
|
|
5
5
|
const emitter_context_1 = require("./emitter-context");
|
|
6
6
|
const event_emitter_1 = require("./event-emitter");
|
|
@@ -10,6 +10,8 @@ const use_player_1 = require("./use-player");
|
|
|
10
10
|
const use_element_size_1 = require("./utils/use-element-size");
|
|
11
11
|
var Player_1 = require("./Player");
|
|
12
12
|
Object.defineProperty(exports, "Player", { enumerable: true, get: function () { return Player_1.Player; } });
|
|
13
|
+
var Thumbnail_1 = require("./Thumbnail");
|
|
14
|
+
Object.defineProperty(exports, "Thumbnail", { enumerable: true, get: function () { return Thumbnail_1.Thumbnail; } });
|
|
13
15
|
exports.PlayerInternals = {
|
|
14
16
|
PlayerEventEmitterContext: emitter_context_1.PlayerEventEmitterContext,
|
|
15
17
|
PlayerEmitter: event_emitter_1.PlayerEmitter,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PLAYER_CSS_CLASSNAME = void 0;
|
|
4
4
|
exports.PLAYER_CSS_CLASSNAME = '__remotion-player';
|
|
5
|
-
exports.VOLUME_SLIDER_INPUT_CSS_CLASSNAME = exports.PLAYER_CSS_CLASSNAME.concat('_volume-slider-input');
|
package/dist/player-methods.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { SyntheticEvent } from 'react';
|
|
2
2
|
import type { PlayerEmitter } from './event-emitter';
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type ThumbnailMethods = {
|
|
4
|
+
getContainerNode: () => HTMLDivElement | null;
|
|
5
|
+
getScale: () => number;
|
|
6
|
+
};
|
|
7
|
+
export declare type PlayerMethods = ThumbnailMethods & {
|
|
4
8
|
play: (e?: SyntheticEvent) => void;
|
|
5
9
|
pause: () => void;
|
|
6
10
|
toggle: (e?: SyntheticEvent) => void;
|
|
7
11
|
seekTo: (frame: number) => void;
|
|
8
|
-
getContainerNode: () => HTMLDivElement | null;
|
|
9
12
|
getCurrentFrame: () => number;
|
|
10
13
|
requestFullscreen: () => void;
|
|
11
14
|
exitFullscreen: () => void;
|
|
@@ -17,4 +20,5 @@ export declare type PlayerMethods = {
|
|
|
17
20
|
mute: () => void;
|
|
18
21
|
unmute: () => void;
|
|
19
22
|
};
|
|
23
|
+
export declare type ThumbnailRef = PlayerEmitter & ThumbnailMethods;
|
|
20
24
|
export declare type PlayerRef = PlayerEmitter & PlayerMethods;
|
package/dist/player-methods.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/test/index.test.js
CHANGED
|
@@ -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
|
package/dist/test/test-utils.js
CHANGED
|
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
|
package/dist/use-hover-state.js
CHANGED
|
File without changes
|
package/dist/use-playback.d.ts
CHANGED
|
File without changes
|
package/dist/use-playback.js
CHANGED
|
@@ -85,5 +85,8 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
85
85
|
}, 250);
|
|
86
86
|
return () => clearInterval(interval);
|
|
87
87
|
}, [emitter]);
|
|
88
|
+
(0, react_1.useEffect)(() => {
|
|
89
|
+
emitter.dispatchFrameUpdate({ frame });
|
|
90
|
+
}, [emitter, frame]);
|
|
88
91
|
};
|
|
89
92
|
exports.usePlayback = usePlayback;
|
package/dist/use-player.d.ts
CHANGED
|
File without changes
|
package/dist/use-player.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useThumbnail = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const emitter_context_1 = require("./emitter-context");
|
|
6
|
+
const useThumbnail = () => {
|
|
7
|
+
const emitter = (0, react_1.useContext)(emitter_context_1.ThumbnailEmitterContext);
|
|
8
|
+
if (!emitter) {
|
|
9
|
+
throw new TypeError('Expected Player event emitter context');
|
|
10
|
+
}
|
|
11
|
+
const returnValue = (0, react_1.useMemo)(() => {
|
|
12
|
+
return {
|
|
13
|
+
emitter,
|
|
14
|
+
};
|
|
15
|
+
}, [emitter]);
|
|
16
|
+
return returnValue;
|
|
17
|
+
};
|
|
18
|
+
exports.useThumbnail = useThumbnail;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useVideoControlsResize = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const icons_1 = require("./icons");
|
|
6
|
+
const MediaVolumeSlider_1 = require("./MediaVolumeSlider");
|
|
7
|
+
const PlayerControls_1 = require("./PlayerControls");
|
|
8
|
+
const useVideoControlsResize = ({ allowFullscreen: allowFullScreen, playerWidth, }) => {
|
|
9
|
+
const resizeInfo = (0, react_1.useMemo)(() => {
|
|
10
|
+
const playPauseIconSize = icons_1.ICON_SIZE;
|
|
11
|
+
const volumeIconSize = icons_1.ICON_SIZE;
|
|
12
|
+
const _fullscreenIconSize = allowFullScreen ? icons_1.fullscreenIconSize : 0;
|
|
13
|
+
const elementsSize = volumeIconSize +
|
|
14
|
+
playPauseIconSize +
|
|
15
|
+
_fullscreenIconSize +
|
|
16
|
+
PlayerControls_1.X_PADDING * 2 +
|
|
17
|
+
PlayerControls_1.X_SPACER * 2;
|
|
18
|
+
const maxTimeLabelWidth = playerWidth - elementsSize;
|
|
19
|
+
const maxTimeLabelWidthWithoutNegativeValue = Math.max(maxTimeLabelWidth, 0);
|
|
20
|
+
const availableTimeLabelWidthIfVolumeOpen = maxTimeLabelWidthWithoutNegativeValue - MediaVolumeSlider_1.VOLUME_SLIDER_WIDTH;
|
|
21
|
+
// If max label width is lower than the volume width
|
|
22
|
+
// then it means we need to take it's width as the max label width
|
|
23
|
+
// otherwise we took the available width when volume open
|
|
24
|
+
const computedLabelWidth = availableTimeLabelWidthIfVolumeOpen < MediaVolumeSlider_1.VOLUME_SLIDER_WIDTH
|
|
25
|
+
? maxTimeLabelWidthWithoutNegativeValue
|
|
26
|
+
: availableTimeLabelWidthIfVolumeOpen;
|
|
27
|
+
const minWidthForHorizontalDisplay = computedLabelWidth + elementsSize + MediaVolumeSlider_1.VOLUME_SLIDER_WIDTH;
|
|
28
|
+
const displayVerticalVolumeSlider = playerWidth < minWidthForHorizontalDisplay;
|
|
29
|
+
return {
|
|
30
|
+
maxTimeLabelWidth: maxTimeLabelWidthWithoutNegativeValue,
|
|
31
|
+
displayVerticalVolumeSlider,
|
|
32
|
+
};
|
|
33
|
+
}, [allowFullScreen, playerWidth]);
|
|
34
|
+
return resizeInfo;
|
|
35
|
+
};
|
|
36
|
+
exports.useVideoControlsResize = useVideoControlsResize;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/utils/delay.d.ts
CHANGED
|
File without changes
|
package/dist/utils/delay.js
CHANGED
|
File without changes
|
package/dist/utils/is-node.d.ts
CHANGED
|
File without changes
|
package/dist/utils/is-node.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
|
|
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.
|
|
3
|
+
"version": "3.2.23-ensure-ffmpeg.123+3ffa18f9e",
|
|
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.
|
|
30
|
+
"remotion": "3.2.23-ensure-ffmpeg.123+3ffa18f9e"
|
|
32
31
|
},
|
|
33
32
|
"peerDependencies": {
|
|
34
33
|
"react": ">=16.8.0",
|
|
@@ -37,20 +36,20 @@
|
|
|
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
|
-
"@types/react": "18.0.
|
|
40
|
+
"@types/react": "18.0.23",
|
|
43
41
|
"@types/react-dom": "18.0.0",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
42
|
+
"@vitejs/plugin-react": "^2.0.0",
|
|
43
|
+
"csstype": "^3.0.11",
|
|
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",
|
|
53
|
-
"
|
|
51
|
+
"vitest": "0.24.3",
|
|
52
|
+
"webpack": "5.74.0"
|
|
54
53
|
},
|
|
55
54
|
"keywords": [
|
|
56
55
|
"remotion",
|
|
@@ -63,5 +62,5 @@
|
|
|
63
62
|
"publishConfig": {
|
|
64
63
|
"access": "public"
|
|
65
64
|
},
|
|
66
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "3ffa18f9eafd4322373c51c92816c671b92e3258"
|
|
67
66
|
}
|