@remotion/player 4.0.537 → 4.0.538
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/BufferingIndicator.js +3 -5
- package/dist/cjs/DefaultPlayPauseButton.js +3 -3
- package/dist/cjs/EmitterProvider.js +1 -1
- package/dist/cjs/MediaVolumeSlider.js +2 -2
- package/dist/cjs/PlaybackrateControl.js +5 -7
- package/dist/cjs/Player.d.ts +6 -1
- package/dist/cjs/Player.js +6 -4
- package/dist/cjs/PlayerControls.js +3 -11
- package/dist/cjs/PlayerSeekBar.js +1 -5
- package/dist/cjs/PlayerTimeLabel.js +1 -1
- package/dist/cjs/PlayerUI.d.ts +3 -3
- package/dist/cjs/PlayerUI.js +4 -7
- package/dist/cjs/SharedPlayerContext.d.ts +1 -0
- package/dist/cjs/SharedPlayerContext.js +2 -2
- package/dist/cjs/Thumbnail.d.ts +1 -1
- package/dist/cjs/Thumbnail.js +1 -1
- package/dist/cjs/ThumbnailUI.d.ts +1 -1
- package/dist/cjs/ThumbnailUI.js +3 -3
- package/dist/cjs/calculate-scale.d.ts +11 -11
- package/dist/cjs/error-boundary.js +5 -2
- package/dist/cjs/event-emitter.js +88 -84
- package/dist/cjs/icons.js +9 -13
- package/dist/cjs/index.d.ts +14 -32
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/license-blacklist.js +1 -1
- package/dist/cjs/player-css-classname.d.ts +1 -1
- package/dist/cjs/render-volume-slider.js +3 -5
- package/dist/cjs/set-global-time-anchor.d.ts +2 -1
- package/dist/cjs/use-hover-state.d.ts +1 -1
- package/dist/cjs/use-playback.d.ts +2 -1
- package/dist/cjs/use-playback.js +48 -38
- package/dist/cjs/use-player-methods.js +9 -8
- package/dist/cjs/use-remotion-license-acknowledge.d.ts +2 -1
- package/dist/cjs/utils/calculate-player-size.d.ts +4 -3
- package/dist/cjs/volume-persistence.d.ts +2 -1
- package/dist/esm/index.mjs +70 -50
- package/package.json +5 -5
|
@@ -2,22 +2,76 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThumbnailEmitter = exports.PlayerEmitter = void 0;
|
|
4
4
|
class PlayerEmitter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
constructor() {
|
|
6
|
+
this.listeners = {
|
|
7
|
+
ended: [],
|
|
8
|
+
error: [],
|
|
9
|
+
pause: [],
|
|
10
|
+
play: [],
|
|
11
|
+
ratechange: [],
|
|
12
|
+
scalechange: [],
|
|
13
|
+
seeked: [],
|
|
14
|
+
timeupdate: [],
|
|
15
|
+
frameupdate: [],
|
|
16
|
+
fullscreenchange: [],
|
|
17
|
+
volumechange: [],
|
|
18
|
+
mutechange: [],
|
|
19
|
+
waiting: [],
|
|
20
|
+
resume: [],
|
|
21
|
+
};
|
|
22
|
+
this.dispatchSeek = (frame) => {
|
|
23
|
+
this.dispatchEvent('seeked', {
|
|
24
|
+
frame,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
this.dispatchVolumeChange = (volume) => {
|
|
28
|
+
this.dispatchEvent('volumechange', {
|
|
29
|
+
volume,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
this.dispatchPause = () => {
|
|
33
|
+
this.dispatchEvent('pause', undefined);
|
|
34
|
+
};
|
|
35
|
+
this.dispatchPlay = () => {
|
|
36
|
+
this.dispatchEvent('play', undefined);
|
|
37
|
+
};
|
|
38
|
+
this.dispatchEnded = () => {
|
|
39
|
+
this.dispatchEvent('ended', undefined);
|
|
40
|
+
};
|
|
41
|
+
this.dispatchRateChange = (playbackRate) => {
|
|
42
|
+
this.dispatchEvent('ratechange', {
|
|
43
|
+
playbackRate,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
this.dispatchScaleChange = (scale) => {
|
|
47
|
+
this.dispatchEvent('scalechange', {
|
|
48
|
+
scale,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
this.dispatchError = (error) => {
|
|
52
|
+
this.dispatchEvent('error', {
|
|
53
|
+
error,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
this.dispatchTimeUpdate = (event) => {
|
|
57
|
+
this.dispatchEvent('timeupdate', event);
|
|
58
|
+
};
|
|
59
|
+
this.dispatchFrameUpdate = (event) => {
|
|
60
|
+
this.dispatchEvent('frameupdate', event);
|
|
61
|
+
};
|
|
62
|
+
this.dispatchFullscreenChange = (event) => {
|
|
63
|
+
this.dispatchEvent('fullscreenchange', event);
|
|
64
|
+
};
|
|
65
|
+
this.dispatchMuteChange = (event) => {
|
|
66
|
+
this.dispatchEvent('mutechange', event);
|
|
67
|
+
};
|
|
68
|
+
this.dispatchWaiting = (event) => {
|
|
69
|
+
this.dispatchEvent('waiting', event);
|
|
70
|
+
};
|
|
71
|
+
this.dispatchResume = (event) => {
|
|
72
|
+
this.dispatchEvent('resume', event);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
21
75
|
addEventListener(name, callback) {
|
|
22
76
|
this.listeners[name].push(callback);
|
|
23
77
|
}
|
|
@@ -29,66 +83,27 @@ class PlayerEmitter {
|
|
|
29
83
|
callback({ detail: context });
|
|
30
84
|
});
|
|
31
85
|
}
|
|
32
|
-
dispatchSeek = (frame) => {
|
|
33
|
-
this.dispatchEvent('seeked', {
|
|
34
|
-
frame,
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
dispatchVolumeChange = (volume) => {
|
|
38
|
-
this.dispatchEvent('volumechange', {
|
|
39
|
-
volume,
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
dispatchPause = () => {
|
|
43
|
-
this.dispatchEvent('pause', undefined);
|
|
44
|
-
};
|
|
45
|
-
dispatchPlay = () => {
|
|
46
|
-
this.dispatchEvent('play', undefined);
|
|
47
|
-
};
|
|
48
|
-
dispatchEnded = () => {
|
|
49
|
-
this.dispatchEvent('ended', undefined);
|
|
50
|
-
};
|
|
51
|
-
dispatchRateChange = (playbackRate) => {
|
|
52
|
-
this.dispatchEvent('ratechange', {
|
|
53
|
-
playbackRate,
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
dispatchScaleChange = (scale) => {
|
|
57
|
-
this.dispatchEvent('scalechange', {
|
|
58
|
-
scale,
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
dispatchError = (error) => {
|
|
62
|
-
this.dispatchEvent('error', {
|
|
63
|
-
error,
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
dispatchTimeUpdate = (event) => {
|
|
67
|
-
this.dispatchEvent('timeupdate', event);
|
|
68
|
-
};
|
|
69
|
-
dispatchFrameUpdate = (event) => {
|
|
70
|
-
this.dispatchEvent('frameupdate', event);
|
|
71
|
-
};
|
|
72
|
-
dispatchFullscreenChange = (event) => {
|
|
73
|
-
this.dispatchEvent('fullscreenchange', event);
|
|
74
|
-
};
|
|
75
|
-
dispatchMuteChange = (event) => {
|
|
76
|
-
this.dispatchEvent('mutechange', event);
|
|
77
|
-
};
|
|
78
|
-
dispatchWaiting = (event) => {
|
|
79
|
-
this.dispatchEvent('waiting', event);
|
|
80
|
-
};
|
|
81
|
-
dispatchResume = (event) => {
|
|
82
|
-
this.dispatchEvent('resume', event);
|
|
83
|
-
};
|
|
84
86
|
}
|
|
85
87
|
exports.PlayerEmitter = PlayerEmitter;
|
|
86
88
|
class ThumbnailEmitter {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
constructor() {
|
|
90
|
+
this.listeners = {
|
|
91
|
+
error: [],
|
|
92
|
+
waiting: [],
|
|
93
|
+
resume: [],
|
|
94
|
+
};
|
|
95
|
+
this.dispatchError = (error) => {
|
|
96
|
+
this.dispatchEvent('error', {
|
|
97
|
+
error,
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
this.dispatchWaiting = (event) => {
|
|
101
|
+
this.dispatchEvent('waiting', event);
|
|
102
|
+
};
|
|
103
|
+
this.dispatchResume = (event) => {
|
|
104
|
+
this.dispatchEvent('resume', event);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
92
107
|
addEventListener(name, callback) {
|
|
93
108
|
this.listeners[name].push(callback);
|
|
94
109
|
}
|
|
@@ -100,16 +115,5 @@ class ThumbnailEmitter {
|
|
|
100
115
|
callback({ detail: context });
|
|
101
116
|
});
|
|
102
117
|
}
|
|
103
|
-
dispatchError = (error) => {
|
|
104
|
-
this.dispatchEvent('error', {
|
|
105
|
-
error,
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
dispatchWaiting = (event) => {
|
|
109
|
-
this.dispatchEvent('waiting', event);
|
|
110
|
-
};
|
|
111
|
-
dispatchResume = (event) => {
|
|
112
|
-
this.dispatchEvent('resume', event);
|
|
113
|
-
};
|
|
114
118
|
}
|
|
115
119
|
exports.ThumbnailEmitter = ThumbnailEmitter;
|
package/dist/cjs/icons.js
CHANGED
|
@@ -5,13 +5,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
exports.ICON_SIZE = 25;
|
|
6
6
|
exports.fullscreenIconSize = 16;
|
|
7
7
|
const PlayIcon = () => {
|
|
8
|
-
return (jsx_runtime_1.jsx("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 25 25", fill: "none", children: 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" }) }));
|
|
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" }) }));
|
|
9
9
|
};
|
|
10
10
|
exports.PlayIcon = PlayIcon;
|
|
11
11
|
const PauseIcon = () => {
|
|
12
|
-
return (jsx_runtime_1.jsxs("svg", { viewBox: "0 0 100 100", width: exports.ICON_SIZE, height: exports.ICON_SIZE, children: [
|
|
13
|
-
jsx_runtime_1.jsx("rect", { x: "25", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" }), jsx_runtime_1.jsx("rect", { x: "55", y: "20", width: "20", height: "60", fill: "#fff", ry: "5", rx: "5" })
|
|
14
|
-
] }));
|
|
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" })] }));
|
|
15
13
|
};
|
|
16
14
|
exports.PauseIcon = PauseIcon;
|
|
17
15
|
const FullscreenIcon = ({ isFullscreen, }) => {
|
|
@@ -20,32 +18,30 @@ const FullscreenIcon = ({ isFullscreen, }) => {
|
|
|
20
18
|
const out = isFullscreen ? 0 : strokeWidth / 2;
|
|
21
19
|
const middleInset = isFullscreen ? strokeWidth * 1.6 : strokeWidth / 2;
|
|
22
20
|
const inset = isFullscreen ? strokeWidth * 1.6 : strokeWidth * 2;
|
|
23
|
-
return (jsx_runtime_1.jsxs("svg", { viewBox: `0 0 ${viewSize} ${viewSize}`, height: exports.fullscreenIconSize, width: exports.fullscreenIconSize, children: [
|
|
24
|
-
jsx_runtime_1.jsx("path", { d: `
|
|
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: `
|
|
25
22
|
M ${out} ${inset}
|
|
26
23
|
L ${middleInset} ${middleInset}
|
|
27
24
|
L ${inset} ${out}
|
|
28
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), jsx_runtime_1.jsx("path", { d: `
|
|
25
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
29
26
|
M ${viewSize - out} ${inset}
|
|
30
27
|
L ${viewSize - middleInset} ${middleInset}
|
|
31
28
|
L ${viewSize - inset} ${out}
|
|
32
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), jsx_runtime_1.jsx("path", { d: `
|
|
29
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
33
30
|
M ${out} ${viewSize - inset}
|
|
34
31
|
L ${middleInset} ${viewSize - middleInset}
|
|
35
32
|
L ${inset} ${viewSize - out}
|
|
36
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), jsx_runtime_1.jsx("path", { d: `
|
|
33
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)("path", { d: `
|
|
37
34
|
M ${viewSize - out} ${viewSize - inset}
|
|
38
35
|
L ${viewSize - middleInset} ${viewSize - middleInset}
|
|
39
36
|
L ${viewSize - inset} ${viewSize - out}
|
|
40
|
-
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" })
|
|
41
|
-
] }));
|
|
37
|
+
`, stroke: "#fff", strokeWidth: strokeWidth, fill: "none" })] }));
|
|
42
38
|
};
|
|
43
39
|
exports.FullscreenIcon = FullscreenIcon;
|
|
44
40
|
const VolumeOffIcon = () => {
|
|
45
|
-
return (jsx_runtime_1.jsx("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: 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" }) }));
|
|
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" }) }));
|
|
46
42
|
};
|
|
47
43
|
exports.VolumeOffIcon = VolumeOffIcon;
|
|
48
44
|
const VolumeOnIcon = () => {
|
|
49
|
-
return (jsx_runtime_1.jsx("svg", { width: exports.ICON_SIZE, height: exports.ICON_SIZE, viewBox: "0 0 24 24", children: 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" }) }));
|
|
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" }) }));
|
|
50
46
|
};
|
|
51
47
|
exports.VolumeOnIcon = VolumeOnIcon;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import './_check-rsc.js';
|
|
2
|
+
import { calculateCanvasTransformation } from './calculate-scale.js';
|
|
2
3
|
import type { CallbackListener, PlayerEventTypes } from './event-emitter.js';
|
|
3
4
|
import { PlayerEmitter } from './event-emitter.js';
|
|
5
|
+
import { useHoverState } from './use-hover-state.js';
|
|
6
|
+
import { usePlayback } from './use-playback.js';
|
|
7
|
+
import { usePlayerMethods } from './use-player-methods.js';
|
|
8
|
+
import { updateAllElementsSizes, useElementSize } from './utils/use-element-size.js';
|
|
4
9
|
export type { RenderMuteButton } from './MediaVolumeSlider.js';
|
|
5
10
|
export type { PlayerMethods, PlayerRef, RenderCustomControls, ThumbnailMethods, ThumbnailRef, } from './player-methods.js';
|
|
6
11
|
export { Player } from './Player.js';
|
|
@@ -15,42 +20,19 @@ export type { CallbackListener, PlayerEventTypes as EventTypes };
|
|
|
15
20
|
export declare const PlayerInternals: {
|
|
16
21
|
PlayerEventEmitterContext: import("react").Context<PlayerEmitter | undefined>;
|
|
17
22
|
PlayerEmitter: typeof PlayerEmitter;
|
|
18
|
-
usePlayerMethods:
|
|
19
|
-
usePlayback:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
outFrame: number | null;
|
|
25
|
-
browserMediaControlsBehavior: import("./browser-mediasession.js").BrowserMediaControlsBehavior;
|
|
26
|
-
getCurrentFrame: () => number;
|
|
27
|
-
muted: boolean;
|
|
28
|
-
}) => void;
|
|
29
|
-
useElementSize: (source: HTMLElement | import("react").RefObject<HTMLElement | null> | null, options: {
|
|
30
|
-
triggerOnWindowResize: boolean;
|
|
31
|
-
shouldApplyCssTransforms: boolean;
|
|
32
|
-
}) => import("./index.js").Size | null;
|
|
33
|
-
calculateCanvasTransformation: ({ previewSize, compositionWidth, compositionHeight, canvasSize, }: {
|
|
34
|
-
previewSize: number | "auto";
|
|
35
|
-
compositionWidth: number;
|
|
36
|
-
compositionHeight: number;
|
|
37
|
-
canvasSize: import("./index.js").Size;
|
|
38
|
-
}) => {
|
|
39
|
-
centerX: number;
|
|
40
|
-
centerY: number;
|
|
41
|
-
xCorrection: number;
|
|
42
|
-
yCorrection: number;
|
|
43
|
-
scale: number;
|
|
44
|
-
};
|
|
45
|
-
useHoverState: (ref: import("react").RefObject<HTMLDivElement | null>, hideControlsWhenPointerDoesntMove: number | boolean) => boolean;
|
|
46
|
-
updateAllElementsSizes: () => void;
|
|
23
|
+
usePlayerMethods: typeof usePlayerMethods;
|
|
24
|
+
usePlayback: typeof usePlayback;
|
|
25
|
+
useElementSize: typeof useElementSize;
|
|
26
|
+
calculateCanvasTransformation: typeof calculateCanvasTransformation;
|
|
27
|
+
useHoverState: typeof useHoverState;
|
|
28
|
+
updateAllElementsSizes: typeof updateAllElementsSizes;
|
|
47
29
|
PlayerEmitterProvider: import("react").FC<{
|
|
48
|
-
readonly children:
|
|
30
|
+
readonly children: React.ReactNode;
|
|
49
31
|
readonly currentPlaybackRate: number | null;
|
|
50
32
|
}>;
|
|
51
33
|
BufferingIndicator: import("react").FC<{
|
|
52
|
-
readonly type:
|
|
53
|
-
readonly color?: string
|
|
34
|
+
readonly type: 'player' | 'studio';
|
|
35
|
+
readonly color?: string;
|
|
54
36
|
}>;
|
|
55
37
|
TimelineSequenceObserverContext: import("react").Context<import("./timeline-sequence-observer-context.js").TimelineSequenceObserver | null>;
|
|
56
38
|
CanvasOverlayContext: import("react").Context<import("react").ReactNode>;
|
package/dist/cjs/index.js
CHANGED
|
@@ -13,9 +13,9 @@ const use_hover_state_js_1 = require("./use-hover-state.js");
|
|
|
13
13
|
const use_playback_js_1 = require("./use-playback.js");
|
|
14
14
|
const use_player_methods_js_1 = require("./use-player-methods.js");
|
|
15
15
|
const use_element_size_js_1 = require("./utils/use-element-size.js");
|
|
16
|
-
|
|
16
|
+
var Player_js_1 = require("./Player.js");
|
|
17
17
|
Object.defineProperty(exports, "Player", { enumerable: true, get: function () { return Player_js_1.Player; } });
|
|
18
|
-
|
|
18
|
+
var Thumbnail_js_1 = require("./Thumbnail.js");
|
|
19
19
|
Object.defineProperty(exports, "Thumbnail", { enumerable: true, get: function () { return Thumbnail_js_1.Thumbnail; } });
|
|
20
20
|
exports.PlayerInternals = {
|
|
21
21
|
PlayerEventEmitterContext: emitter_context_js_1.PlayerEventEmitterContext,
|
|
@@ -123,6 +123,6 @@ const RenderWarningIfBlacklist = () => {
|
|
|
123
123
|
if (!unlicensed) {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
return (jsx_runtime_1.jsx("div", { style: style, className: "warning-banner", children: jsx_runtime_1.jsx("a", { style: { color: 'white' }, href: "https://github.com/remotion-dev/remotion/pull/4589", children: "Remotion Unlicensed \u2013 Contact hi@remotion.dev" }) }));
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: style, className: "warning-banner", children: (0, jsx_runtime_1.jsx)("a", { style: { color: 'white' }, href: "https://github.com/remotion-dev/remotion/pull/4589", children: "Remotion Unlicensed \u2013 Contact hi@remotion.dev" }) }));
|
|
127
127
|
};
|
|
128
128
|
exports.RenderWarningIfBlacklist = RenderWarningIfBlacklist;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const playerCssClassname: (override?: string
|
|
1
|
+
export declare const playerCssClassname: (override?: string) => string;
|
|
@@ -110,15 +110,13 @@ const DefaultVolumeSlider = ({ volume, isVertical, onBlur, inputRef, setVolume,
|
|
|
110
110
|
width: ${KNOB_SIZE}px;
|
|
111
111
|
}
|
|
112
112
|
`;
|
|
113
|
-
return (jsx_runtime_1.jsxs("div", { style: sliderContainer, children: [
|
|
114
|
-
jsx_runtime_1.jsx("style", {
|
|
113
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: sliderContainer, children: [(0, jsx_runtime_1.jsx)("style", {
|
|
115
114
|
// eslint-disable-next-line react/no-danger
|
|
116
115
|
dangerouslySetInnerHTML: {
|
|
117
116
|
__html: sliderStyle,
|
|
118
|
-
} }), jsx_runtime_1.jsx("input", { ref: inputRef, "aria-label": "Change volume", className: randomClass, max: 1, min: 0, onBlur: onBlur, onChange: onVolumeChange, step: 0.01, type: "range", value: volume, style: inputStyle })
|
|
119
|
-
] }));
|
|
117
|
+
} }), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, "aria-label": "Change volume", className: randomClass, max: 1, min: 0, onBlur: onBlur, onChange: onVolumeChange, step: 0.01, type: "range", value: volume, style: inputStyle })] }));
|
|
120
118
|
};
|
|
121
119
|
const renderDefaultVolumeSlider = (props) => {
|
|
122
|
-
return jsx_runtime_1.jsx(DefaultVolumeSlider, { ...props });
|
|
120
|
+
return (0, jsx_runtime_1.jsx)(DefaultVolumeSlider, { ...props });
|
|
123
121
|
};
|
|
124
122
|
exports.renderDefaultVolumeSlider = renderDefaultVolumeSlider;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LogLevel } from 'remotion';
|
|
1
2
|
export declare const setGlobalTimeAnchor: ({ audioContext, audioSyncAnchor, absoluteTimeInSeconds, globalPlaybackRate, logLevel, force, }: {
|
|
2
3
|
audioContext: AudioContext;
|
|
3
4
|
audioSyncAnchor: {
|
|
@@ -5,6 +6,6 @@ export declare const setGlobalTimeAnchor: ({ audioContext, audioSyncAnchor, abso
|
|
|
5
6
|
};
|
|
6
7
|
absoluteTimeInSeconds: number;
|
|
7
8
|
globalPlaybackRate: number;
|
|
8
|
-
logLevel:
|
|
9
|
+
logLevel: LogLevel;
|
|
9
10
|
force: boolean;
|
|
10
11
|
}) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useHoverState: (ref:
|
|
1
|
+
export declare const useHoverState: (ref: React.RefObject<HTMLDivElement | null>, hideControlsWhenPointerDoesntMove: boolean | number) => boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BrowserMediaControlsBehavior } from './browser-mediasession.js';
|
|
2
|
+
import { type UsePlayerMethods } from './use-player-methods.js';
|
|
2
3
|
export declare const usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, muted, }: {
|
|
3
4
|
loop: boolean;
|
|
4
5
|
playbackRate: number;
|
|
@@ -6,6 +7,6 @@ export declare const usePlayback: ({ loop, playbackRate, moveToBeginningWhenEnde
|
|
|
6
7
|
inFrame: number | null;
|
|
7
8
|
outFrame: number | null;
|
|
8
9
|
browserMediaControlsBehavior: BrowserMediaControlsBehavior;
|
|
9
|
-
getCurrentFrame:
|
|
10
|
+
getCurrentFrame: UsePlayerMethods['getCurrentFrame'];
|
|
10
11
|
muted: boolean;
|
|
11
12
|
}) => void;
|
package/dist/cjs/use-playback.js
CHANGED
|
@@ -23,7 +23,11 @@ const shouldForceAnchorChange = (newState) => {
|
|
|
23
23
|
throw new Error(`Unexpected audio context state: ${newState}`);
|
|
24
24
|
};
|
|
25
25
|
const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, outFrame, browserMediaControlsBehavior, getCurrentFrame, muted, }) => {
|
|
26
|
+
var _a, _b, _c;
|
|
26
27
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
28
|
+
const fps = (_a = config === null || config === void 0 ? void 0 : config.fps) !== null && _a !== void 0 ? _a : null;
|
|
29
|
+
const durationInFrames = (_b = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _b !== void 0 ? _b : null;
|
|
30
|
+
const compositionId = (_c = config === null || config === void 0 ? void 0 : config.id) !== null && _c !== void 0 ? _c : null;
|
|
27
31
|
const frame = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
28
32
|
const playing = remotion_1.Internals.usePlaying();
|
|
29
33
|
const { pause, emitter, isPlaying } = (0, use_player_methods_js_1.usePlayerMethods)();
|
|
@@ -38,6 +42,8 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
38
42
|
const isBackgroundedRef = (0, is_backgrounded_js_1.useIsBackgrounded)();
|
|
39
43
|
const lastTimeUpdateTimestamp = (0, react_2.useRef)(0);
|
|
40
44
|
const playbackClockRef = (0, react_2.useRef)(null);
|
|
45
|
+
const previousMutedRef = (0, react_2.useRef)(muted);
|
|
46
|
+
const anchoredAudioContextRef = (0, react_2.useRef)(null);
|
|
41
47
|
(0, browser_mediasession_js_1.useBrowserMediaSession)({
|
|
42
48
|
browserMediaControlsBehavior,
|
|
43
49
|
playbackRate,
|
|
@@ -52,7 +58,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
52
58
|
if (!sharedAudioContext.audioContext) {
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
|
-
if (
|
|
61
|
+
if (fps === null) {
|
|
56
62
|
return;
|
|
57
63
|
}
|
|
58
64
|
if (muted) {
|
|
@@ -61,7 +67,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
61
67
|
const changed = (0, set_global_time_anchor_js_1.setGlobalTimeAnchor)({
|
|
62
68
|
audioContext: sharedAudioContext.audioContext,
|
|
63
69
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
64
|
-
absoluteTimeInSeconds: frame /
|
|
70
|
+
absoluteTimeInSeconds: frame / fps,
|
|
65
71
|
globalPlaybackRate: playbackRate,
|
|
66
72
|
logLevel,
|
|
67
73
|
force: false,
|
|
@@ -69,7 +75,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
69
75
|
if (changed) {
|
|
70
76
|
sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
|
|
71
77
|
}
|
|
72
|
-
}, [
|
|
78
|
+
}, [fps, frame, logLevel, playbackRate, sharedAudioContext, muted]);
|
|
73
79
|
// When the audio context is suspended, we use the opportunity to
|
|
74
80
|
// re-anchor the time to be exact.
|
|
75
81
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -77,7 +83,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
77
83
|
if (!audioContext) {
|
|
78
84
|
return;
|
|
79
85
|
}
|
|
80
|
-
if (
|
|
86
|
+
if (fps === null) {
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
if (muted) {
|
|
@@ -89,7 +95,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
89
95
|
const changed = (0, set_global_time_anchor_js_1.setGlobalTimeAnchor)({
|
|
90
96
|
audioContext,
|
|
91
97
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
92
|
-
absoluteTimeInSeconds: getCurrentFrame() /
|
|
98
|
+
absoluteTimeInSeconds: getCurrentFrame() / fps,
|
|
93
99
|
globalPlaybackRate: playbackRate,
|
|
94
100
|
logLevel,
|
|
95
101
|
force: true,
|
|
@@ -103,18 +109,14 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
103
109
|
return () => {
|
|
104
110
|
audioContext === null || audioContext === void 0 ? void 0 : audioContext.removeEventListener('statechange', callback);
|
|
105
111
|
};
|
|
106
|
-
}, [
|
|
107
|
-
config,
|
|
108
|
-
getCurrentFrame,
|
|
109
|
-
logLevel,
|
|
110
|
-
muted,
|
|
111
|
-
playbackRate,
|
|
112
|
-
sharedAudioContext,
|
|
113
|
-
]);
|
|
112
|
+
}, [fps, getCurrentFrame, logLevel, muted, playbackRate, sharedAudioContext]);
|
|
114
113
|
(0, react_2.useEffect)(() => {
|
|
115
114
|
var _a;
|
|
116
115
|
var _b;
|
|
117
|
-
|
|
116
|
+
const wasMuted = previousMutedRef.current;
|
|
117
|
+
previousMutedRef.current = muted;
|
|
118
|
+
if (fps === null || durationInFrames === null || compositionId === null) {
|
|
119
|
+
playbackClockRef.current = null;
|
|
118
120
|
return;
|
|
119
121
|
}
|
|
120
122
|
if (!playing) {
|
|
@@ -122,39 +124,45 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
122
124
|
(_a = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.suspend) === null || _a === void 0 ? void 0 : _a.call(sharedAudioContext);
|
|
123
125
|
return;
|
|
124
126
|
}
|
|
125
|
-
//
|
|
127
|
+
// Duration and range changes update the endpoint without losing elapsed
|
|
128
|
+
// sub-frame time. A different composition or timebase needs a fresh clock.
|
|
126
129
|
const previousClock = playbackClockRef.current;
|
|
127
|
-
const
|
|
128
|
-
previousClock.
|
|
129
|
-
previousClock.
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
const shouldRestartClock = previousClock === null ||
|
|
131
|
+
previousClock.compositionId !== compositionId ||
|
|
132
|
+
previousClock.fps !== fps ||
|
|
133
|
+
previousClock.playbackRate !== playbackRate;
|
|
134
|
+
const clock = shouldRestartClock
|
|
135
|
+
? {
|
|
136
|
+
compositionId,
|
|
132
137
|
startedTime: performance.now(),
|
|
133
138
|
framesAdvanced: 0,
|
|
134
|
-
fps
|
|
139
|
+
fps,
|
|
135
140
|
playbackRate,
|
|
136
|
-
}
|
|
141
|
+
}
|
|
142
|
+
: previousClock;
|
|
137
143
|
playbackClockRef.current = clock;
|
|
138
144
|
if ((sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext._experimentalKeepAudioContextAlive) &&
|
|
139
145
|
sharedAudioContext.audioContext &&
|
|
140
146
|
!muted) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
// anchor and reschedule.
|
|
147
|
+
const didUnmute = wasMuted && !muted;
|
|
148
|
+
const didReplaceAudioContext = anchoredAudioContextRef.current !== sharedAudioContext.audioContext;
|
|
149
|
+
const shouldRescheduleAudio = shouldRestartClock || didUnmute || didReplaceAudioContext;
|
|
150
|
+
// The native clock keeps running through pauses and muted playback.
|
|
151
|
+
// These transitions need an exact anchor, as does a replacement context
|
|
152
|
+
// with its own time origin. Other effect re-runs use the drift tolerance
|
|
153
|
+
// so duration changes do not introduce frame-quantized audio shifts.
|
|
149
154
|
const changed = (0, set_global_time_anchor_js_1.setGlobalTimeAnchor)({
|
|
150
155
|
audioContext: sharedAudioContext.audioContext,
|
|
151
156
|
audioSyncAnchor: sharedAudioContext.audioSyncAnchor,
|
|
152
|
-
absoluteTimeInSeconds: getCurrentFrame() /
|
|
157
|
+
absoluteTimeInSeconds: getCurrentFrame() / fps,
|
|
153
158
|
globalPlaybackRate: playbackRate,
|
|
154
159
|
logLevel,
|
|
155
|
-
force:
|
|
160
|
+
force: shouldRescheduleAudio,
|
|
156
161
|
});
|
|
157
|
-
|
|
162
|
+
anchoredAudioContextRef.current = sharedAudioContext.audioContext;
|
|
163
|
+
// A changed timebase can invalidate queued audio even if the anchor
|
|
164
|
+
// happens to remain numerically equal (for example at frame zero).
|
|
165
|
+
if (changed || shouldRescheduleAudio) {
|
|
158
166
|
sharedAudioContext.audioSyncAnchorEmitter.dispatch('changed');
|
|
159
167
|
}
|
|
160
168
|
}
|
|
@@ -191,7 +199,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
191
199
|
(_b = sharedAudioContext === null || sharedAudioContext === void 0 ? void 0 : sharedAudioContext.resume) === null || _b === void 0 ? void 0 : _b.call(sharedAudioContext);
|
|
192
200
|
}
|
|
193
201
|
const time = performance.now() - clock.startedTime;
|
|
194
|
-
const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame :
|
|
202
|
+
const actualLastFrame = outFrame !== null && outFrame !== void 0 ? outFrame : durationInFrames - 1;
|
|
195
203
|
const actualFirstFrame = inFrame !== null && inFrame !== void 0 ? inFrame : 0;
|
|
196
204
|
const seekRevision = (_c = seek === null || seek === void 0 ? void 0 : seek.revision.current) !== null && _c !== void 0 ? _c : null;
|
|
197
205
|
if (seekRevision !== lastSeekRevision) {
|
|
@@ -204,7 +212,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
204
212
|
time,
|
|
205
213
|
currentFrame,
|
|
206
214
|
playbackSpeed: playbackRate,
|
|
207
|
-
fps
|
|
215
|
+
fps,
|
|
208
216
|
actualFirstFrame,
|
|
209
217
|
actualLastFrame,
|
|
210
218
|
framesAdvanced: clock.framesAdvanced,
|
|
@@ -219,7 +227,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
219
227
|
: nextFrame;
|
|
220
228
|
if (frameToDisplay !== currentFrame && !isBuffering()) {
|
|
221
229
|
playbackFrame = frameToDisplay;
|
|
222
|
-
setFrameFromPlayback((c) => ({ ...c, [
|
|
230
|
+
setFrameFromPlayback((c) => ({ ...c, [compositionId]: frameToDisplay }));
|
|
223
231
|
}
|
|
224
232
|
if (hasEnded) {
|
|
225
233
|
stop();
|
|
@@ -280,7 +288,7 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
280
288
|
reqAnimFrameCall = {
|
|
281
289
|
type: 'timeout',
|
|
282
290
|
// Note: Most likely, this will not be 1000 / fps, but the browser will throttle it to ~1/sec.
|
|
283
|
-
id: setTimeout(callback, 1000 /
|
|
291
|
+
id: setTimeout(callback, 1000 / fps),
|
|
284
292
|
};
|
|
285
293
|
return;
|
|
286
294
|
}
|
|
@@ -302,7 +310,9 @@ const usePlayback = ({ loop, playbackRate, moveToBeginningWhenEnded, inFrame, ou
|
|
|
302
310
|
stop();
|
|
303
311
|
};
|
|
304
312
|
}, [
|
|
305
|
-
|
|
313
|
+
compositionId,
|
|
314
|
+
durationInFrames,
|
|
315
|
+
fps,
|
|
306
316
|
loop,
|
|
307
317
|
pause,
|
|
308
318
|
playing,
|
|
@@ -5,13 +5,15 @@ const react_1 = require("react");
|
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const emitter_context_js_1 = require("./emitter-context.js");
|
|
7
7
|
const usePlayerMethods = () => {
|
|
8
|
-
var _a;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
const seekFrame = remotion_1.Internals.Timeline.useTimelineSeekFrame();
|
|
10
10
|
const { setPlaying, frameRef, audioAndVideoTags, isPlaying: readIsPlaying, isBuffering, } = (0, react_1.useContext)(remotion_1.Internals.SetTimelineContext);
|
|
11
11
|
const audioContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioContext);
|
|
12
12
|
const audioTagsContext = (0, react_1.useContext)(remotion_1.Internals.SharedAudioTagsContext);
|
|
13
13
|
const environment = (0, remotion_1.useRemotionEnvironment)();
|
|
14
14
|
const video = remotion_1.Internals.useVideo();
|
|
15
|
+
const videoId = (_a = video === null || video === void 0 ? void 0 : video.id) !== null && _a !== void 0 ? _a : null;
|
|
16
|
+
const videoDurationInFrames = (_b = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _b !== void 0 ? _b : null;
|
|
15
17
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
16
18
|
const emitter = (0, react_1.useContext)(emitter_context_js_1.PlayerEventEmitterContext);
|
|
17
19
|
const playStart = (0, react_1.useRef)(0);
|
|
@@ -22,16 +24,16 @@ const usePlayerMethods = () => {
|
|
|
22
24
|
}
|
|
23
25
|
const getCurrentFrame = (0, react_1.useCallback)(() => {
|
|
24
26
|
var _a, _b, _c;
|
|
25
|
-
if (
|
|
27
|
+
if (videoId === null || videoDurationInFrames === null) {
|
|
26
28
|
return ((_a = fallbackFrame.current) !== null && _a !== void 0 ? _a : (typeof window === 'undefined'
|
|
27
29
|
? 0
|
|
28
30
|
: ((_b = window.remotion_initialFrame) !== null && _b !== void 0 ? _b : 0)));
|
|
29
31
|
}
|
|
30
|
-
const unclamped = (_c = frameRef.current[
|
|
32
|
+
const unclamped = (_c = frameRef.current[videoId]) !== null && _c !== void 0 ? _c : (environment.isPlayer
|
|
31
33
|
? 0
|
|
32
|
-
: remotion_1.Internals.Timeline.getFrameForComposition(
|
|
33
|
-
return remotion_1.Internals.Timeline.clampFrameToCompositionRange(unclamped,
|
|
34
|
-
}, [environment.isPlayer, frameRef,
|
|
34
|
+
: remotion_1.Internals.Timeline.getFrameForComposition(videoId));
|
|
35
|
+
return remotion_1.Internals.Timeline.clampFrameToCompositionRange(unclamped, videoDurationInFrames);
|
|
36
|
+
}, [environment.isPlayer, frameRef, videoId, videoDurationInFrames]);
|
|
35
37
|
const seek = (0, react_1.useCallback)((newFrame) => {
|
|
36
38
|
const frameToSeekTo = config
|
|
37
39
|
? remotion_1.Internals.TimelinePosition.clampFrameToCompositionRange(newFrame, config.durationInFrames)
|
|
@@ -120,8 +122,7 @@ const usePlayerMethods = () => {
|
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
}, [config, emitter, frameRef, readIsPlaying, setPlaying, seekFrame]);
|
|
123
|
-
const
|
|
124
|
-
const lastFrame = ((_a = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
|
|
125
|
+
const lastFrame = ((_c = config === null || config === void 0 ? void 0 : config.durationInFrames) !== null && _c !== void 0 ? _c : 1) - 1;
|
|
125
126
|
const frameBack = (0, react_1.useCallback)((frames) => {
|
|
126
127
|
var _a, _b;
|
|
127
128
|
if (!videoId) {
|