@remotion/player 4.0.0-bitrate.18 → 4.0.0-clippath.7
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 → cjs/MediaVolumeSlider.d.ts} +0 -0
- package/dist/{MediaVolumeSlider.js → cjs/MediaVolumeSlider.js} +15 -15
- package/dist/{Player.d.ts → cjs/Player.d.ts} +12 -13
- package/dist/{Player.js → cjs/Player.js} +24 -80
- package/dist/{PlayerControls.d.ts → cjs/PlayerControls.d.ts} +11 -4
- package/dist/{PlayerControls.js → cjs/PlayerControls.js} +32 -19
- package/dist/{PlayerSeekBar.d.ts → cjs/PlayerSeekBar.d.ts} +0 -0
- package/dist/{PlayerSeekBar.js → cjs/PlayerSeekBar.js} +6 -6
- package/dist/{PlayerUI.d.ts → cjs/PlayerUI.d.ts} +8 -8
- package/dist/{PlayerUI.js → cjs/PlayerUI.js} +32 -68
- package/dist/cjs/SharedPlayerContext.d.ts +14 -0
- package/dist/cjs/SharedPlayerContext.js +72 -0
- package/dist/cjs/Thumbnail.d.ts +24 -0
- package/dist/cjs/Thumbnail.js +46 -0
- package/dist/cjs/ThumbnailUI.d.ts +11 -0
- package/dist/cjs/ThumbnailUI.js +107 -0
- package/dist/{calculate-next-frame.d.ts → cjs/calculate-next-frame.d.ts} +0 -0
- package/dist/{calculate-next-frame.js → cjs/calculate-next-frame.js} +0 -0
- package/dist/cjs/calculate-scale.d.ts +39 -0
- package/dist/cjs/calculate-scale.js +85 -0
- package/dist/cjs/emitter-context.d.ts +4 -0
- package/dist/{emitter-context.js → cjs/emitter-context.js} +2 -1
- package/dist/{error-boundary.d.ts → cjs/error-boundary.d.ts} +0 -0
- package/dist/{error-boundary.js → cjs/error-boundary.js} +0 -0
- package/dist/{event-emitter.d.ts → cjs/event-emitter.d.ts} +23 -9
- package/dist/{event-emitter.js → cjs/event-emitter.js} +25 -1
- package/dist/{format-time.d.ts → cjs/format-time.d.ts} +0 -0
- package/dist/{format-time.js → cjs/format-time.js} +0 -0
- package/dist/{icons.d.ts → cjs/icons.d.ts} +1 -1
- package/dist/{icons.js → cjs/icons.js} +4 -4
- package/dist/{index.d.ts → cjs/index.d.ts} +13 -11
- package/dist/cjs/index.js +25 -0
- package/dist/{player-css-classname.d.ts → cjs/player-css-classname.d.ts} +0 -0
- package/dist/{player-css-classname.js → cjs/player-css-classname.js} +0 -0
- package/dist/{player-methods.d.ts → cjs/player-methods.d.ts} +7 -4
- package/dist/{player-methods.js → cjs/player-methods.js} +0 -0
- package/dist/{test → cjs/test}/index.test.d.ts +0 -0
- package/dist/cjs/test/index.test.js +9 -0
- package/dist/{test → cjs/test}/test-utils.d.ts +0 -0
- package/dist/{test → cjs/test}/test-utils.js +0 -0
- package/dist/{test → cjs/test}/validate-in-out-frames.test.d.ts +0 -0
- package/dist/{test → cjs/test}/validate-in-out-frames.test.js +13 -12
- package/dist/{test → cjs/test}/validate-prop.test.d.ts +0 -0
- package/dist/cjs/test/validate-prop.test.js +131 -0
- package/dist/{use-hover-state.d.ts → cjs/use-hover-state.d.ts} +0 -0
- package/dist/{use-hover-state.js → cjs/use-hover-state.js} +0 -0
- package/dist/{use-playback.d.ts → cjs/use-playback.d.ts} +0 -0
- package/dist/{use-playback.js → cjs/use-playback.js} +4 -4
- package/dist/{use-player.d.ts → cjs/use-player.d.ts} +1 -1
- package/dist/{use-player.js → cjs/use-player.js} +2 -2
- package/dist/cjs/use-thumbnail.d.ts +6 -0
- package/dist/cjs/use-thumbnail.js +18 -0
- package/dist/{use-video-controls-resize.d.ts → cjs/use-video-controls-resize.d.ts} +8 -4
- package/dist/{use-video-controls-resize.js → cjs/use-video-controls-resize.js} +16 -13
- package/dist/{utils → cjs/utils}/calculate-player-size.d.ts +1 -1
- package/dist/{utils → cjs/utils}/calculate-player-size.js +9 -10
- package/dist/{utils → cjs/utils}/cancellable-promise.d.ts +0 -0
- package/dist/{utils → cjs/utils}/cancellable-promise.js +0 -0
- package/dist/{utils → cjs/utils}/delay.d.ts +0 -0
- package/dist/{utils → cjs/utils}/delay.js +0 -0
- package/dist/{utils → cjs/utils}/is-node.d.ts +0 -0
- package/dist/{utils → cjs/utils}/is-node.js +0 -0
- package/dist/{utils → cjs/utils}/preview-size.d.ts +0 -0
- package/dist/{utils → cjs/utils}/preview-size.js +0 -0
- package/dist/cjs/utils/props-if-has-props.d.ts +5 -0
- package/dist/cjs/utils/props-if-has-props.js +2 -0
- package/dist/{utils → cjs/utils}/use-cancellable-promises.d.ts +1 -1
- package/dist/{utils → cjs/utils}/use-cancellable-promises.js +0 -0
- package/dist/{utils → cjs/utils}/use-click-prevention-on-double-click.d.ts +0 -0
- package/dist/{utils → cjs/utils}/use-click-prevention-on-double-click.js +5 -5
- package/dist/{utils → cjs/utils}/use-element-size.d.ts +1 -0
- package/dist/{utils → cjs/utils}/use-element-size.js +1 -1
- package/dist/{utils → cjs/utils}/validate-in-out-frame.d.ts +1 -1
- package/dist/{utils → cjs/utils}/validate-in-out-frame.js +13 -13
- package/dist/{utils → cjs/utils}/validate-initial-frame.d.ts +0 -0
- package/dist/{utils → cjs/utils}/validate-initial-frame.js +0 -0
- package/dist/{utils → cjs/utils}/validate-playbackrate.d.ts +0 -0
- package/dist/{utils → cjs/utils}/validate-playbackrate.js +0 -0
- package/dist/{volume-persistance.d.ts → cjs/volume-persistance.d.ts} +0 -0
- package/dist/{volume-persistance.js → cjs/volume-persistance.js} +0 -0
- package/dist/esm/MediaVolumeSlider.d.ts +5 -0
- package/dist/esm/Player.d.ts +48 -0
- package/dist/esm/PlayerControls.d.ts +40 -0
- package/dist/esm/PlayerSeekBar.d.ts +8 -0
- package/dist/esm/PlayerUI.d.ts +39 -0
- package/dist/esm/SharedPlayerContext.d.ts +14 -0
- package/dist/esm/Thumbnail.d.ts +24 -0
- package/dist/esm/ThumbnailUI.d.ts +11 -0
- package/dist/esm/calculate-next-frame.d.ts +14 -0
- package/dist/esm/calculate-scale.d.ts +39 -0
- package/dist/esm/emitter-context.d.ts +4 -0
- package/dist/esm/error-boundary.d.ts +19 -0
- package/dist/esm/event-emitter.d.ts +66 -0
- package/dist/esm/format-time.d.ts +1 -0
- package/dist/esm/icons.d.ts +10 -0
- package/dist/esm/index.d.ts +61 -0
- package/dist/esm/index.mjs +1830 -0
- package/dist/esm/player-css-classname.d.ts +1 -0
- package/dist/esm/player-methods.d.ts +24 -0
- package/dist/esm/test/index.test.d.ts +1 -0
- package/dist/esm/test/test-utils.d.ts +6 -0
- package/dist/esm/test/validate-in-out-frames.test.d.ts +1 -0
- package/dist/esm/test/validate-prop.test.d.ts +1 -0
- package/dist/esm/use-hover-state.d.ts +1 -0
- package/dist/esm/use-playback.d.ts +7 -0
- package/dist/esm/use-player.d.ts +19 -0
- package/dist/esm/use-thumbnail.d.ts +6 -0
- package/dist/esm/use-video-controls-resize.d.ts +11 -0
- package/dist/esm/utils/calculate-player-size.d.ts +9 -0
- package/dist/esm/utils/cancellable-promise.d.ts +5 -0
- package/dist/esm/utils/delay.d.ts +1 -0
- package/dist/esm/utils/is-node.d.ts +1 -0
- package/dist/esm/utils/preview-size.d.ts +8 -0
- package/dist/esm/utils/props-if-has-props.d.ts +5 -0
- package/dist/esm/utils/use-cancellable-promises.d.ts +7 -0
- package/dist/esm/utils/use-click-prevention-on-double-click.d.ts +3 -0
- package/dist/esm/utils/use-element-size.d.ts +16 -0
- package/dist/esm/utils/validate-in-out-frame.d.ts +6 -0
- package/dist/esm/utils/validate-initial-frame.d.ts +4 -0
- package/dist/esm/utils/validate-playbackrate.d.ts +1 -0
- package/dist/esm/volume-persistance.d.ts +2 -0
- package/dist/tsconfig-esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +28 -16
- package/dist/calculate-scale.d.ts +0 -20
- package/dist/calculate-scale.js +0 -33
- package/dist/emitter-context.d.ts +0 -3
- package/dist/index.js +0 -23
- package/dist/test/index.test.js +0 -8
- package/dist/test/validate-prop.test.js +0 -130
package/LICENSE.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# Remotion License
|
|
2
2
|
|
|
3
|
-
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion create videos for free (even commercial), while a company license is required for for-profit
|
|
3
|
+
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
4
4
|
|
|
5
5
|
- [Free license](#free-license)
|
|
6
6
|
- [Company license](#company-license)
|
|
7
7
|
|
|
8
8
|
## Free license
|
|
9
9
|
|
|
10
|
-
Copyright ©
|
|
10
|
+
Copyright © 2023 [Remotion](https://www.remotion.dev/)
|
|
11
11
|
|
|
12
12
|
### Eligibility
|
|
13
13
|
|
|
14
14
|
You are eligible to use Remotion for free if you are:
|
|
15
15
|
|
|
16
16
|
- an individual
|
|
17
|
-
- a for-profit
|
|
18
|
-
- a non-profit or not-for-profit
|
|
17
|
+
- a for-profit organization with up to 3 employees
|
|
18
|
+
- a non-profit or not-for-profit organization
|
|
19
19
|
- evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
|
|
20
20
|
|
|
21
21
|
### Allowed use cases
|
|
22
22
|
|
|
23
|
-
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify
|
|
23
|
+
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
|
|
24
24
|
|
|
25
25
|
### Disallowed use cases
|
|
26
26
|
|
|
27
|
-
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
|
|
27
|
+
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
|
|
28
28
|
|
|
29
29
|
### Warranty notice
|
|
30
30
|
|
|
31
|
-
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and
|
|
31
|
+
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
32
32
|
|
|
33
33
|
### Support
|
|
34
34
|
|
|
@@ -36,6 +36,6 @@ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
|
|
|
36
36
|
|
|
37
37
|
## Company license
|
|
38
38
|
|
|
39
|
-
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
|
|
39
|
+
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](/docs/support)).
|
|
40
40
|
|
|
41
41
|
Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
|
package/README.md
CHANGED
|
@@ -83,4 +83,4 @@ The most important props accepted:
|
|
|
83
83
|
| compositionWidth | The width of the composition in pixels |
|
|
84
84
|
| fps | The frame rate of the video |
|
|
85
85
|
|
|
86
|
-
For a complete reference of the available props, refer to [@remotion/player API](https://www.remotion.dev/docs/player/
|
|
86
|
+
For a complete reference of the available props, refer to [@remotion/player API](https://www.remotion.dev/docs/player/player).
|
|
File without changes
|
|
@@ -4,8 +4,8 @@ exports.MediaVolumeSlider = exports.VOLUME_SLIDER_WIDTH = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const icons_js_1 = require("./icons.js");
|
|
8
|
+
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
9
9
|
const BAR_HEIGHT = 5;
|
|
10
10
|
const KNOB_SIZE = 12;
|
|
11
11
|
exports.VOLUME_SLIDER_WIDTH = 100;
|
|
@@ -15,8 +15,10 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
15
15
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
16
16
|
const parentDivRef = (0, react_1.useRef)(null);
|
|
17
17
|
const inputRef = (0, react_1.useRef)(null);
|
|
18
|
-
const hover = (0,
|
|
19
|
-
|
|
18
|
+
const hover = (0, use_hover_state_js_1.useHoverState)(parentDivRef);
|
|
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));
|
|
@@ -53,8 +55,8 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
53
55
|
const volumeContainer = (0, react_1.useMemo)(() => {
|
|
54
56
|
return {
|
|
55
57
|
display: 'inline',
|
|
56
|
-
width:
|
|
57
|
-
height:
|
|
58
|
+
width: icons_js_1.ICON_SIZE,
|
|
59
|
+
height: icons_js_1.ICON_SIZE,
|
|
58
60
|
cursor: 'pointer',
|
|
59
61
|
appearance: 'none',
|
|
60
62
|
background: 'none',
|
|
@@ -70,20 +72,24 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
70
72
|
cursor: 'pointer',
|
|
71
73
|
height: BAR_HEIGHT,
|
|
72
74
|
width: exports.VOLUME_SLIDER_WIDTH,
|
|
75
|
+
backgroundImage: `linear-gradient(
|
|
76
|
+
to right,
|
|
77
|
+
white ${mediaVolume * 100}%, rgba(255, 255, 255, 0) ${mediaVolume * 100}%
|
|
78
|
+
)`,
|
|
73
79
|
};
|
|
74
80
|
if (displayVerticalVolumeSlider) {
|
|
75
81
|
return {
|
|
76
82
|
...commonStyle,
|
|
77
83
|
transform: `rotate(-90deg)`,
|
|
78
84
|
position: 'absolute',
|
|
79
|
-
bottom:
|
|
85
|
+
bottom: icons_js_1.ICON_SIZE + exports.VOLUME_SLIDER_WIDTH / 2 + 5,
|
|
80
86
|
};
|
|
81
87
|
}
|
|
82
88
|
return {
|
|
83
89
|
...commonStyle,
|
|
84
90
|
marginLeft: 5,
|
|
85
91
|
};
|
|
86
|
-
}, [displayVerticalVolumeSlider]);
|
|
92
|
+
}, [displayVerticalVolumeSlider, mediaVolume]);
|
|
87
93
|
const sliderStyle = `
|
|
88
94
|
.${randomClass}::-webkit-slider-thumb {
|
|
89
95
|
-webkit-appearance: none;
|
|
@@ -93,12 +99,6 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
93
99
|
height: ${KNOB_SIZE}px;
|
|
94
100
|
width: ${KNOB_SIZE}px;
|
|
95
101
|
}
|
|
96
|
-
.${randomClass} {
|
|
97
|
-
background-image: linear-gradient(
|
|
98
|
-
to right,
|
|
99
|
-
white ${mediaVolume * 100}%, rgba(255, 255, 255, 0) ${mediaVolume * 100}%
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
102
|
|
|
103
103
|
.${randomClass}::-moz-range-thumb {
|
|
104
104
|
-webkit-appearance: none;
|
|
@@ -113,6 +113,6 @@ const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
|
113
113
|
// eslint-disable-next-line react/no-danger
|
|
114
114
|
dangerouslySetInnerHTML: {
|
|
115
115
|
__html: sliderStyle,
|
|
116
|
-
} }), (0, jsx_runtime_1.jsx)("button", { "aria-label": isMutedOrZero ? 'Unmute sound' : 'Mute sound', title: isMutedOrZero ? 'Unmute sound' : 'Mute sound', onClick: onClick, onBlur: onBlur, onFocus: () => setFocused(true), style: volumeContainer, type: "button", children: isMutedOrZero ? (0, jsx_runtime_1.jsx)(
|
|
116
|
+
} }), (0, jsx_runtime_1.jsx)("button", { "aria-label": isMutedOrZero ? 'Unmute sound' : 'Mute sound', title: isMutedOrZero ? 'Unmute sound' : 'Mute sound', onClick: onClick, onBlur: onBlur, onFocus: () => setFocused(true), style: volumeContainer, type: "button", children: isMutedOrZero ? (0, jsx_runtime_1.jsx)(icons_js_1.VolumeOffIcon, {}) : (0, jsx_runtime_1.jsx)(icons_js_1.VolumeOnIcon, {}) }), (focused || hover) && !mediaMuted ? ((0, jsx_runtime_1.jsx)("input", { ref: inputRef, "aria-label": "Change volume", className: randomClass, max: 1, min: 0, onBlur: () => setFocused(false), onChange: onVolumeChange, step: 0.01, type: "range", value: mediaVolume, style: inputStyle })) : null] }));
|
|
117
117
|
};
|
|
118
118
|
exports.MediaVolumeSlider = MediaVolumeSlider;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { ComponentType
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { CompProps } from 'remotion';
|
|
4
|
-
import type { PlayerRef } from './player-methods';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} : {
|
|
9
|
-
inputProps: Props;
|
|
10
|
-
};
|
|
4
|
+
import type { PlayerRef } from './player-methods.js';
|
|
5
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
6
|
+
import type { RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
7
|
+
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
11
8
|
export declare type ErrorFallback = (info: {
|
|
12
9
|
error: Error;
|
|
13
10
|
}) => React.ReactNode;
|
|
@@ -39,11 +36,13 @@ export declare type PlayerProps<T> = {
|
|
|
39
36
|
inFrame?: number | null;
|
|
40
37
|
outFrame?: number | null;
|
|
41
38
|
initiallyShowControls?: number | boolean;
|
|
39
|
+
renderPlayPauseButton?: RenderPlayPauseButton;
|
|
40
|
+
renderFullscreenButton?: RenderFullscreenButton;
|
|
41
|
+
alwaysShowControls?: boolean;
|
|
42
42
|
} & PropsIfHasProps<T> & CompProps<T>;
|
|
43
43
|
export declare const componentOrNullIfLazy: <T>(props: CompProps<T>) => ComponentType<T> | null;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
/**
|
|
45
|
+
* @description A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a Remotion video.
|
|
46
|
+
* @see [Documentation](https://www.remotion.dev/docs/player/player)
|
|
47
|
+
*/
|
|
48
48
|
export declare const Player: <T>(props: PlayerProps<T> & React.RefAttributes<PlayerRef>) => React.ReactElement | null;
|
|
49
|
-
export {};
|
|
@@ -3,18 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Player = exports.
|
|
6
|
+
exports.Player = exports.componentOrNullIfLazy = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const remotion_1 = require("remotion");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
10
|
+
const emitter_context_js_1 = require("./emitter-context.js");
|
|
11
|
+
const event_emitter_js_1 = require("./event-emitter.js");
|
|
12
|
+
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
13
|
+
const PlayerUI_js_1 = __importDefault(require("./PlayerUI.js"));
|
|
14
|
+
const SharedPlayerContext_js_1 = require("./SharedPlayerContext.js");
|
|
15
|
+
const validate_in_out_frame_js_1 = require("./utils/validate-in-out-frame.js");
|
|
16
|
+
const validate_initial_frame_js_1 = require("./utils/validate-initial-frame.js");
|
|
17
|
+
const validate_playbackrate_js_1 = require("./utils/validate-playbackrate.js");
|
|
18
18
|
const componentOrNullIfLazy = (props) => {
|
|
19
19
|
if ('component' in props) {
|
|
20
20
|
return props.component;
|
|
@@ -22,7 +22,7 @@ const componentOrNullIfLazy = (props) => {
|
|
|
22
22
|
return null;
|
|
23
23
|
};
|
|
24
24
|
exports.componentOrNullIfLazy = componentOrNullIfLazy;
|
|
25
|
-
const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls = false, loop = false, autoPlay = false, showVolumeControls = true, allowFullscreen = true, clickToPlay, doubleClickToFullscreen = false, spaceKeyToPlayOrPause = true, moveToBeginningWhenEnded = true, numberOfSharedAudioTags = 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, ...componentProps }, ref) => {
|
|
25
|
+
const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps, inputProps, style, controls = false, loop = false, autoPlay = false, showVolumeControls = true, allowFullscreen = true, clickToPlay, doubleClickToFullscreen = false, spaceKeyToPlayOrPause = true, moveToBeginningWhenEnded = true, numberOfSharedAudioTags = 5, errorFallback = () => '⚠️', playbackRate = 1, renderLoading, className, showPosterWhenUnplayed, showPosterWhenEnded, showPosterWhenPaused, initialFrame, renderPoster, inFrame, outFrame, initiallyShowControls, renderFullscreenButton, renderPlayPauseButton, alwaysShowControls = false, ...componentProps }, ref) => {
|
|
26
26
|
if (typeof window !== 'undefined') {
|
|
27
27
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
28
28
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -42,14 +42,12 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
42
42
|
throw new TypeError(`'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.`);
|
|
43
43
|
}
|
|
44
44
|
const component = remotion_1.Internals.useLazyComponent(componentProps);
|
|
45
|
-
(0,
|
|
45
|
+
(0, validate_initial_frame_js_1.validateInitialFrame)({ initialFrame, durationInFrames });
|
|
46
46
|
const [frame, setFrame] = (0, react_1.useState)(() => initialFrame !== null && initialFrame !== void 0 ? initialFrame : 0);
|
|
47
47
|
const [playing, setPlaying] = (0, react_1.useState)(false);
|
|
48
48
|
const [rootId] = (0, react_1.useState)('player-comp');
|
|
49
|
-
const [emitter] = (0, react_1.useState)(() => new
|
|
49
|
+
const [emitter] = (0, react_1.useState)(() => new event_emitter_js_1.PlayerEmitter());
|
|
50
50
|
const rootRef = (0, react_1.useRef)(null);
|
|
51
|
-
const [mediaMuted, setMediaMuted] = (0, react_1.useState)(false);
|
|
52
|
-
const [mediaVolume, setMediaVolume] = (0, react_1.useState)((0, volume_persistance_1.getPreferredVolume)());
|
|
53
51
|
const audioAndVideoTags = (0, react_1.useRef)([]);
|
|
54
52
|
const imperativePlaying = (0, react_1.useRef)(false);
|
|
55
53
|
if (typeof compositionHeight !== 'number') {
|
|
@@ -62,7 +60,7 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
62
60
|
remotion_1.Internals.validateDimension(compositionWidth, 'compositionWidth', 'of the <Player /> component');
|
|
63
61
|
remotion_1.Internals.validateDurationInFrames(durationInFrames, 'of the <Player/> component');
|
|
64
62
|
remotion_1.Internals.validateFps(fps, 'as a prop of the <Player/> component', false);
|
|
65
|
-
(0,
|
|
63
|
+
(0, validate_in_out_frame_js_1.validateInOutFrames)({
|
|
66
64
|
durationInFrames,
|
|
67
65
|
inFrame,
|
|
68
66
|
outFrame,
|
|
@@ -102,14 +100,10 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
102
100
|
numberOfSharedAudioTags < 0) {
|
|
103
101
|
throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${numberOfSharedAudioTags}' instead`);
|
|
104
102
|
}
|
|
105
|
-
(0,
|
|
103
|
+
(0, validate_playbackrate_js_1.validatePlaybackRate)(playbackRate);
|
|
106
104
|
(0, react_1.useEffect)(() => {
|
|
107
105
|
emitter.dispatchRatechange(playbackRate);
|
|
108
106
|
}, [emitter, playbackRate]);
|
|
109
|
-
const setMediaVolumeAndPersist = (0, react_1.useCallback)((vol) => {
|
|
110
|
-
setMediaVolume(vol);
|
|
111
|
-
(0, volume_persistance_1.persistVolume)(vol);
|
|
112
|
-
}, []);
|
|
113
107
|
(0, react_1.useImperativeHandle)(ref, () => rootRef.current, []);
|
|
114
108
|
const timelineContextValue = (0, react_1.useMemo)(() => {
|
|
115
109
|
return {
|
|
@@ -131,60 +125,6 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
131
125
|
setPlaying,
|
|
132
126
|
};
|
|
133
127
|
}, [setFrame]);
|
|
134
|
-
const mediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
135
|
-
return {
|
|
136
|
-
mediaMuted,
|
|
137
|
-
mediaVolume,
|
|
138
|
-
};
|
|
139
|
-
}, [mediaMuted, mediaVolume]);
|
|
140
|
-
const setMediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
141
|
-
return {
|
|
142
|
-
setMediaMuted,
|
|
143
|
-
setMediaVolume: setMediaVolumeAndPersist,
|
|
144
|
-
};
|
|
145
|
-
}, [setMediaVolumeAndPersist]);
|
|
146
|
-
const compositionManagerContext = (0, react_1.useMemo)(() => {
|
|
147
|
-
return {
|
|
148
|
-
compositions: [
|
|
149
|
-
{
|
|
150
|
-
component: component,
|
|
151
|
-
durationInFrames,
|
|
152
|
-
height: compositionHeight,
|
|
153
|
-
width: compositionWidth,
|
|
154
|
-
fps,
|
|
155
|
-
id: 'player-comp',
|
|
156
|
-
props: inputProps,
|
|
157
|
-
nonce: 777,
|
|
158
|
-
scale: 1,
|
|
159
|
-
folderName: null,
|
|
160
|
-
defaultProps: undefined,
|
|
161
|
-
parentFolderName: null,
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
folders: [],
|
|
165
|
-
registerFolder: () => undefined,
|
|
166
|
-
unregisterFolder: () => undefined,
|
|
167
|
-
currentComposition: 'player-comp',
|
|
168
|
-
registerComposition: () => undefined,
|
|
169
|
-
registerSequence: () => undefined,
|
|
170
|
-
sequences: [],
|
|
171
|
-
setCurrentComposition: () => undefined,
|
|
172
|
-
unregisterComposition: () => undefined,
|
|
173
|
-
unregisterSequence: () => undefined,
|
|
174
|
-
registerAsset: () => undefined,
|
|
175
|
-
unregisterAsset: () => undefined,
|
|
176
|
-
currentCompositionMetadata: null,
|
|
177
|
-
setCurrentCompositionMetadata: () => undefined,
|
|
178
|
-
assets: [],
|
|
179
|
-
};
|
|
180
|
-
}, [
|
|
181
|
-
component,
|
|
182
|
-
durationInFrames,
|
|
183
|
-
compositionHeight,
|
|
184
|
-
compositionWidth,
|
|
185
|
-
fps,
|
|
186
|
-
inputProps,
|
|
187
|
-
]);
|
|
188
128
|
const passedInputProps = (0, react_1.useMemo)(() => {
|
|
189
129
|
return inputProps !== null && inputProps !== void 0 ? inputProps : {};
|
|
190
130
|
}, [inputProps]);
|
|
@@ -192,12 +132,16 @@ const PlayerFn = ({ durationInFrames, compositionHeight, compositionWidth, fps,
|
|
|
192
132
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
193
133
|
(0, react_1.useLayoutEffect)(() => {
|
|
194
134
|
// Inject CSS only on client, and also only after the Player has hydrated
|
|
195
|
-
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${
|
|
135
|
+
remotion_1.Internals.CSSUtils.injectCSS(remotion_1.Internals.CSSUtils.makeDefaultCSS(`.${player_css_classname_js_1.PLAYER_CSS_CLASSNAME}`, '#fff'));
|
|
196
136
|
}, []);
|
|
197
137
|
}
|
|
198
|
-
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.
|
|
199
|
-
|
|
200
|
-
|
|
138
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.IsPlayerContextProvider, { children: (0, jsx_runtime_1.jsx)(SharedPlayerContext_js_1.SharedPlayerContexts, { timelineContext: timelineContextValue, component: component, compositionHeight: compositionHeight, compositionWidth: compositionWidth, durationInFrames: durationInFrames, fps: fps, inputProps: inputProps, numberOfSharedAudioTags: numberOfSharedAudioTags, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(emitter_context_js_1.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(PlayerUI_js_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'
|
|
139
|
+
? clickToPlay
|
|
140
|
+
: Boolean(controls), showVolumeControls: Boolean(showVolumeControls), doubleClickToFullscreen: Boolean(doubleClickToFullscreen), spaceKeyToPlayOrPause: Boolean(spaceKeyToPlayOrPause), playbackRate: playbackRate, className: className !== null && className !== void 0 ? className : undefined, showPosterWhenUnplayed: Boolean(showPosterWhenUnplayed), showPosterWhenEnded: Boolean(showPosterWhenEnded), showPosterWhenPaused: Boolean(showPosterWhenPaused), renderPoster: renderPoster, inFrame: inFrame !== null && inFrame !== void 0 ? inFrame : null, outFrame: outFrame !== null && outFrame !== void 0 ? outFrame : null, initiallyShowControls: initiallyShowControls !== null && initiallyShowControls !== void 0 ? initiallyShowControls : true, renderFullscreen: renderFullscreenButton !== null && renderFullscreenButton !== void 0 ? renderFullscreenButton : null, renderPlayPauseButton: renderPlayPauseButton !== null && renderPlayPauseButton !== void 0 ? renderPlayPauseButton : null, alwaysShowControls: alwaysShowControls }) }) }) }) }));
|
|
201
141
|
};
|
|
202
|
-
|
|
203
|
-
|
|
142
|
+
const forward = react_1.forwardRef;
|
|
143
|
+
/**
|
|
144
|
+
* @description A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a Remotion video.
|
|
145
|
+
* @see [Documentation](https://www.remotion.dev/docs/player/player)
|
|
146
|
+
*/
|
|
147
|
+
exports.Player = forward(PlayerFn);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { MouseEventHandler } from 'react';
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { usePlayer } from './use-player';
|
|
4
|
-
export declare
|
|
5
|
-
|
|
3
|
+
import type { usePlayer } from './use-player.js';
|
|
4
|
+
export declare type RenderPlayPauseButton = (props: {
|
|
5
|
+
playing: boolean;
|
|
6
|
+
}) => ReactNode;
|
|
7
|
+
export declare type RenderFullscreenButton = (props: {
|
|
8
|
+
isFullscreen: boolean;
|
|
9
|
+
}) => ReactNode;
|
|
6
10
|
declare global {
|
|
7
11
|
interface Document {
|
|
8
12
|
webkitFullscreenEnabled?: boolean;
|
|
@@ -30,4 +34,7 @@ export declare const Controls: React.FC<{
|
|
|
30
34
|
outFrame: number | null;
|
|
31
35
|
initiallyShowControls: number | boolean;
|
|
32
36
|
playerWidth: number;
|
|
37
|
+
renderPlayPauseButton: RenderPlayPauseButton | null;
|
|
38
|
+
renderFullscreenButton: RenderFullscreenButton | null;
|
|
39
|
+
alwaysShowControls: boolean;
|
|
33
40
|
}>;
|
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Controls =
|
|
3
|
+
exports.Controls = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const format_time_js_1 = require("./format-time.js");
|
|
8
|
+
const icons_js_1 = require("./icons.js");
|
|
9
|
+
const MediaVolumeSlider_js_1 = require("./MediaVolumeSlider.js");
|
|
10
|
+
const PlayerSeekBar_js_1 = require("./PlayerSeekBar.js");
|
|
11
|
+
const use_video_controls_resize_js_1 = require("./use-video-controls-resize.js");
|
|
12
|
+
const gradientSteps = [
|
|
13
|
+
0, 0.013, 0.049, 0.104, 0.175, 0.259, 0.352, 0.45, 0.55, 0.648, 0.741, 0.825,
|
|
14
|
+
0.896, 0.951, 0.987,
|
|
15
|
+
];
|
|
16
|
+
const gradientOpacities = [
|
|
17
|
+
0, 8.1, 15.5, 22.5, 29, 35.3, 41.2, 47.1, 52.9, 58.8, 64.7, 71, 77.5, 84.5,
|
|
18
|
+
91.9,
|
|
19
|
+
];
|
|
20
|
+
const globalGradientOpacity = 1 / 0.7;
|
|
14
21
|
const containerStyle = {
|
|
15
22
|
boxSizing: 'border-box',
|
|
16
23
|
position: 'absolute',
|
|
17
24
|
bottom: 0,
|
|
18
25
|
width: '100%',
|
|
19
|
-
paddingTop:
|
|
26
|
+
paddingTop: 40,
|
|
20
27
|
paddingBottom: 10,
|
|
21
|
-
|
|
28
|
+
backgroundImage: `linear-gradient(to bottom,${gradientSteps
|
|
29
|
+
.map((g, i) => {
|
|
30
|
+
return `hsla(0, 0%, 0%, ${g}) ${gradientOpacities[i] * globalGradientOpacity}%`;
|
|
31
|
+
})
|
|
32
|
+
.join(', ')}, hsl(0, 0%, 0%) 100%)`,
|
|
33
|
+
backgroundSize: 'auto 145px',
|
|
22
34
|
display: 'flex',
|
|
23
|
-
paddingRight:
|
|
24
|
-
paddingLeft:
|
|
35
|
+
paddingRight: use_video_controls_resize_js_1.X_PADDING,
|
|
36
|
+
paddingLeft: use_video_controls_resize_js_1.X_PADDING,
|
|
25
37
|
flexDirection: 'column',
|
|
26
38
|
transition: 'opacity 0.3s',
|
|
27
39
|
};
|
|
@@ -60,11 +72,12 @@ const flex1 = {
|
|
|
60
72
|
flex: 1,
|
|
61
73
|
};
|
|
62
74
|
const fullscreen = {};
|
|
63
|
-
const
|
|
75
|
+
const PlayPauseButton = ({ playing }) => playing ? (0, jsx_runtime_1.jsx)(icons_js_1.PauseIcon, {}) : (0, jsx_runtime_1.jsx)(icons_js_1.PlayIcon, {});
|
|
76
|
+
const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVolumeControls, onFullscreenButtonClick, allowFullscreen, onExitFullscreenButtonClick, spaceKeyToPlayOrPause, onSeekEnd, onSeekStart, inFrame, outFrame, initiallyShowControls, playerWidth, renderPlayPauseButton, renderFullscreenButton, alwaysShowControls, }) => {
|
|
64
77
|
const playButtonRef = (0, react_1.useRef)(null);
|
|
65
78
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
66
79
|
const [supportsFullscreen, setSupportsFullscreen] = (0, react_1.useState)(false);
|
|
67
|
-
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = (0,
|
|
80
|
+
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = (0, use_video_controls_resize_js_1.useVideoControlsResize)({ allowFullscreen, playerWidth });
|
|
68
81
|
const [shouldShowInitially, setInitiallyShowControls] = (0, react_1.useState)(() => {
|
|
69
82
|
if (typeof initiallyShowControls === 'boolean') {
|
|
70
83
|
return initiallyShowControls;
|
|
@@ -88,12 +101,12 @@ const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVo
|
|
|
88
101
|
});
|
|
89
102
|
const containerCss = (0, react_1.useMemo)(() => {
|
|
90
103
|
// Hide if playing and mouse outside
|
|
91
|
-
const shouldShow = hovered || !player.playing || shouldShowInitially;
|
|
104
|
+
const shouldShow = hovered || !player.playing || shouldShowInitially || alwaysShowControls;
|
|
92
105
|
return {
|
|
93
106
|
...containerStyle,
|
|
94
107
|
opacity: Number(shouldShow),
|
|
95
108
|
};
|
|
96
|
-
}, [hovered, shouldShowInitially, player.playing]);
|
|
109
|
+
}, [hovered, shouldShowInitially, player.playing, alwaysShowControls]);
|
|
97
110
|
(0, react_1.useEffect)(() => {
|
|
98
111
|
if (playButtonRef.current && spaceKeyToPlayOrPause) {
|
|
99
112
|
// This switches focus to play button when player.playing flag changes
|
|
@@ -125,13 +138,13 @@ const Controls = ({ durationInFrames, hovered, isFullscreen, fps, player, showVo
|
|
|
125
138
|
color: 'white',
|
|
126
139
|
fontFamily: 'sans-serif',
|
|
127
140
|
fontSize: 14,
|
|
128
|
-
maxWidth: maxTimeLabelWidth,
|
|
141
|
+
maxWidth: maxTimeLabelWidth === null ? undefined : maxTimeLabelWidth,
|
|
129
142
|
overflow: 'hidden',
|
|
130
143
|
textOverflow: 'ellipsis',
|
|
131
144
|
};
|
|
132
145
|
}, [maxTimeLabelWidth]);
|
|
133
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: containerCss, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlsRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftPartStyle, children: [(0, jsx_runtime_1.jsx)("button", { ref: playButtonRef, type: "button", style: buttonStyle, onClick: player.playing ? player.pause : player.play, "aria-label": player.playing ? 'Pause video' : 'Play video', title: player.playing ? 'Pause video' : 'Play video', children:
|
|
146
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: containerCss, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlsRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftPartStyle, children: [(0, jsx_runtime_1.jsx)("button", { ref: playButtonRef, type: "button", style: buttonStyle, 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)(PlayPauseButton, { playing: player.playing })) : (renderPlayPauseButton({ 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, { 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 }), (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: buttonStyle, onClick: isFullscreen
|
|
134
147
|
? onExitFullscreenButtonClick
|
|
135
|
-
: onFullscreenButtonClick, children: (0, jsx_runtime_1.jsx)(
|
|
148
|
+
: 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 })] }));
|
|
136
149
|
};
|
|
137
150
|
exports.Controls = Controls;
|
|
File without changes
|
|
@@ -4,9 +4,9 @@ exports.PlayerSeekBar = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
8
|
+
const use_player_js_1 = require("./use-player.js");
|
|
9
|
+
const use_element_size_js_1 = require("./utils/use-element-size.js");
|
|
10
10
|
const getFrameFromX = (clientX, durationInFrames, width) => {
|
|
11
11
|
var _a;
|
|
12
12
|
const pos = clientX;
|
|
@@ -43,12 +43,12 @@ const findBodyInWhichDivIsLocated = (div) => {
|
|
|
43
43
|
};
|
|
44
44
|
const PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
|
|
45
45
|
const containerRef = (0, react_1.useRef)(null);
|
|
46
|
-
const barHovered = (0,
|
|
47
|
-
const size = (0,
|
|
46
|
+
const barHovered = (0, use_hover_state_js_1.useHoverState)(containerRef);
|
|
47
|
+
const size = (0, use_element_size_js_1.useElementSize)(containerRef, {
|
|
48
48
|
triggerOnWindowResize: true,
|
|
49
49
|
shouldApplyCssTransforms: true,
|
|
50
50
|
});
|
|
51
|
-
const { seek, play, pause, playing } = (0,
|
|
51
|
+
const { seek, play, pause, playing } = (0, use_player_js_1.usePlayer)();
|
|
52
52
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
53
53
|
const [dragging, setDragging] = (0, react_1.useState)({
|
|
54
54
|
dragging: false,
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PlayerRef } from './player-methods';
|
|
2
|
+
import type { PlayerRef } from './player-methods.js';
|
|
3
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
3
4
|
export declare type ErrorFallback = (info: {
|
|
4
5
|
error: Error;
|
|
5
6
|
}) => React.ReactNode;
|
|
6
7
|
export declare type RenderLoading = (canvas: {
|
|
7
8
|
height: number;
|
|
8
9
|
width: number;
|
|
9
|
-
}) => React.
|
|
10
|
+
}) => React.ReactNode;
|
|
10
11
|
export declare type RenderPoster = RenderLoading;
|
|
11
|
-
declare const _default:
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
|
12
13
|
controls: boolean;
|
|
13
14
|
loop: boolean;
|
|
14
15
|
autoPlay: boolean;
|
|
15
16
|
allowFullscreen: boolean;
|
|
16
17
|
inputProps: unknown;
|
|
17
18
|
showVolumeControls: boolean;
|
|
18
|
-
mediaMuted: boolean;
|
|
19
19
|
style?: React.CSSProperties | undefined;
|
|
20
20
|
clickToPlay: boolean;
|
|
21
21
|
doubleClickToFullscreen: boolean;
|
|
22
22
|
spaceKeyToPlayOrPause: boolean;
|
|
23
|
-
setMediaVolume: (v: number) => void;
|
|
24
|
-
setMediaMuted: (v: boolean) => void;
|
|
25
|
-
mediaVolume: number;
|
|
26
23
|
errorFallback: ErrorFallback;
|
|
27
24
|
playbackRate: number;
|
|
28
25
|
renderLoading: RenderLoading | undefined;
|
|
@@ -35,5 +32,8 @@ declare const _default: (props: {
|
|
|
35
32
|
inFrame: number | null;
|
|
36
33
|
outFrame: number | null;
|
|
37
34
|
initiallyShowControls: number | boolean;
|
|
38
|
-
|
|
35
|
+
renderPlayPauseButton: RenderPlayPauseButton | null;
|
|
36
|
+
renderFullscreen: RenderFullscreenButton | null;
|
|
37
|
+
alwaysShowControls: boolean;
|
|
38
|
+
} & React.RefAttributes<PlayerRef>>;
|
|
39
39
|
export default _default;
|