@remotion/player 4.0.428 → 4.0.429
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/README.md +7 -7
- package/dist/cjs/Player.d.ts +2 -2
- package/dist/cjs/Player.js +1 -1
- package/dist/cjs/PlayerControls.js +1 -1
- package/dist/cjs/PlayerUI.d.ts +2 -2
- package/dist/cjs/PlayerUI.js +1 -1
- package/dist/cjs/browser-mediasession.js +7 -1
- package/dist/cjs/render-volume-slider.js +1 -1
- package/dist/esm/index.mjs +214 -208
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @remotion/player
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
React component for embedding a Remotion preview into your app
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
[](https://npmcharts.com/compare/@remotion/player?minimal=true)
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
## Installation
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
```bash
|
|
10
10
|
npm install @remotion/player --save-exact
|
|
11
11
|
```
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.
|
|
14
14
|
Remove the `^` character from the version number to use the exact version.
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
## Usage
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
See the [documentation](https://www.remotion.dev/docs/player) for more information.
|
package/dist/cjs/Player.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { AnyZodObject, CompProps, LogLevel } from 'remotion';
|
|
4
|
+
import type { BrowserMediaControlsBehavior } from './browser-mediasession.js';
|
|
4
5
|
import type { RenderMuteButton } from './MediaVolumeSlider.js';
|
|
6
|
+
import type { PlayerRef, RenderCustomControls } from './player-methods.js';
|
|
5
7
|
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
6
8
|
import type { PosterFillMode, RenderLoading, RenderPoster } from './PlayerUI.js';
|
|
7
|
-
import type { BrowserMediaControlsBehavior } from './browser-mediasession.js';
|
|
8
|
-
import type { PlayerRef, RenderCustomControls } from './player-methods.js';
|
|
9
9
|
import type { RenderVolumeSlider } from './render-volume-slider.js';
|
|
10
10
|
import type { PropsIfHasProps } from './utils/props-if-has-props.js';
|
|
11
11
|
export type ErrorFallback = (info: {
|
package/dist/cjs/Player.js
CHANGED
|
@@ -8,9 +8,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const remotion_1 = require("remotion");
|
|
10
10
|
const EmitterProvider_js_1 = require("./EmitterProvider.js");
|
|
11
|
+
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
11
12
|
const PlayerUI_js_1 = __importDefault(require("./PlayerUI.js"));
|
|
12
13
|
const SharedPlayerContext_js_1 = require("./SharedPlayerContext.js");
|
|
13
|
-
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
14
14
|
const use_remotion_license_acknowledge_js_1 = require("./use-remotion-license-acknowledge.js");
|
|
15
15
|
const validate_in_out_frame_js_1 = require("./utils/validate-in-out-frame.js");
|
|
16
16
|
const validate_initial_frame_js_1 = require("./utils/validate-initial-frame.js");
|
|
@@ -4,11 +4,11 @@ exports.Controls = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const DefaultPlayPauseButton_js_1 = require("./DefaultPlayPauseButton.js");
|
|
7
|
+
const icons_js_1 = require("./icons.js");
|
|
7
8
|
const MediaVolumeSlider_js_1 = require("./MediaVolumeSlider.js");
|
|
8
9
|
const PlaybackrateControl_js_1 = require("./PlaybackrateControl.js");
|
|
9
10
|
const PlayerSeekBar_js_1 = require("./PlayerSeekBar.js");
|
|
10
11
|
const PlayerTimeLabel_js_1 = require("./PlayerTimeLabel.js");
|
|
11
|
-
const icons_js_1 = require("./icons.js");
|
|
12
12
|
const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
13
13
|
const use_video_controls_resize_js_1 = require("./use-video-controls-resize.js");
|
|
14
14
|
const gradientSteps = [
|
package/dist/cjs/PlayerUI.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { RenderMuteButton } from './MediaVolumeSlider.js';
|
|
3
|
-
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
4
2
|
import type { BrowserMediaControlsBehavior } from './browser-mediasession.js';
|
|
3
|
+
import type { RenderMuteButton } from './MediaVolumeSlider.js';
|
|
5
4
|
import type { PlayerRef, RenderCustomControls } from './player-methods.js';
|
|
5
|
+
import type { RenderFullscreenButton, RenderPlayPauseButton } from './PlayerControls.js';
|
|
6
6
|
import type { RenderVolumeSlider } from './render-volume-slider.js';
|
|
7
7
|
export type ErrorFallback = (info: {
|
|
8
8
|
error: Error;
|
package/dist/cjs/PlayerUI.js
CHANGED
|
@@ -36,11 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
37
|
const react_1 = __importStar(require("react"));
|
|
38
38
|
const remotion_1 = require("remotion");
|
|
39
|
-
const PlayerControls_js_1 = require("./PlayerControls.js");
|
|
40
39
|
const calculate_scale_js_1 = require("./calculate-scale.js");
|
|
41
40
|
const error_boundary_js_1 = require("./error-boundary.js");
|
|
42
41
|
const license_blacklist_js_1 = require("./license-blacklist.js");
|
|
43
42
|
const player_css_classname_js_1 = require("./player-css-classname.js");
|
|
43
|
+
const PlayerControls_js_1 = require("./PlayerControls.js");
|
|
44
44
|
const use_playback_js_1 = require("./use-playback.js");
|
|
45
45
|
const use_player_js_1 = require("./use-player.js");
|
|
46
46
|
const is_node_js_1 = require("./utils/is-node.js");
|
|
@@ -5,6 +5,12 @@ const react_1 = require("react");
|
|
|
5
5
|
const use_player_js_1 = require("./use-player.js");
|
|
6
6
|
const useBrowserMediaSession = ({ browserMediaControlsBehavior, videoConfig, playbackRate, }) => {
|
|
7
7
|
const { playing, pause, play, emitter, getCurrentFrame, seek } = (0, use_player_js_1.usePlayer)();
|
|
8
|
+
const hasEverPlayed = (0, react_1.useRef)(false);
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
if (playing) {
|
|
11
|
+
hasEverPlayed.current = true;
|
|
12
|
+
}
|
|
13
|
+
}, [playing]);
|
|
8
14
|
(0, react_1.useEffect)(() => {
|
|
9
15
|
if (!navigator.mediaSession) {
|
|
10
16
|
return;
|
|
@@ -15,7 +21,7 @@ const useBrowserMediaSession = ({ browserMediaControlsBehavior, videoConfig, pla
|
|
|
15
21
|
if (playing) {
|
|
16
22
|
navigator.mediaSession.playbackState = 'playing';
|
|
17
23
|
}
|
|
18
|
-
else {
|
|
24
|
+
else if (hasEverPlayed.current) {
|
|
19
25
|
navigator.mediaSession.playbackState = 'paused';
|
|
20
26
|
}
|
|
21
27
|
}, [browserMediaControlsBehavior.mode, playing]);
|
|
@@ -37,8 +37,8 @@ exports.renderDefaultVolumeSlider = void 0;
|
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const remotion_1 = require("remotion");
|
|
40
|
-
const MediaVolumeSlider_1 = require("./MediaVolumeSlider");
|
|
41
40
|
const icons_1 = require("./icons");
|
|
41
|
+
const MediaVolumeSlider_1 = require("./MediaVolumeSlider");
|
|
42
42
|
const KNOB_SIZE = 12;
|
|
43
43
|
const BAR_HEIGHT = 5;
|
|
44
44
|
const DefaultVolumeSlider = ({ volume, isVertical, onBlur, inputRef, setVolume, }) => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -552,11 +552,11 @@ var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
|
|
|
552
552
|
};
|
|
553
553
|
|
|
554
554
|
// src/use-playback.ts
|
|
555
|
-
import { useContext as useContext4, useEffect as useEffect5, useRef as
|
|
555
|
+
import { useContext as useContext4, useEffect as useEffect5, useRef as useRef5 } from "react";
|
|
556
556
|
import { Internals as Internals6 } from "remotion";
|
|
557
557
|
|
|
558
558
|
// src/browser-mediasession.ts
|
|
559
|
-
import { useEffect as useEffect3 } from "react";
|
|
559
|
+
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
560
560
|
|
|
561
561
|
// src/use-player.ts
|
|
562
562
|
import { useCallback as useCallback2, useContext as useContext3, useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
@@ -741,6 +741,12 @@ var useBrowserMediaSession = ({
|
|
|
741
741
|
playbackRate
|
|
742
742
|
}) => {
|
|
743
743
|
const { playing, pause, play, emitter, getCurrentFrame, seek } = usePlayer();
|
|
744
|
+
const hasEverPlayed = useRef3(false);
|
|
745
|
+
useEffect3(() => {
|
|
746
|
+
if (playing) {
|
|
747
|
+
hasEverPlayed.current = true;
|
|
748
|
+
}
|
|
749
|
+
}, [playing]);
|
|
744
750
|
useEffect3(() => {
|
|
745
751
|
if (!navigator.mediaSession) {
|
|
746
752
|
return;
|
|
@@ -750,7 +756,7 @@ var useBrowserMediaSession = ({
|
|
|
750
756
|
}
|
|
751
757
|
if (playing) {
|
|
752
758
|
navigator.mediaSession.playbackState = "playing";
|
|
753
|
-
} else {
|
|
759
|
+
} else if (hasEverPlayed.current) {
|
|
754
760
|
navigator.mediaSession.playbackState = "paused";
|
|
755
761
|
}
|
|
756
762
|
}, [browserMediaControlsBehavior.mode, playing]);
|
|
@@ -874,7 +880,7 @@ var calculateNextFrame = ({
|
|
|
874
880
|
};
|
|
875
881
|
|
|
876
882
|
// src/is-backgrounded.ts
|
|
877
|
-
import { useEffect as useEffect4, useRef as
|
|
883
|
+
import { useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
878
884
|
var getIsBackgrounded = () => {
|
|
879
885
|
if (typeof document === "undefined") {
|
|
880
886
|
return false;
|
|
@@ -882,7 +888,7 @@ var getIsBackgrounded = () => {
|
|
|
882
888
|
return document.visibilityState === "hidden";
|
|
883
889
|
};
|
|
884
890
|
var useIsBackgrounded = () => {
|
|
885
|
-
const isBackgrounded =
|
|
891
|
+
const isBackgrounded = useRef4(getIsBackgrounded());
|
|
886
892
|
useEffect4(() => {
|
|
887
893
|
const onVisibilityChange = () => {
|
|
888
894
|
isBackgrounded.current = getIsBackgrounded();
|
|
@@ -910,7 +916,7 @@ var usePlayback = ({
|
|
|
910
916
|
const { playing, pause, emitter, isPlaying } = usePlayer();
|
|
911
917
|
const setFrame = Internals6.Timeline.useTimelineSetFrame();
|
|
912
918
|
const isBackgroundedRef = useIsBackgrounded();
|
|
913
|
-
const lastTimeUpdateEvent =
|
|
919
|
+
const lastTimeUpdateEvent = useRef5(null);
|
|
914
920
|
const context = useContext4(Internals6.BufferingContextReact);
|
|
915
921
|
if (!context) {
|
|
916
922
|
throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
|
|
@@ -1170,11 +1176,16 @@ import {
|
|
|
1170
1176
|
useImperativeHandle as useImperativeHandle2,
|
|
1171
1177
|
useLayoutEffect as useLayoutEffect2,
|
|
1172
1178
|
useMemo as useMemo14,
|
|
1173
|
-
useRef as
|
|
1179
|
+
useRef as useRef12,
|
|
1174
1180
|
useState as useState13
|
|
1175
1181
|
} from "react";
|
|
1176
1182
|
import { Composition, Internals as Internals15 } from "remotion";
|
|
1177
1183
|
|
|
1184
|
+
// src/player-css-classname.ts
|
|
1185
|
+
var playerCssClassname = (override) => {
|
|
1186
|
+
return override ?? "__remotion-player";
|
|
1187
|
+
};
|
|
1188
|
+
|
|
1178
1189
|
// src/PlayerUI.tsx
|
|
1179
1190
|
import React10, {
|
|
1180
1191
|
Suspense,
|
|
@@ -1184,36 +1195,158 @@ import React10, {
|
|
|
1184
1195
|
useEffect as useEffect12,
|
|
1185
1196
|
useImperativeHandle,
|
|
1186
1197
|
useMemo as useMemo12,
|
|
1187
|
-
useRef as
|
|
1198
|
+
useRef as useRef11,
|
|
1188
1199
|
useState as useState11
|
|
1189
1200
|
} from "react";
|
|
1190
1201
|
import { Internals as Internals11 } from "remotion";
|
|
1191
1202
|
|
|
1203
|
+
// src/error-boundary.tsx
|
|
1204
|
+
import React3 from "react";
|
|
1205
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1206
|
+
var errorStyle = {
|
|
1207
|
+
display: "flex",
|
|
1208
|
+
justifyContent: "center",
|
|
1209
|
+
alignItems: "center",
|
|
1210
|
+
flex: 1,
|
|
1211
|
+
height: "100%",
|
|
1212
|
+
width: "100%"
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1215
|
+
class ErrorBoundary extends React3.Component {
|
|
1216
|
+
state = { hasError: null };
|
|
1217
|
+
static getDerivedStateFromError(error) {
|
|
1218
|
+
return { hasError: error };
|
|
1219
|
+
}
|
|
1220
|
+
componentDidCatch(error) {
|
|
1221
|
+
this.props.onError(error);
|
|
1222
|
+
}
|
|
1223
|
+
render() {
|
|
1224
|
+
if (this.state.hasError) {
|
|
1225
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
1226
|
+
style: errorStyle,
|
|
1227
|
+
children: this.props.errorFallback({
|
|
1228
|
+
error: this.state.hasError
|
|
1229
|
+
})
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
return this.props.children;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// src/license-blacklist.tsx
|
|
1237
|
+
import React4, { useEffect as useEffect7 } from "react";
|
|
1238
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1239
|
+
var getHashOfDomain = async () => {
|
|
1240
|
+
if (typeof window === "undefined") {
|
|
1241
|
+
return null;
|
|
1242
|
+
}
|
|
1243
|
+
if (typeof window.crypto === "undefined") {
|
|
1244
|
+
return null;
|
|
1245
|
+
}
|
|
1246
|
+
if (typeof window.crypto.subtle === "undefined") {
|
|
1247
|
+
return null;
|
|
1248
|
+
}
|
|
1249
|
+
try {
|
|
1250
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(window.location.hostname));
|
|
1251
|
+
return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1252
|
+
} catch {
|
|
1253
|
+
return null;
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
var style = {
|
|
1257
|
+
backgroundColor: "red",
|
|
1258
|
+
position: "absolute",
|
|
1259
|
+
padding: 12,
|
|
1260
|
+
fontFamily: "Arial"
|
|
1261
|
+
};
|
|
1262
|
+
var DOMAIN_BLACKLIST = [
|
|
1263
|
+
"28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6",
|
|
1264
|
+
"4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e",
|
|
1265
|
+
"fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc",
|
|
1266
|
+
"7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83",
|
|
1267
|
+
"8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6",
|
|
1268
|
+
"a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"
|
|
1269
|
+
];
|
|
1270
|
+
var ran = false;
|
|
1271
|
+
var RenderWarningIfBlacklist = () => {
|
|
1272
|
+
const [unlicensed, setUnlicensed] = React4.useState(false);
|
|
1273
|
+
useEffect7(() => {
|
|
1274
|
+
if (ran) {
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
ran = true;
|
|
1278
|
+
getHashOfDomain().then((hash) => {
|
|
1279
|
+
if (hash && DOMAIN_BLACKLIST.includes(hash)) {
|
|
1280
|
+
setUnlicensed(true);
|
|
1281
|
+
}
|
|
1282
|
+
}).catch(() => {});
|
|
1283
|
+
}, []);
|
|
1284
|
+
useEffect7(() => {
|
|
1285
|
+
if (!unlicensed) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
const ensureBanner = () => {
|
|
1289
|
+
const banner = document.querySelector(".warning-banner");
|
|
1290
|
+
if (!banner) {
|
|
1291
|
+
const div = document.createElement("div");
|
|
1292
|
+
div.className = "warning-banner";
|
|
1293
|
+
Object.assign(div.style, style, {
|
|
1294
|
+
zIndex: "9999",
|
|
1295
|
+
cssText: `${style.cssText} !important;`
|
|
1296
|
+
});
|
|
1297
|
+
div.innerHTML = `
|
|
1298
|
+
<a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">
|
|
1299
|
+
Remotion Unlicensed – Contact hi@remotion.dev
|
|
1300
|
+
</a>
|
|
1301
|
+
`;
|
|
1302
|
+
document.body.appendChild(div);
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
const observer = new MutationObserver(() => ensureBanner());
|
|
1306
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1307
|
+
return () => {
|
|
1308
|
+
observer.disconnect();
|
|
1309
|
+
};
|
|
1310
|
+
}, [unlicensed]);
|
|
1311
|
+
if (!unlicensed) {
|
|
1312
|
+
return null;
|
|
1313
|
+
}
|
|
1314
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
1315
|
+
style,
|
|
1316
|
+
className: "warning-banner",
|
|
1317
|
+
children: /* @__PURE__ */ jsx5("a", {
|
|
1318
|
+
style: { color: "white" },
|
|
1319
|
+
href: "https://github.com/remotion-dev/remotion/pull/4589",
|
|
1320
|
+
children: "Remotion Unlicensed – Contact hi@remotion.dev"
|
|
1321
|
+
})
|
|
1322
|
+
});
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1192
1325
|
// src/PlayerControls.tsx
|
|
1193
|
-
import { useCallback as useCallback8, useEffect as
|
|
1326
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo9, useRef as useRef9, useState as useState10 } from "react";
|
|
1194
1327
|
|
|
1195
1328
|
// src/DefaultPlayPauseButton.tsx
|
|
1196
|
-
import { jsx as
|
|
1329
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1197
1330
|
var DefaultPlayPauseButton = ({ playing, buffering }) => {
|
|
1198
1331
|
if (playing && buffering) {
|
|
1199
|
-
return /* @__PURE__ */
|
|
1332
|
+
return /* @__PURE__ */ jsx6(BufferingIndicator, {
|
|
1200
1333
|
type: "player"
|
|
1201
1334
|
});
|
|
1202
1335
|
}
|
|
1203
1336
|
if (playing) {
|
|
1204
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ jsx6(PauseIcon, {});
|
|
1205
1338
|
}
|
|
1206
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ jsx6(PlayIcon, {});
|
|
1207
1340
|
};
|
|
1208
1341
|
|
|
1209
1342
|
// src/MediaVolumeSlider.tsx
|
|
1210
|
-
import { useCallback as useCallback5, useMemo as useMemo4, useRef as
|
|
1343
|
+
import { useCallback as useCallback5, useMemo as useMemo4, useRef as useRef6, useState as useState6 } from "react";
|
|
1211
1344
|
import { Internals as Internals7 } from "remotion";
|
|
1212
1345
|
|
|
1213
1346
|
// src/render-volume-slider.tsx
|
|
1214
|
-
import
|
|
1347
|
+
import React5, { useCallback as useCallback4, useMemo as useMemo3, useState as useState5 } from "react";
|
|
1215
1348
|
import { random } from "remotion";
|
|
1216
|
-
import { jsx as
|
|
1349
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1217
1350
|
var KNOB_SIZE = 12;
|
|
1218
1351
|
var BAR_HEIGHT = 5;
|
|
1219
1352
|
var DefaultVolumeSlider = ({
|
|
@@ -1243,7 +1376,7 @@ var DefaultVolumeSlider = ({
|
|
|
1243
1376
|
...common
|
|
1244
1377
|
};
|
|
1245
1378
|
}, [isVertical]);
|
|
1246
|
-
const randomId = typeof
|
|
1379
|
+
const randomId = typeof React5.useId === "undefined" ? "volume-slider" : React5.useId();
|
|
1247
1380
|
const [randomClass] = useState5(() => `__remotion-volume-slider-${random(randomId)}`.replace(".", ""));
|
|
1248
1381
|
const onVolumeChange = useCallback4((e) => {
|
|
1249
1382
|
setVolume(parseFloat(e.target.value));
|
|
@@ -1291,12 +1424,12 @@ var DefaultVolumeSlider = ({
|
|
|
1291
1424
|
return /* @__PURE__ */ jsxs3("div", {
|
|
1292
1425
|
style: sliderContainer,
|
|
1293
1426
|
children: [
|
|
1294
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ jsx7("style", {
|
|
1295
1428
|
dangerouslySetInnerHTML: {
|
|
1296
1429
|
__html: sliderStyle
|
|
1297
1430
|
}
|
|
1298
1431
|
}),
|
|
1299
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ jsx7("input", {
|
|
1300
1433
|
ref: inputRef,
|
|
1301
1434
|
"aria-label": "Change volume",
|
|
1302
1435
|
className: randomClass,
|
|
@@ -1313,20 +1446,20 @@ var DefaultVolumeSlider = ({
|
|
|
1313
1446
|
});
|
|
1314
1447
|
};
|
|
1315
1448
|
var renderDefaultVolumeSlider = (props) => {
|
|
1316
|
-
return /* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ jsx7(DefaultVolumeSlider, {
|
|
1317
1450
|
...props
|
|
1318
1451
|
});
|
|
1319
1452
|
};
|
|
1320
1453
|
|
|
1321
1454
|
// src/MediaVolumeSlider.tsx
|
|
1322
|
-
import { jsx as
|
|
1455
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1323
1456
|
var VOLUME_SLIDER_WIDTH = 100;
|
|
1324
1457
|
var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
|
|
1325
1458
|
const [mediaMuted, setMediaMuted] = Internals7.useMediaMutedState();
|
|
1326
1459
|
const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
|
|
1327
1460
|
const [focused, setFocused] = useState6(false);
|
|
1328
|
-
const parentDivRef =
|
|
1329
|
-
const inputRef =
|
|
1461
|
+
const parentDivRef = useRef6(null);
|
|
1462
|
+
const inputRef = useRef6(null);
|
|
1330
1463
|
const hover = useHoverState(parentDivRef, false);
|
|
1331
1464
|
const onBlur = useCallback5(() => {
|
|
1332
1465
|
setTimeout(() => {
|
|
@@ -1369,7 +1502,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1369
1502
|
}, []);
|
|
1370
1503
|
const renderDefaultMuteButton = useCallback5(({ muted, volume }) => {
|
|
1371
1504
|
const isMutedOrZero = muted || volume === 0;
|
|
1372
|
-
return /* @__PURE__ */
|
|
1505
|
+
return /* @__PURE__ */ jsx8("button", {
|
|
1373
1506
|
"aria-label": isMutedOrZero ? "Unmute sound" : "Mute sound",
|
|
1374
1507
|
title: isMutedOrZero ? "Unmute sound" : "Mute sound",
|
|
1375
1508
|
onClick,
|
|
@@ -1377,7 +1510,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1377
1510
|
onFocus: () => setFocused(true),
|
|
1378
1511
|
style: volumeContainer,
|
|
1379
1512
|
type: "button",
|
|
1380
|
-
children: isMutedOrZero ? /* @__PURE__ */
|
|
1513
|
+
children: isMutedOrZero ? /* @__PURE__ */ jsx8(VolumeOffIcon, {}) : /* @__PURE__ */ jsx8(VolumeOnIcon, {})
|
|
1381
1514
|
});
|
|
1382
1515
|
}, [onBlur, onClick, volumeContainer]);
|
|
1383
1516
|
const muteButton = useMemo4(() => {
|
|
@@ -1414,18 +1547,18 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
|
|
|
1414
1547
|
import {
|
|
1415
1548
|
useCallback as useCallback6,
|
|
1416
1549
|
useContext as useContext5,
|
|
1417
|
-
useEffect as
|
|
1550
|
+
useEffect as useEffect9,
|
|
1418
1551
|
useMemo as useMemo5,
|
|
1419
1552
|
useState as useState8
|
|
1420
1553
|
} from "react";
|
|
1421
1554
|
import { Internals as Internals8 } from "remotion";
|
|
1422
1555
|
|
|
1423
1556
|
// src/utils/use-component-visible.ts
|
|
1424
|
-
import { useEffect as
|
|
1557
|
+
import { useEffect as useEffect8, useRef as useRef7, useState as useState7 } from "react";
|
|
1425
1558
|
function useComponentVisible(initialIsVisible) {
|
|
1426
1559
|
const [isComponentVisible, setIsComponentVisible] = useState7(initialIsVisible);
|
|
1427
|
-
const ref =
|
|
1428
|
-
|
|
1560
|
+
const ref = useRef7(null);
|
|
1561
|
+
useEffect8(() => {
|
|
1429
1562
|
const handleClickOutside = (event) => {
|
|
1430
1563
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1431
1564
|
setIsComponentVisible(false);
|
|
@@ -1440,7 +1573,7 @@ function useComponentVisible(initialIsVisible) {
|
|
|
1440
1573
|
}
|
|
1441
1574
|
|
|
1442
1575
|
// src/PlaybackrateControl.tsx
|
|
1443
|
-
import { jsx as
|
|
1576
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1444
1577
|
var BOTTOM = 35;
|
|
1445
1578
|
var THRESHOLD = 70;
|
|
1446
1579
|
var rateDiv = {
|
|
@@ -1461,10 +1594,10 @@ var checkmarkStyle = {
|
|
|
1461
1594
|
height: 14,
|
|
1462
1595
|
color: "black"
|
|
1463
1596
|
};
|
|
1464
|
-
var Checkmark = () => /* @__PURE__ */
|
|
1597
|
+
var Checkmark = () => /* @__PURE__ */ jsx9("svg", {
|
|
1465
1598
|
viewBox: "0 0 512 512",
|
|
1466
1599
|
style: checkmarkStyle,
|
|
1467
|
-
children: /* @__PURE__ */
|
|
1600
|
+
children: /* @__PURE__ */ jsx9("path", {
|
|
1468
1601
|
fill: "currentColor",
|
|
1469
1602
|
d: "M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"
|
|
1470
1603
|
})
|
|
@@ -1500,9 +1633,9 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
|
|
|
1500
1633
|
style: actualStyle,
|
|
1501
1634
|
onClick,
|
|
1502
1635
|
children: [
|
|
1503
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx9("div", {
|
|
1504
1637
|
style: checkmarkContainer,
|
|
1505
|
-
children: rate === selectedRate ? /* @__PURE__ */
|
|
1638
|
+
children: rate === selectedRate ? /* @__PURE__ */ jsx9(Checkmark, {}) : null
|
|
1506
1639
|
}),
|
|
1507
1640
|
formatPlaybackRate(rate),
|
|
1508
1641
|
"x"
|
|
@@ -1512,7 +1645,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
|
|
|
1512
1645
|
var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
1513
1646
|
const { setPlaybackRate, playbackRate } = useContext5(Internals8.TimelineContext);
|
|
1514
1647
|
const [keyboardSelectedRate, setKeyboardSelectedRate] = useState8(playbackRate);
|
|
1515
|
-
|
|
1648
|
+
useEffect9(() => {
|
|
1516
1649
|
const listener = (e) => {
|
|
1517
1650
|
e.preventDefault();
|
|
1518
1651
|
if (e.key === "ArrowUp") {
|
|
@@ -1568,10 +1701,10 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
|
|
|
1568
1701
|
textAlign: "left"
|
|
1569
1702
|
};
|
|
1570
1703
|
}, [canvasSize.height]);
|
|
1571
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx9("div", {
|
|
1572
1705
|
style: playbackPopup,
|
|
1573
1706
|
children: playbackRates.map((rate) => {
|
|
1574
|
-
return /* @__PURE__ */
|
|
1707
|
+
return /* @__PURE__ */ jsx9(PlaybackrateOption, {
|
|
1575
1708
|
selectedRate: playbackRate,
|
|
1576
1709
|
onSelect,
|
|
1577
1710
|
rate,
|
|
@@ -1618,7 +1751,7 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
1618
1751
|
e.preventDefault();
|
|
1619
1752
|
setIsComponentVisible((prevIsComponentVisible) => !prevIsComponentVisible);
|
|
1620
1753
|
}, [setIsComponentVisible]);
|
|
1621
|
-
return /* @__PURE__ */
|
|
1754
|
+
return /* @__PURE__ */ jsx9("div", {
|
|
1622
1755
|
ref,
|
|
1623
1756
|
children: /* @__PURE__ */ jsxs5("button", {
|
|
1624
1757
|
type: "button",
|
|
@@ -1633,7 +1766,7 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
1633
1766
|
"x"
|
|
1634
1767
|
]
|
|
1635
1768
|
}),
|
|
1636
|
-
isComponentVisible && /* @__PURE__ */
|
|
1769
|
+
isComponentVisible && /* @__PURE__ */ jsx9(PlaybackPopup, {
|
|
1637
1770
|
canvasSize,
|
|
1638
1771
|
playbackRates,
|
|
1639
1772
|
setIsComponentVisible
|
|
@@ -1644,9 +1777,9 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
|
|
|
1644
1777
|
};
|
|
1645
1778
|
|
|
1646
1779
|
// src/PlayerSeekBar.tsx
|
|
1647
|
-
import { useCallback as useCallback7, useEffect as
|
|
1780
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
|
|
1648
1781
|
import { Internals as Internals9, interpolate } from "remotion";
|
|
1649
|
-
import { jsx as
|
|
1782
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1650
1783
|
var getFrameFromX = (clientX, durationInFrames, width) => {
|
|
1651
1784
|
const pos = clientX;
|
|
1652
1785
|
const frame = Math.round(interpolate(pos, [0, width], [0, durationInFrames - 1], {
|
|
@@ -1682,7 +1815,7 @@ var findBodyInWhichDivIsLocated = (div) => {
|
|
|
1682
1815
|
return current;
|
|
1683
1816
|
};
|
|
1684
1817
|
var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
|
|
1685
|
-
const containerRef =
|
|
1818
|
+
const containerRef = useRef8(null);
|
|
1686
1819
|
const barHovered = useHoverState(containerRef, false);
|
|
1687
1820
|
const size = useElementSize(containerRef, {
|
|
1688
1821
|
triggerOnWindowResize: true,
|
|
@@ -1733,7 +1866,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
|
|
|
1733
1866
|
}
|
|
1734
1867
|
onSeekEnd();
|
|
1735
1868
|
}, [dragging, onSeekEnd, pause, play]);
|
|
1736
|
-
|
|
1869
|
+
useEffect10(() => {
|
|
1737
1870
|
if (!dragging.dragging) {
|
|
1738
1871
|
return;
|
|
1739
1872
|
}
|
|
@@ -1785,15 +1918,15 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
|
|
|
1785
1918
|
/* @__PURE__ */ jsxs6("div", {
|
|
1786
1919
|
style: barBackground,
|
|
1787
1920
|
children: [
|
|
1788
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ jsx10("div", {
|
|
1789
1922
|
style: active
|
|
1790
1923
|
}),
|
|
1791
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ jsx10("div", {
|
|
1792
1925
|
style: fillStyle
|
|
1793
1926
|
})
|
|
1794
1927
|
]
|
|
1795
1928
|
}),
|
|
1796
|
-
/* @__PURE__ */
|
|
1929
|
+
/* @__PURE__ */ jsx10("div", {
|
|
1797
1930
|
style: knobStyle
|
|
1798
1931
|
})
|
|
1799
1932
|
]
|
|
@@ -1865,7 +1998,7 @@ var useVideoControlsResize = ({
|
|
|
1865
1998
|
};
|
|
1866
1999
|
|
|
1867
2000
|
// src/PlayerControls.tsx
|
|
1868
|
-
import { jsx as
|
|
2001
|
+
import { jsx as jsx11, jsxs as jsxs8, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
1869
2002
|
var gradientSteps = [
|
|
1870
2003
|
0,
|
|
1871
2004
|
0.013,
|
|
@@ -1974,7 +2107,7 @@ var Controls = ({
|
|
|
1974
2107
|
toggle,
|
|
1975
2108
|
renderCustomControls
|
|
1976
2109
|
}) => {
|
|
1977
|
-
const playButtonRef =
|
|
2110
|
+
const playButtonRef = useRef9(null);
|
|
1978
2111
|
const [supportsFullscreen, setSupportsFullscreen] = useState10(false);
|
|
1979
2112
|
const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
|
|
1980
2113
|
const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
|
|
@@ -2009,17 +2142,17 @@ var Controls = ({
|
|
|
2009
2142
|
opacity: Number(shouldShow)
|
|
2010
2143
|
};
|
|
2011
2144
|
}, [hovered, shouldShowInitially, playing, alwaysShowControls]);
|
|
2012
|
-
|
|
2145
|
+
useEffect11(() => {
|
|
2013
2146
|
if (playButtonRef.current && spaceKeyToPlayOrPause) {
|
|
2014
2147
|
playButtonRef.current.focus({
|
|
2015
2148
|
preventScroll: true
|
|
2016
2149
|
});
|
|
2017
2150
|
}
|
|
2018
2151
|
}, [playing, spaceKeyToPlayOrPause]);
|
|
2019
|
-
|
|
2152
|
+
useEffect11(() => {
|
|
2020
2153
|
setSupportsFullscreen((typeof document !== "undefined" && (document.fullscreenEnabled || document.webkitFullscreenEnabled)) ?? false);
|
|
2021
2154
|
}, []);
|
|
2022
|
-
|
|
2155
|
+
useEffect11(() => {
|
|
2023
2156
|
if (shouldShowInitially === false) {
|
|
2024
2157
|
return;
|
|
2025
2158
|
}
|
|
@@ -2049,8 +2182,8 @@ var Controls = ({
|
|
|
2049
2182
|
return null;
|
|
2050
2183
|
}, [showPlaybackRateControl]);
|
|
2051
2184
|
const customControlsElement = renderCustomControls ? renderCustomControls() : null;
|
|
2052
|
-
const ref =
|
|
2053
|
-
const flexRef =
|
|
2185
|
+
const ref = useRef9(null);
|
|
2186
|
+
const flexRef = useRef9(null);
|
|
2054
2187
|
const onPointerDownIfContainer = useCallback8((e) => {
|
|
2055
2188
|
if (e.target === ref.current || e.target === flexRef.current) {
|
|
2056
2189
|
onPointerDown?.(e);
|
|
@@ -2074,82 +2207,82 @@ var Controls = ({
|
|
|
2074
2207
|
/* @__PURE__ */ jsxs8("div", {
|
|
2075
2208
|
style: leftPartStyle,
|
|
2076
2209
|
children: [
|
|
2077
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsx11("button", {
|
|
2078
2211
|
ref: playButtonRef,
|
|
2079
2212
|
type: "button",
|
|
2080
2213
|
style: playerButtonStyle,
|
|
2081
2214
|
onClick: toggle,
|
|
2082
2215
|
"aria-label": playing ? "Pause video" : "Play video",
|
|
2083
2216
|
title: playing ? "Pause video" : "Play video",
|
|
2084
|
-
children: renderPlayPauseButton === null ? /* @__PURE__ */
|
|
2217
|
+
children: renderPlayPauseButton === null ? /* @__PURE__ */ jsx11(DefaultPlayPauseButton, {
|
|
2085
2218
|
buffering,
|
|
2086
2219
|
playing
|
|
2087
2220
|
}) : renderPlayPauseButton({
|
|
2088
2221
|
playing,
|
|
2089
2222
|
isBuffering: buffering
|
|
2090
|
-
}) ?? /* @__PURE__ */
|
|
2223
|
+
}) ?? /* @__PURE__ */ jsx11(DefaultPlayPauseButton, {
|
|
2091
2224
|
buffering,
|
|
2092
2225
|
playing
|
|
2093
2226
|
})
|
|
2094
2227
|
}),
|
|
2095
2228
|
showVolumeControls ? /* @__PURE__ */ jsxs8(Fragment2, {
|
|
2096
2229
|
children: [
|
|
2097
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2098
2231
|
style: xSpacer
|
|
2099
2232
|
}),
|
|
2100
|
-
/* @__PURE__ */
|
|
2233
|
+
/* @__PURE__ */ jsx11(MediaVolumeSlider, {
|
|
2101
2234
|
renderMuteButton,
|
|
2102
2235
|
renderVolumeSlider,
|
|
2103
2236
|
displayVerticalVolumeSlider
|
|
2104
2237
|
})
|
|
2105
2238
|
]
|
|
2106
2239
|
}) : null,
|
|
2107
|
-
/* @__PURE__ */
|
|
2240
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2108
2241
|
style: xSpacer
|
|
2109
2242
|
}),
|
|
2110
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsx11(PlayerTimeLabel, {
|
|
2111
2244
|
durationInFrames,
|
|
2112
2245
|
fps,
|
|
2113
2246
|
maxTimeLabelWidth
|
|
2114
2247
|
}),
|
|
2115
|
-
/* @__PURE__ */
|
|
2248
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2116
2249
|
style: xSpacer
|
|
2117
2250
|
})
|
|
2118
2251
|
]
|
|
2119
2252
|
}),
|
|
2120
|
-
/* @__PURE__ */
|
|
2253
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2121
2254
|
style: flex1
|
|
2122
2255
|
}),
|
|
2123
2256
|
customControlsElement,
|
|
2124
|
-
customControlsElement && playbackRates && canvasSize ? /* @__PURE__ */
|
|
2257
|
+
customControlsElement && playbackRates && canvasSize ? /* @__PURE__ */ jsx11("div", {
|
|
2125
2258
|
style: xSpacer
|
|
2126
2259
|
}) : null,
|
|
2127
|
-
playbackRates && canvasSize && /* @__PURE__ */
|
|
2260
|
+
playbackRates && canvasSize && /* @__PURE__ */ jsx11(PlaybackrateControl, {
|
|
2128
2261
|
canvasSize,
|
|
2129
2262
|
playbackRates
|
|
2130
2263
|
}),
|
|
2131
|
-
playbackRates && supportsFullscreen && allowFullscreen ? /* @__PURE__ */
|
|
2264
|
+
playbackRates && supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx11("div", {
|
|
2132
2265
|
style: xSpacer
|
|
2133
2266
|
}) : null,
|
|
2134
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2135
2268
|
style: fullscreen,
|
|
2136
|
-
children: supportsFullscreen && allowFullscreen ? /* @__PURE__ */
|
|
2269
|
+
children: supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx11("button", {
|
|
2137
2270
|
type: "button",
|
|
2138
2271
|
"aria-label": isFullscreen ? "Exit fullscreen" : "Enter Fullscreen",
|
|
2139
2272
|
title: isFullscreen ? "Exit fullscreen" : "Enter Fullscreen",
|
|
2140
2273
|
style: playerButtonStyle,
|
|
2141
2274
|
onClick: isFullscreen ? onExitFullscreenButtonClick : onFullscreenButtonClick,
|
|
2142
|
-
children: renderFullscreenButton === null ? /* @__PURE__ */
|
|
2275
|
+
children: renderFullscreenButton === null ? /* @__PURE__ */ jsx11(FullscreenIcon, {
|
|
2143
2276
|
isFullscreen
|
|
2144
2277
|
}) : renderFullscreenButton({ isFullscreen })
|
|
2145
2278
|
}) : null
|
|
2146
2279
|
})
|
|
2147
2280
|
]
|
|
2148
2281
|
}),
|
|
2149
|
-
/* @__PURE__ */
|
|
2282
|
+
/* @__PURE__ */ jsx11("div", {
|
|
2150
2283
|
style: ySpacer
|
|
2151
2284
|
}),
|
|
2152
|
-
/* @__PURE__ */
|
|
2285
|
+
/* @__PURE__ */ jsx11(PlayerSeekBar, {
|
|
2153
2286
|
onSeekEnd,
|
|
2154
2287
|
onSeekStart,
|
|
2155
2288
|
durationInFrames,
|
|
@@ -2160,133 +2293,6 @@ var Controls = ({
|
|
|
2160
2293
|
});
|
|
2161
2294
|
};
|
|
2162
2295
|
|
|
2163
|
-
// src/error-boundary.tsx
|
|
2164
|
-
import React8 from "react";
|
|
2165
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2166
|
-
var errorStyle = {
|
|
2167
|
-
display: "flex",
|
|
2168
|
-
justifyContent: "center",
|
|
2169
|
-
alignItems: "center",
|
|
2170
|
-
flex: 1,
|
|
2171
|
-
height: "100%",
|
|
2172
|
-
width: "100%"
|
|
2173
|
-
};
|
|
2174
|
-
|
|
2175
|
-
class ErrorBoundary extends React8.Component {
|
|
2176
|
-
state = { hasError: null };
|
|
2177
|
-
static getDerivedStateFromError(error) {
|
|
2178
|
-
return { hasError: error };
|
|
2179
|
-
}
|
|
2180
|
-
componentDidCatch(error) {
|
|
2181
|
-
this.props.onError(error);
|
|
2182
|
-
}
|
|
2183
|
-
render() {
|
|
2184
|
-
if (this.state.hasError) {
|
|
2185
|
-
return /* @__PURE__ */ jsx10("div", {
|
|
2186
|
-
style: errorStyle,
|
|
2187
|
-
children: this.props.errorFallback({
|
|
2188
|
-
error: this.state.hasError
|
|
2189
|
-
})
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
|
-
return this.props.children;
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
// src/license-blacklist.tsx
|
|
2197
|
-
import React9, { useEffect as useEffect11 } from "react";
|
|
2198
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2199
|
-
var getHashOfDomain = async () => {
|
|
2200
|
-
if (typeof window === "undefined") {
|
|
2201
|
-
return null;
|
|
2202
|
-
}
|
|
2203
|
-
if (typeof window.crypto === "undefined") {
|
|
2204
|
-
return null;
|
|
2205
|
-
}
|
|
2206
|
-
if (typeof window.crypto.subtle === "undefined") {
|
|
2207
|
-
return null;
|
|
2208
|
-
}
|
|
2209
|
-
try {
|
|
2210
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(window.location.hostname));
|
|
2211
|
-
return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
2212
|
-
} catch {
|
|
2213
|
-
return null;
|
|
2214
|
-
}
|
|
2215
|
-
};
|
|
2216
|
-
var style = {
|
|
2217
|
-
backgroundColor: "red",
|
|
2218
|
-
position: "absolute",
|
|
2219
|
-
padding: 12,
|
|
2220
|
-
fontFamily: "Arial"
|
|
2221
|
-
};
|
|
2222
|
-
var DOMAIN_BLACKLIST = [
|
|
2223
|
-
"28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6",
|
|
2224
|
-
"4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e",
|
|
2225
|
-
"fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc",
|
|
2226
|
-
"7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83",
|
|
2227
|
-
"8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6",
|
|
2228
|
-
"a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"
|
|
2229
|
-
];
|
|
2230
|
-
var ran = false;
|
|
2231
|
-
var RenderWarningIfBlacklist = () => {
|
|
2232
|
-
const [unlicensed, setUnlicensed] = React9.useState(false);
|
|
2233
|
-
useEffect11(() => {
|
|
2234
|
-
if (ran) {
|
|
2235
|
-
return;
|
|
2236
|
-
}
|
|
2237
|
-
ran = true;
|
|
2238
|
-
getHashOfDomain().then((hash) => {
|
|
2239
|
-
if (hash && DOMAIN_BLACKLIST.includes(hash)) {
|
|
2240
|
-
setUnlicensed(true);
|
|
2241
|
-
}
|
|
2242
|
-
}).catch(() => {});
|
|
2243
|
-
}, []);
|
|
2244
|
-
useEffect11(() => {
|
|
2245
|
-
if (!unlicensed) {
|
|
2246
|
-
return;
|
|
2247
|
-
}
|
|
2248
|
-
const ensureBanner = () => {
|
|
2249
|
-
const banner = document.querySelector(".warning-banner");
|
|
2250
|
-
if (!banner) {
|
|
2251
|
-
const div = document.createElement("div");
|
|
2252
|
-
div.className = "warning-banner";
|
|
2253
|
-
Object.assign(div.style, style, {
|
|
2254
|
-
zIndex: "9999",
|
|
2255
|
-
cssText: `${style.cssText} !important;`
|
|
2256
|
-
});
|
|
2257
|
-
div.innerHTML = `
|
|
2258
|
-
<a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">
|
|
2259
|
-
Remotion Unlicensed – Contact hi@remotion.dev
|
|
2260
|
-
</a>
|
|
2261
|
-
`;
|
|
2262
|
-
document.body.appendChild(div);
|
|
2263
|
-
}
|
|
2264
|
-
};
|
|
2265
|
-
const observer = new MutationObserver(() => ensureBanner());
|
|
2266
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
2267
|
-
return () => {
|
|
2268
|
-
observer.disconnect();
|
|
2269
|
-
};
|
|
2270
|
-
}, [unlicensed]);
|
|
2271
|
-
if (!unlicensed) {
|
|
2272
|
-
return null;
|
|
2273
|
-
}
|
|
2274
|
-
return /* @__PURE__ */ jsx11("div", {
|
|
2275
|
-
style,
|
|
2276
|
-
className: "warning-banner",
|
|
2277
|
-
children: /* @__PURE__ */ jsx11("a", {
|
|
2278
|
-
style: { color: "white" },
|
|
2279
|
-
href: "https://github.com/remotion-dev/remotion/pull/4589",
|
|
2280
|
-
children: "Remotion Unlicensed – Contact hi@remotion.dev"
|
|
2281
|
-
})
|
|
2282
|
-
});
|
|
2283
|
-
};
|
|
2284
|
-
|
|
2285
|
-
// src/player-css-classname.ts
|
|
2286
|
-
var playerCssClassname = (override) => {
|
|
2287
|
-
return override ?? "__remotion-player";
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
2296
|
// src/utils/is-node.ts
|
|
2291
2297
|
var IS_NODE = typeof document === "undefined";
|
|
2292
2298
|
|
|
@@ -2319,9 +2325,9 @@ var cancellablePromise = (promise) => {
|
|
|
2319
2325
|
var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
|
|
2320
2326
|
|
|
2321
2327
|
// src/utils/use-cancellable-promises.ts
|
|
2322
|
-
import { useCallback as useCallback9, useMemo as useMemo10, useRef as
|
|
2328
|
+
import { useCallback as useCallback9, useMemo as useMemo10, useRef as useRef10 } from "react";
|
|
2323
2329
|
var useCancellablePromises = () => {
|
|
2324
|
-
const pendingPromises =
|
|
2330
|
+
const pendingPromises = useRef10([]);
|
|
2325
2331
|
const appendPendingPromise = useCallback9((promise) => {
|
|
2326
2332
|
pendingPromises.current = [...pendingPromises.current, promise];
|
|
2327
2333
|
}, []);
|
|
@@ -2431,7 +2437,7 @@ var PlayerUI = ({
|
|
|
2431
2437
|
}, ref) => {
|
|
2432
2438
|
const config = Internals11.useUnsafeVideoConfig();
|
|
2433
2439
|
const video = Internals11.useVideo();
|
|
2434
|
-
const container =
|
|
2440
|
+
const container = useRef11(null);
|
|
2435
2441
|
const canvasSize = useElementSize(container, {
|
|
2436
2442
|
triggerOnWindowResize: false,
|
|
2437
2443
|
shouldApplyCssTransforms: false
|
|
@@ -2542,7 +2548,7 @@ var PlayerUI = ({
|
|
|
2542
2548
|
});
|
|
2543
2549
|
}, [canvasSize, config]);
|
|
2544
2550
|
const scale = layout?.scale ?? 1;
|
|
2545
|
-
const initialScaleIgnored =
|
|
2551
|
+
const initialScaleIgnored = useRef11(false);
|
|
2546
2552
|
useEffect12(() => {
|
|
2547
2553
|
if (!initialScaleIgnored.current) {
|
|
2548
2554
|
initialScaleIgnored.current = true;
|
|
@@ -3219,9 +3225,9 @@ var PlayerFn = ({
|
|
|
3219
3225
|
}));
|
|
3220
3226
|
const [playing, setPlaying] = useState13(false);
|
|
3221
3227
|
const [rootId] = useState13("player-comp");
|
|
3222
|
-
const rootRef =
|
|
3223
|
-
const audioAndVideoTags =
|
|
3224
|
-
const imperativePlaying =
|
|
3228
|
+
const rootRef = useRef12(null);
|
|
3229
|
+
const audioAndVideoTags = useRef12([]);
|
|
3230
|
+
const imperativePlaying = useRef12(false);
|
|
3225
3231
|
const [currentPlaybackRate, setCurrentPlaybackRate] = useState13(playbackRate);
|
|
3226
3232
|
if (typeof compositionHeight !== "number") {
|
|
3227
3233
|
throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
|
|
@@ -3385,7 +3391,7 @@ import {
|
|
|
3385
3391
|
useImperativeHandle as useImperativeHandle4,
|
|
3386
3392
|
useLayoutEffect as useLayoutEffect3,
|
|
3387
3393
|
useMemo as useMemo17,
|
|
3388
|
-
useRef as
|
|
3394
|
+
useRef as useRef14,
|
|
3389
3395
|
useState as useState14
|
|
3390
3396
|
} from "react";
|
|
3391
3397
|
import { Internals as Internals17, random as random2 } from "remotion";
|
|
@@ -3397,7 +3403,7 @@ import React13, {
|
|
|
3397
3403
|
useCallback as useCallback13,
|
|
3398
3404
|
useImperativeHandle as useImperativeHandle3,
|
|
3399
3405
|
useMemo as useMemo16,
|
|
3400
|
-
useRef as
|
|
3406
|
+
useRef as useRef13
|
|
3401
3407
|
} from "react";
|
|
3402
3408
|
import { Internals as Internals16 } from "remotion";
|
|
3403
3409
|
|
|
@@ -3435,7 +3441,7 @@ var ThumbnailUI = ({
|
|
|
3435
3441
|
}, ref) => {
|
|
3436
3442
|
const config = Internals16.useUnsafeVideoConfig();
|
|
3437
3443
|
const video = Internals16.useVideo();
|
|
3438
|
-
const container =
|
|
3444
|
+
const container = useRef13(null);
|
|
3439
3445
|
const canvasSize = useElementSize(container, {
|
|
3440
3446
|
triggerOnWindowResize: false,
|
|
3441
3447
|
shouldApplyCssTransforms: false
|
|
@@ -3564,7 +3570,7 @@ var ThumbnailFn = ({
|
|
|
3564
3570
|
}, []);
|
|
3565
3571
|
}
|
|
3566
3572
|
const [thumbnailId] = useState14(() => String(random2(null)));
|
|
3567
|
-
const rootRef =
|
|
3573
|
+
const rootRef = useRef14(null);
|
|
3568
3574
|
const timelineState = useMemo17(() => {
|
|
3569
3575
|
const value = {
|
|
3570
3576
|
playing: false,
|
package/package.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/player"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/player",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.429",
|
|
7
7
|
"description": "React component for embedding a Remotion preview into your app",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
10
10
|
"module": "dist/esm/index.mjs",
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"scripts": {
|
|
13
|
-
"formatting": "
|
|
13
|
+
"formatting": "oxfmt src --check",
|
|
14
14
|
"lint": "eslint src",
|
|
15
15
|
"make": "tsgo -d && bun ensure-correct-version.ts && bun --env-file=../.env.bundle bundle.ts",
|
|
16
16
|
"test": "bun test src",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"remotion": "4.0.
|
|
38
|
+
"remotion": "4.0.429"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": "19.2.3",
|
|
50
50
|
"webpack": "5.105.0",
|
|
51
51
|
"zod": "4.3.6",
|
|
52
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
52
|
+
"@remotion/eslint-config-internal": "4.0.429",
|
|
53
53
|
"eslint": "9.19.0",
|
|
54
54
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
55
55
|
},
|