@remotion/player 4.0.150 → 4.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/MediaVolumeSlider.js +129 -205
- package/dist/cjs/icons.js +19 -113
- package/package.json +2 -2
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/BufferingIndicator.d.ts +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/BufferingIndicator.js +0 -38
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/DefaultPlayPauseButton.d.ts +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/DefaultPlayPauseButton.js +0 -12
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/EmitterProvider.d.ts +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/EmitterProvider.js +0 -20
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/MediaVolumeSlider.d.ts +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/MediaVolumeSlider.js +0 -129
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlaybackrateControl.d.ts +0 -8
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlaybackrateControl.js +0 -156
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/Player.d.ts +0 -59
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/Player.js +0 -146
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerControls.d.ts +0 -47
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerControls.js +0 -176
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerSeekBar.d.ts +0 -8
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerSeekBar.js +0 -145
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerUI.d.ts +0 -46
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/PlayerUI.js +0 -370
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/SharedPlayerContext.d.ts +0 -15
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/SharedPlayerContext.js +0 -55
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/Thumbnail.d.ts +0 -23
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/Thumbnail.js +0 -48
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/ThumbnailUI.d.ts +0 -11
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/ThumbnailUI.js +0 -89
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/calculate-next-frame.d.ts +0 -14
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/calculate-next-frame.js +0 -24
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/calculate-scale.d.ts +0 -50
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/calculate-scale.js +0 -72
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/emitter-context.d.ts +0 -4
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/emitter-context.js +0 -3
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/error-boundary.d.ts +0 -19
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/error-boundary.js +0 -32
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/event-emitter.d.ts +0 -91
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/event-emitter.js +0 -114
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/format-time.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/format-time.js +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/icons.d.ts +0 -10
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/icons.js +0 -39
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/index.d.ts +0 -65
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/index.js +0 -23
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/is-backgrounded.d.ts +0 -2
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/is-backgrounded.js +0 -20
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/player-css-classname.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/player-css-classname.js +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/player-methods.d.ts +0 -25
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/player-methods.js +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/index.test.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/index.test.js +0 -7
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/test-utils.d.ts +0 -6
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/test-utils.js +0 -14
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/validate-in-out-frames.test.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/validate-in-out-frames.test.js +0 -54
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/validate-prop.test.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/test/validate-prop.test.js +0 -129
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-buffer-state-emitter.d.ts +0 -2
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-buffer-state-emitter.js +0 -22
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-hover-state.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-hover-state.js +0 -43
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-playback.d.ts +0 -8
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-playback.js +0 -157
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-player.d.ts +0 -24
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-player.js +0 -157
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-thumbnail.d.ts +0 -6
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-thumbnail.js +0 -14
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-video-controls-resize.d.ts +0 -11
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/use-video-controls-resize.js +0 -35
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/calculate-player-size.d.ts +0 -9
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/calculate-player-size.js +0 -24
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/cancellable-promise.d.ts +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/cancellable-promise.js +0 -22
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/delay.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/delay.js +0 -2
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/is-node.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/is-node.js +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/props-if-has-props.d.ts +0 -10
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/props-if-has-props.js +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-cancellable-promises.d.ts +0 -7
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-cancellable-promises.js +0 -18
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-click-prevention-on-double-click.d.ts +0 -3
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-click-prevention-on-double-click.js +0 -41
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-component-visible.d.ts +0 -6
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-component-visible.js +0 -18
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-element-size.d.ts +0 -16
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/use-element-size.js +0 -127
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/validate-in-out-frame.d.ts +0 -6
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/validate-in-out-frame.js +0 -49
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/validate-initial-frame.d.ts +0 -4
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/validate-initial-frame.js +0 -23
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/validate-playbackrate.d.ts +0 -1
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/utils/validate-playbackrate.js +0 -14
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/validate.d.ts +0 -5
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/validate.js +0 -6
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/volume-persistance.d.ts +0 -2
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/volume-persistance.js +0 -29
- package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/tsconfig-esm.tsbuildinfo +0 -1
|
@@ -1,172 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const __setModuleDefault =
|
|
27
|
-
(this && this.__setModuleDefault) ||
|
|
28
|
-
(Object.create
|
|
29
|
-
? function (o, v) {
|
|
30
|
-
Object.defineProperty(o, 'default', {enumerable: true, value: v});
|
|
31
|
-
}
|
|
32
|
-
: function (o, v) {
|
|
33
|
-
o.default = v;
|
|
34
|
-
});
|
|
35
|
-
const __importStar =
|
|
36
|
-
(this && this.__importStar) ||
|
|
37
|
-
function (mod) {
|
|
38
|
-
if (mod && mod.__esModule) return mod;
|
|
39
|
-
const result = {};
|
|
40
|
-
if (mod != null)
|
|
41
|
-
for (const k in mod)
|
|
42
|
-
if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k))
|
|
43
|
-
__createBinding(result, mod, k);
|
|
44
|
-
__setModuleDefault(result, mod);
|
|
45
|
-
return result;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
Object.defineProperty(exports, '__esModule', {value: true});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
26
|
exports.MediaVolumeSlider = exports.VOLUME_SLIDER_WIDTH = void 0;
|
|
50
|
-
const jsx_runtime_1 = require(
|
|
51
|
-
const react_1 = __importStar(require(
|
|
52
|
-
const remotion_1 = require(
|
|
53
|
-
const icons_js_1 = require(
|
|
54
|
-
const use_hover_state_js_1 = require(
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const remotion_1 = require("remotion");
|
|
30
|
+
const icons_js_1 = require("./icons.js");
|
|
31
|
+
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
55
32
|
const BAR_HEIGHT = 5;
|
|
56
33
|
const KNOB_SIZE = 12;
|
|
57
34
|
exports.VOLUME_SLIDER_WIDTH = 100;
|
|
58
|
-
const MediaVolumeSlider = ({displayVerticalVolumeSlider}) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
...common,
|
|
145
|
-
};
|
|
146
|
-
}, [displayVerticalVolumeSlider]);
|
|
147
|
-
const inputStyle = (0, react_1.useMemo)(() => {
|
|
148
|
-
const commonStyle = {
|
|
149
|
-
WebkitAppearance: 'none',
|
|
150
|
-
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
|
151
|
-
borderRadius: BAR_HEIGHT / 2,
|
|
152
|
-
cursor: 'pointer',
|
|
153
|
-
height: BAR_HEIGHT,
|
|
154
|
-
width: exports.VOLUME_SLIDER_WIDTH,
|
|
155
|
-
backgroundImage: `linear-gradient(
|
|
35
|
+
const MediaVolumeSlider = ({ displayVerticalVolumeSlider }) => {
|
|
36
|
+
const [mediaMuted, setMediaMuted] = remotion_1.Internals.useMediaMutedState();
|
|
37
|
+
const [mediaVolume, setMediaVolume] = remotion_1.Internals.useMediaVolumeState();
|
|
38
|
+
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
39
|
+
const parentDivRef = (0, react_1.useRef)(null);
|
|
40
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
41
|
+
const hover = (0, use_hover_state_js_1.useHoverState)(parentDivRef, false);
|
|
42
|
+
// Need to import it from React to fix React 17 ESM support.
|
|
43
|
+
const randomId =
|
|
44
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
45
|
+
typeof react_1.default.useId === 'undefined' ? 'volume-slider' : react_1.default.useId();
|
|
46
|
+
const [randomClass] = (0, react_1.useState)(() => `__remotion-volume-slider-${(0, remotion_1.random)(randomId)}`.replace('.', ''));
|
|
47
|
+
const isMutedOrZero = mediaMuted || mediaVolume === 0;
|
|
48
|
+
const onVolumeChange = (0, react_1.useCallback)((e) => {
|
|
49
|
+
setMediaVolume(parseFloat(e.target.value));
|
|
50
|
+
}, [setMediaVolume]);
|
|
51
|
+
const onBlur = () => {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
// We need a small delay to check which element was focused next,
|
|
54
|
+
// and if it wasn't the volume slider, we hide it
|
|
55
|
+
if (document.activeElement !== inputRef.current) {
|
|
56
|
+
setFocused(false);
|
|
57
|
+
}
|
|
58
|
+
}, 10);
|
|
59
|
+
};
|
|
60
|
+
const isVolume0 = mediaVolume === 0;
|
|
61
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
62
|
+
if (isVolume0) {
|
|
63
|
+
setMediaVolume(1);
|
|
64
|
+
setMediaMuted(false);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setMediaMuted((mute) => !mute);
|
|
68
|
+
}, [isVolume0, setMediaMuted, setMediaVolume]);
|
|
69
|
+
const parentDivStyle = (0, react_1.useMemo)(() => {
|
|
70
|
+
return {
|
|
71
|
+
display: 'inline-flex',
|
|
72
|
+
background: 'none',
|
|
73
|
+
border: 'none',
|
|
74
|
+
justifyContent: 'center',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
touchAction: 'none',
|
|
77
|
+
...(displayVerticalVolumeSlider && { position: 'relative' }),
|
|
78
|
+
};
|
|
79
|
+
}, [displayVerticalVolumeSlider]);
|
|
80
|
+
const volumeContainer = (0, react_1.useMemo)(() => {
|
|
81
|
+
return {
|
|
82
|
+
display: 'inline',
|
|
83
|
+
width: icons_js_1.ICON_SIZE,
|
|
84
|
+
height: icons_js_1.ICON_SIZE,
|
|
85
|
+
cursor: 'pointer',
|
|
86
|
+
appearance: 'none',
|
|
87
|
+
background: 'none',
|
|
88
|
+
border: 'none',
|
|
89
|
+
padding: 0,
|
|
90
|
+
};
|
|
91
|
+
}, []);
|
|
92
|
+
const sliderContainer = (0, react_1.useMemo)(() => {
|
|
93
|
+
const paddingLeft = 5;
|
|
94
|
+
const common = {
|
|
95
|
+
paddingLeft,
|
|
96
|
+
height: icons_js_1.ICON_SIZE,
|
|
97
|
+
width: exports.VOLUME_SLIDER_WIDTH,
|
|
98
|
+
};
|
|
99
|
+
if (displayVerticalVolumeSlider) {
|
|
100
|
+
return {
|
|
101
|
+
...common,
|
|
102
|
+
position: 'absolute',
|
|
103
|
+
transform: `rotate(-90deg) translateX(${exports.VOLUME_SLIDER_WIDTH / 2 + icons_js_1.ICON_SIZE / 2}px)`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
...common,
|
|
108
|
+
};
|
|
109
|
+
}, [displayVerticalVolumeSlider]);
|
|
110
|
+
const inputStyle = (0, react_1.useMemo)(() => {
|
|
111
|
+
const commonStyle = {
|
|
112
|
+
WebkitAppearance: 'none',
|
|
113
|
+
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
|
114
|
+
borderRadius: BAR_HEIGHT / 2,
|
|
115
|
+
cursor: 'pointer',
|
|
116
|
+
height: BAR_HEIGHT,
|
|
117
|
+
width: exports.VOLUME_SLIDER_WIDTH,
|
|
118
|
+
backgroundImage: `linear-gradient(
|
|
156
119
|
to right,
|
|
157
120
|
white ${mediaVolume * 100}%, rgba(255, 255, 255, 0) ${mediaVolume * 100}%
|
|
158
121
|
)`,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const sliderStyle = `
|
|
122
|
+
};
|
|
123
|
+
if (displayVerticalVolumeSlider) {
|
|
124
|
+
return {
|
|
125
|
+
...commonStyle,
|
|
126
|
+
bottom: icons_js_1.ICON_SIZE + exports.VOLUME_SLIDER_WIDTH / 2,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return commonStyle;
|
|
130
|
+
}, [displayVerticalVolumeSlider, mediaVolume]);
|
|
131
|
+
const sliderStyle = `
|
|
170
132
|
.${randomClass}::-webkit-slider-thumb {
|
|
171
133
|
-webkit-appearance: none;
|
|
172
134
|
background-color: white;
|
|
@@ -185,48 +147,10 @@ const MediaVolumeSlider = ({displayVerticalVolumeSlider}) => {
|
|
|
185
147
|
width: ${KNOB_SIZE}px;
|
|
186
148
|
}
|
|
187
149
|
`;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// eslint-disable-next-line react/no-danger
|
|
194
|
-
dangerouslySetInnerHTML: {
|
|
195
|
-
__html: sliderStyle,
|
|
196
|
-
},
|
|
197
|
-
}),
|
|
198
|
-
(0, jsx_runtime_1.jsx)('button', {
|
|
199
|
-
'aria-label': isMutedOrZero ? 'Unmute sound' : 'Mute sound',
|
|
200
|
-
title: isMutedOrZero ? 'Unmute sound' : 'Mute sound',
|
|
201
|
-
onClick,
|
|
202
|
-
onBlur,
|
|
203
|
-
onFocus: () => setFocused(true),
|
|
204
|
-
style: volumeContainer,
|
|
205
|
-
type: 'button',
|
|
206
|
-
children: isMutedOrZero
|
|
207
|
-
? (0, jsx_runtime_1.jsx)(icons_js_1.VolumeOffIcon, {})
|
|
208
|
-
: (0, jsx_runtime_1.jsx)(icons_js_1.VolumeOnIcon, {}),
|
|
209
|
-
}),
|
|
210
|
-
(focused || hover) && !mediaMuted && !remotion_1.Internals.isIosSafari()
|
|
211
|
-
? (0, jsx_runtime_1.jsx)('div', {
|
|
212
|
-
style: sliderContainer,
|
|
213
|
-
children: (0, jsx_runtime_1.jsx)('input', {
|
|
214
|
-
ref: inputRef,
|
|
215
|
-
'aria-label': 'Change volume',
|
|
216
|
-
className: randomClass,
|
|
217
|
-
max: 1,
|
|
218
|
-
min: 0,
|
|
219
|
-
onBlur: () => setFocused(false),
|
|
220
|
-
onChange: onVolumeChange,
|
|
221
|
-
step: 0.01,
|
|
222
|
-
type: 'range',
|
|
223
|
-
value: mediaVolume,
|
|
224
|
-
style: inputStyle,
|
|
225
|
-
}),
|
|
226
|
-
})
|
|
227
|
-
: null,
|
|
228
|
-
],
|
|
229
|
-
});
|
|
150
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: parentDivRef, style: parentDivStyle, children: [(0, jsx_runtime_1.jsx)("style", {
|
|
151
|
+
// eslint-disable-next-line react/no-danger
|
|
152
|
+
dangerouslySetInnerHTML: {
|
|
153
|
+
__html: sliderStyle,
|
|
154
|
+
} }), (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 && !remotion_1.Internals.isIosSafari() ? ((0, jsx_runtime_1.jsx)("div", { style: sliderContainer, children: (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] }));
|
|
230
155
|
};
|
|
231
|
-
|
|
232
156
|
exports.MediaVolumeSlider = MediaVolumeSlider;
|
package/dist/cjs/icons.js
CHANGED
|
@@ -1,141 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.VolumeOnIcon =
|
|
4
|
-
|
|
5
|
-
exports.FullscreenIcon =
|
|
6
|
-
exports.PauseIcon =
|
|
7
|
-
exports.PlayIcon =
|
|
8
|
-
exports.fullscreenIconSize =
|
|
9
|
-
exports.ICON_SIZE =
|
|
10
|
-
void 0;
|
|
11
|
-
const jsx_runtime_1 = require('react/jsx-runtime');
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolumeOnIcon = exports.VolumeOffIcon = exports.FullscreenIcon = exports.PauseIcon = exports.PlayIcon = exports.fullscreenIconSize = exports.ICON_SIZE = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
12
5
|
exports.ICON_SIZE = 25;
|
|
13
6
|
exports.fullscreenIconSize = 16;
|
|
14
7
|
const PlayIcon = () => {
|
|
15
|
-
|
|
16
|
-
width: exports.ICON_SIZE,
|
|
17
|
-
height: exports.ICON_SIZE,
|
|
18
|
-
viewBox: '0 0 25 25',
|
|
19
|
-
fill: 'none',
|
|
20
|
-
children: (0, jsx_runtime_1.jsx)('path', {
|
|
21
|
-
d: 'M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z',
|
|
22
|
-
fill: 'white',
|
|
23
|
-
stroke: 'white',
|
|
24
|
-
strokeWidth: '6.25',
|
|
25
|
-
strokeLinejoin: 'round',
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 25 25", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z", fill: "white", stroke: "white", strokeWidth: "6.25", strokeLinejoin: "round" }) }));
|
|
28
9
|
};
|
|
29
|
-
|
|
30
10
|
exports.PlayIcon = PlayIcon;
|
|
31
11
|
const PauseIcon = () => {
|
|
32
|
-
|
|
33
|
-
viewBox: '0 0 100 100',
|
|
34
|
-
width: exports.ICON_SIZE,
|
|
35
|
-
height: exports.ICON_SIZE,
|
|
36
|
-
children: [
|
|
37
|
-
(0, jsx_runtime_1.jsx)('rect', {
|
|
38
|
-
x: '25',
|
|
39
|
-
y: '20',
|
|
40
|
-
width: '20',
|
|
41
|
-
height: '60',
|
|
42
|
-
fill: '#fff',
|
|
43
|
-
ry: '5',
|
|
44
|
-
rx: '5',
|
|
45
|
-
}),
|
|
46
|
-
(0, jsx_runtime_1.jsx)('rect', {
|
|
47
|
-
x: '55',
|
|
48
|
-
y: '20',
|
|
49
|
-
width: '20',
|
|
50
|
-
height: '60',
|
|
51
|
-
fill: '#fff',
|
|
52
|
-
ry: '5',
|
|
53
|
-
rx: '5',
|
|
54
|
-
}),
|
|
55
|
-
],
|
|
56
|
-
});
|
|
12
|
+
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" })] }));
|
|
57
13
|
};
|
|
58
|
-
|
|
59
14
|
exports.PauseIcon = PauseIcon;
|
|
60
|
-
const FullscreenIcon = ({isFullscreen}) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
viewBox: `0 0 ${viewSize} ${viewSize}`,
|
|
68
|
-
height: exports.fullscreenIconSize,
|
|
69
|
-
width: exports.fullscreenIconSize,
|
|
70
|
-
children: [
|
|
71
|
-
(0, jsx_runtime_1.jsx)('path', {
|
|
72
|
-
d: `
|
|
15
|
+
const FullscreenIcon = ({ isFullscreen, }) => {
|
|
16
|
+
const strokeWidth = 6;
|
|
17
|
+
const viewSize = 32;
|
|
18
|
+
const out = isFullscreen ? 0 : strokeWidth / 2;
|
|
19
|
+
const middleInset = isFullscreen ? strokeWidth * 1.6 : strokeWidth / 2;
|
|
20
|
+
const inset = isFullscreen ? strokeWidth * 1.6 : strokeWidth * 2;
|
|
21
|
+
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: `
|
|
73
22
|
M ${out} ${inset}
|
|
74
23
|
L ${middleInset} ${middleInset}
|
|
75
24
|
L ${inset} ${out}
|
|
76
|
-
`,
|
|
77
|
-
stroke: '#fff',
|
|
78
|
-
strokeWidth,
|
|
79
|
-
fill: 'none',
|
|
80
|
-
}),
|
|
81
|
-
(0, jsx_runtime_1.jsx)('path', {
|
|
82
|
-
d: `
|
|
25
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
83
26
|
M ${viewSize - out} ${inset}
|
|
84
27
|
L ${viewSize - middleInset} ${middleInset}
|
|
85
28
|
L ${viewSize - inset} ${out}
|
|
86
|
-
`,
|
|
87
|
-
stroke: '#fff',
|
|
88
|
-
strokeWidth,
|
|
89
|
-
fill: 'none',
|
|
90
|
-
}),
|
|
91
|
-
(0, jsx_runtime_1.jsx)('path', {
|
|
92
|
-
d: `
|
|
29
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
93
30
|
M ${out} ${viewSize - inset}
|
|
94
31
|
L ${middleInset} ${viewSize - middleInset}
|
|
95
32
|
L ${inset} ${viewSize - out}
|
|
96
|
-
`,
|
|
97
|
-
stroke: '#fff',
|
|
98
|
-
strokeWidth,
|
|
99
|
-
fill: 'none',
|
|
100
|
-
}),
|
|
101
|
-
(0, jsx_runtime_1.jsx)('path', {
|
|
102
|
-
d: `
|
|
33
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
103
34
|
M ${viewSize - out} ${viewSize - inset}
|
|
104
35
|
L ${viewSize - middleInset} ${viewSize - middleInset}
|
|
105
36
|
L ${viewSize - inset} ${viewSize - out}
|
|
106
|
-
`,
|
|
107
|
-
stroke: '#fff',
|
|
108
|
-
strokeWidth,
|
|
109
|
-
fill: 'none',
|
|
110
|
-
}),
|
|
111
|
-
],
|
|
112
|
-
});
|
|
37
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" })] }));
|
|
113
38
|
};
|
|
114
|
-
|
|
115
39
|
exports.FullscreenIcon = FullscreenIcon;
|
|
116
40
|
const VolumeOffIcon = () => {
|
|
117
|
-
|
|
118
|
-
width: exports.ICON_SIZE,
|
|
119
|
-
height: exports.ICON_SIZE,
|
|
120
|
-
viewBox: '0 0 24 24',
|
|
121
|
-
children: (0, jsx_runtime_1.jsx)('path', {
|
|
122
|
-
d: 'M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z',
|
|
123
|
-
fill: '#fff',
|
|
124
|
-
}),
|
|
125
|
-
});
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { d: "M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z", fill: "#fff" }) }));
|
|
126
42
|
};
|
|
127
|
-
|
|
128
43
|
exports.VolumeOffIcon = VolumeOffIcon;
|
|
129
44
|
const VolumeOnIcon = () => {
|
|
130
|
-
|
|
131
|
-
width: exports.ICON_SIZE,
|
|
132
|
-
height: exports.ICON_SIZE,
|
|
133
|
-
viewBox: '0 0 24 24',
|
|
134
|
-
children: (0, jsx_runtime_1.jsx)('path', {
|
|
135
|
-
d: 'M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z',
|
|
136
|
-
fill: '#fff',
|
|
137
|
-
}),
|
|
138
|
-
});
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { d: "M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z", fill: "#fff" }) }));
|
|
139
46
|
};
|
|
140
|
-
|
|
141
47
|
exports.VolumeOnIcon = VolumeOnIcon;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/player",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.151",
|
|
4
4
|
"description": "Remotion Player",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"remotion": "4.0.
|
|
31
|
+
"remotion": "4.0.151"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=16.8.0",
|
package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/BufferingIndicator.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ICON_SIZE } from './icons.js';
|
|
3
|
-
const className = '__remotion_buffering_indicator';
|
|
4
|
-
const remotionBufferingAnimation = '__remotion_buffering_animation';
|
|
5
|
-
export const bufferingIndicatorStrokeWidth = 3;
|
|
6
|
-
const playerStyle = {
|
|
7
|
-
width: ICON_SIZE,
|
|
8
|
-
height: ICON_SIZE,
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
lineHeight: 'normal',
|
|
11
|
-
fontSize: 'inherit',
|
|
12
|
-
};
|
|
13
|
-
const studioStyle = {
|
|
14
|
-
width: 14,
|
|
15
|
-
height: 14,
|
|
16
|
-
overflow: 'hidden',
|
|
17
|
-
lineHeight: 'normal',
|
|
18
|
-
fontSize: 'inherit',
|
|
19
|
-
};
|
|
20
|
-
export const BufferingIndicator = ({ type }) => {
|
|
21
|
-
const style = type === 'player' ? playerStyle : studioStyle;
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx("style", { type: "text/css", children: `
|
|
23
|
-
@keyframes ${remotionBufferingAnimation} {
|
|
24
|
-
0% {
|
|
25
|
-
rotate: 0deg;
|
|
26
|
-
}
|
|
27
|
-
100% {
|
|
28
|
-
rotate: 360deg;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.${className} {
|
|
33
|
-
animation: ${remotionBufferingAnimation} 1s linear infinite;
|
|
34
|
-
}
|
|
35
|
-
` }), _jsx("div", { style: style, children: _jsx("svg", { viewBox: type === 'player' ? '0 0 22 22' : '0 0 18 18', style: style, className: className, children: _jsx("path", { d: type === 'player'
|
|
36
|
-
? 'M 11 4 A 7 7 0 0 1 15.1145 16.66312'
|
|
37
|
-
: 'M 9 2 A 7 7 0 0 1 13.1145 14.66312', stroke: "white", strokeLinecap: "round", fill: "none", strokeWidth: 3 }) }) })] }));
|
|
38
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BufferingIndicator } from './BufferingIndicator.js';
|
|
3
|
-
import { PauseIcon, PlayIcon } from './icons.js';
|
|
4
|
-
export const DefaultPlayPauseButton = ({ playing, buffering }) => {
|
|
5
|
-
if (playing && buffering) {
|
|
6
|
-
return _jsx(BufferingIndicator, { type: "player" });
|
|
7
|
-
}
|
|
8
|
-
if (playing) {
|
|
9
|
-
return _jsx(PauseIcon, {});
|
|
10
|
-
}
|
|
11
|
-
return _jsx(PlayIcon, {});
|
|
12
|
-
};
|
package/.rollup.cache/Users/jonathanburger/remotion/packages/player/dist/esm/EmitterProvider.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useEffect, useState } from 'react';
|
|
3
|
-
import { Internals } from 'remotion';
|
|
4
|
-
import { PlayerEventEmitterContext } from './emitter-context.js';
|
|
5
|
-
import { PlayerEmitter } from './event-emitter.js';
|
|
6
|
-
import { useBufferStateEmitter } from './use-buffer-state-emitter.js';
|
|
7
|
-
export const PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
|
|
8
|
-
const [emitter] = useState(() => new PlayerEmitter());
|
|
9
|
-
const bufferManager = useContext(Internals.BufferingContextReact);
|
|
10
|
-
if (!bufferManager) {
|
|
11
|
-
throw new Error('BufferingContextReact not found');
|
|
12
|
-
}
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (currentPlaybackRate) {
|
|
15
|
-
emitter.dispatchRateChange(currentPlaybackRate);
|
|
16
|
-
}
|
|
17
|
-
}, [emitter, currentPlaybackRate]);
|
|
18
|
-
useBufferStateEmitter(emitter);
|
|
19
|
-
return (_jsx(PlayerEventEmitterContext.Provider, { value: emitter, children: children }));
|
|
20
|
-
};
|