remotion 4.0.237 → 4.0.240
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/Img.js +30 -19
- package/dist/cjs/audio/AudioForPreview.js +1 -0
- package/dist/cjs/get-remotion-environment.d.ts +1 -0
- package/dist/cjs/get-remotion-environment.js +2 -0
- package/dist/cjs/use-media-buffering.js +12 -0
- package/dist/cjs/use-media-in-timeline.d.ts +2 -1
- package/dist/cjs/use-media-in-timeline.js +15 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideoForRendering.js +1 -0
- package/dist/cjs/video/VideoForPreview.js +1 -0
- package/dist/esm/index.mjs +54 -22
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/Img.js
CHANGED
|
@@ -75,6 +75,10 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
|
|
|
75
75
|
}
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
+
const { current } = imageRef;
|
|
79
|
+
if (!current) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
78
82
|
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + actualSrc, {
|
|
79
83
|
retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
|
|
80
84
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
|
|
@@ -82,12 +86,12 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
|
|
|
82
86
|
const unblock = pauseWhenLoading && !isPremounting
|
|
83
87
|
? delayPlayback().unblock
|
|
84
88
|
: () => undefined;
|
|
85
|
-
const { current } = imageRef;
|
|
86
89
|
let unmounted = false;
|
|
87
90
|
const onComplete = () => {
|
|
88
91
|
var _a, _b, _c, _d;
|
|
89
92
|
// the decode() promise isn't cancelable -- it may still resolve after unmounting
|
|
90
93
|
if (unmounted) {
|
|
94
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
91
95
|
return;
|
|
92
96
|
}
|
|
93
97
|
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
@@ -96,32 +100,39 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
|
|
|
96
100
|
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
97
101
|
}
|
|
98
102
|
if (current) {
|
|
99
|
-
current.src = actualSrc;
|
|
100
103
|
onImageFrame === null || onImageFrame === void 0 ? void 0 : onImageFrame(current);
|
|
101
104
|
}
|
|
102
105
|
unblock();
|
|
103
106
|
(0, delay_render_js_1.continueRender)(newHandle);
|
|
104
107
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
if (!imageRef.current) {
|
|
109
|
+
onComplete();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
current.src = actualSrc;
|
|
113
|
+
if (current.complete) {
|
|
114
|
+
onComplete();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
current
|
|
118
|
+
.decode()
|
|
119
|
+
.then(onComplete)
|
|
120
|
+
.catch((err) => {
|
|
121
|
+
// fall back to onload event if decode() fails
|
|
122
|
+
// eslint-disable-next-line no-console
|
|
123
|
+
console.warn(err);
|
|
124
|
+
if (current.complete) {
|
|
125
|
+
onComplete();
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
current.addEventListener('load', onComplete);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
121
132
|
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
122
133
|
return () => {
|
|
123
134
|
unmounted = true;
|
|
124
|
-
|
|
135
|
+
current.removeEventListener('load', onComplete);
|
|
125
136
|
unblock();
|
|
126
137
|
(0, delay_render_js_1.continueRender)(newHandle);
|
|
127
138
|
};
|
|
@@ -87,6 +87,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
87
87
|
showInTimeline,
|
|
88
88
|
premountDisplay: null,
|
|
89
89
|
onAutoPlayError: null,
|
|
90
|
+
isPremounting: Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting),
|
|
90
91
|
});
|
|
91
92
|
(0, use_media_playback_js_1.useMediaPlayback)({
|
|
92
93
|
mediaRef: audioRef,
|
|
@@ -22,10 +22,12 @@ const getRemotionEnvironment = () => {
|
|
|
22
22
|
typeof window !== 'undefined' &&
|
|
23
23
|
typeof window.remotion_puppeteerTimeout !== 'undefined'));
|
|
24
24
|
const isStudio = typeof window !== 'undefined' && window.remotion_isStudio;
|
|
25
|
+
const isReadOnlyStudio = typeof window !== 'undefined' && window.remotion_isReadOnlyStudio;
|
|
25
26
|
return {
|
|
26
27
|
isStudio,
|
|
27
28
|
isRendering,
|
|
28
29
|
isPlayer,
|
|
30
|
+
isReadOnlyStudio,
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
33
|
exports.getRemotionEnvironment = getRemotionEnvironment;
|
|
@@ -17,6 +17,18 @@ const useMediaBuffering = ({ element, shouldBuffer, isPremounting, }) => {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
if (isPremounting) {
|
|
20
|
+
// Needed by iOS Safari which will not load by default
|
|
21
|
+
// and therefore not fire the canplay event.
|
|
22
|
+
// Be cautious about using `current.load()` as it will
|
|
23
|
+
// reset if a video is already playing.
|
|
24
|
+
// Therefore only calling it after checking if the video
|
|
25
|
+
// has no future data.
|
|
26
|
+
// Breaks on Firefox though: https://github.com/remotion-dev/remotion/issues/3915
|
|
27
|
+
if (current.readyState < current.HAVE_FUTURE_DATA) {
|
|
28
|
+
if (!navigator.userAgent.includes('Firefox/')) {
|
|
29
|
+
current.load();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
return;
|
|
21
33
|
}
|
|
22
34
|
const cleanup = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
import type { VolumeProp } from './volume-prop.js';
|
|
3
|
-
export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, onAutoPlayError, }: {
|
|
3
|
+
export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, onAutoPlayError, isPremounting, }: {
|
|
4
4
|
volume: VolumeProp | undefined;
|
|
5
5
|
mediaVolume: number;
|
|
6
6
|
mediaRef: RefObject<HTMLAudioElement | HTMLVideoElement | null>;
|
|
@@ -13,4 +13,5 @@ export declare const useMediaInTimeline: ({ volume, mediaVolume, mediaRef, src,
|
|
|
13
13
|
showInTimeline: boolean;
|
|
14
14
|
premountDisplay: number | null;
|
|
15
15
|
onAutoPlayError: null | (() => void);
|
|
16
|
+
isPremounting: boolean;
|
|
16
17
|
}) => void;
|
|
@@ -21,14 +21,14 @@ const warnOnce = (message) => {
|
|
|
21
21
|
console.warn(message);
|
|
22
22
|
didWarn[message] = true;
|
|
23
23
|
};
|
|
24
|
-
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, onAutoPlayError, }) => {
|
|
24
|
+
const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, playbackRate, displayName, id, stack, showInTimeline, premountDisplay, onAutoPlayError, isPremounting, }) => {
|
|
25
25
|
const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
|
|
26
26
|
const { rootId, audioAndVideoTags } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
|
|
27
27
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
28
28
|
const actualFrom = parentSequence
|
|
29
29
|
? parentSequence.relativeFrom + parentSequence.cumulatedFrom
|
|
30
30
|
: 0;
|
|
31
|
-
const
|
|
31
|
+
const { imperativePlaying } = (0, react_1.useContext)(timeline_position_state_js_1.TimelineContext);
|
|
32
32
|
const startsAt = (0, use_audio_frame_js_1.useMediaStartsAt)();
|
|
33
33
|
const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
|
|
34
34
|
const [initialVolume] = (0, react_1.useState)(() => volume);
|
|
@@ -121,10 +121,13 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
121
121
|
const tag = {
|
|
122
122
|
id,
|
|
123
123
|
play: () => {
|
|
124
|
-
if (!
|
|
124
|
+
if (!imperativePlaying.current) {
|
|
125
125
|
// Don't play if for example in a <Freeze> state.
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
+
if (isPremounting) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
128
131
|
return (0, play_and_handle_not_allowed_error_js_1.playAndHandleNotAllowedError)(mediaRef, mediaType, onAutoPlayError);
|
|
129
132
|
},
|
|
130
133
|
};
|
|
@@ -132,6 +135,14 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
132
135
|
return () => {
|
|
133
136
|
audioAndVideoTags.current = audioAndVideoTags.current.filter((a) => a.id !== id);
|
|
134
137
|
};
|
|
135
|
-
}, [
|
|
138
|
+
}, [
|
|
139
|
+
audioAndVideoTags,
|
|
140
|
+
id,
|
|
141
|
+
mediaRef,
|
|
142
|
+
mediaType,
|
|
143
|
+
onAutoPlayError,
|
|
144
|
+
imperativePlaying,
|
|
145
|
+
isPremounting,
|
|
146
|
+
]);
|
|
136
147
|
};
|
|
137
148
|
exports.useMediaInTimeline = useMediaInTimeline;
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -46,6 +46,7 @@ const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
|
|
|
46
46
|
showInTimeline,
|
|
47
47
|
premountDisplay: null,
|
|
48
48
|
onAutoPlayError: onAutoPlayError !== null && onAutoPlayError !== void 0 ? onAutoPlayError : null,
|
|
49
|
+
isPremounting: Boolean(parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.premounting),
|
|
49
50
|
});
|
|
50
51
|
(0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
|
|
51
52
|
volumePropFrame,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -46,10 +46,12 @@ var getRemotionEnvironment = () => {
|
|
|
46
46
|
const isPlayer = typeof window !== "undefined" && window.remotion_isPlayer;
|
|
47
47
|
const isRendering = typeof window !== "undefined" && typeof window.process !== "undefined" && typeof window.process.env !== "undefined" && (window.process[getEnvString()][getNodeEnvString()] === "test" || window.process[getEnvString()][getNodeEnvString()] === "production" && typeof window !== "undefined" && typeof window.remotion_puppeteerTimeout !== "undefined");
|
|
48
48
|
const isStudio = typeof window !== "undefined" && window.remotion_isStudio;
|
|
49
|
+
const isReadOnlyStudio = typeof window !== "undefined" && window.remotion_isReadOnlyStudio;
|
|
49
50
|
return {
|
|
50
51
|
isStudio,
|
|
51
52
|
isRendering,
|
|
52
|
-
isPlayer
|
|
53
|
+
isPlayer,
|
|
54
|
+
isReadOnlyStudio
|
|
53
55
|
};
|
|
54
56
|
};
|
|
55
57
|
|
|
@@ -102,7 +104,7 @@ function truthy(value) {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
// src/version.ts
|
|
105
|
-
var VERSION = "4.0.
|
|
107
|
+
var VERSION = "4.0.240";
|
|
106
108
|
|
|
107
109
|
// src/multiple-versions-warning.ts
|
|
108
110
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -2156,13 +2158,14 @@ var useMediaInTimeline = ({
|
|
|
2156
2158
|
stack,
|
|
2157
2159
|
showInTimeline,
|
|
2158
2160
|
premountDisplay,
|
|
2159
|
-
onAutoPlayError
|
|
2161
|
+
onAutoPlayError,
|
|
2162
|
+
isPremounting
|
|
2160
2163
|
}) => {
|
|
2161
2164
|
const videoConfig = useVideoConfig();
|
|
2162
2165
|
const { rootId, audioAndVideoTags } = useContext14(TimelineContext);
|
|
2163
2166
|
const parentSequence = useContext14(SequenceContext);
|
|
2164
2167
|
const actualFrom = parentSequence ? parentSequence.relativeFrom + parentSequence.cumulatedFrom : 0;
|
|
2165
|
-
const
|
|
2168
|
+
const { imperativePlaying } = useContext14(TimelineContext);
|
|
2166
2169
|
const startsAt = useMediaStartsAt();
|
|
2167
2170
|
const { registerSequence, unregisterSequence } = useContext14(SequenceManager);
|
|
2168
2171
|
const [initialVolume] = useState8(() => volume);
|
|
@@ -2248,7 +2251,10 @@ var useMediaInTimeline = ({
|
|
|
2248
2251
|
const tag = {
|
|
2249
2252
|
id,
|
|
2250
2253
|
play: () => {
|
|
2251
|
-
if (!
|
|
2254
|
+
if (!imperativePlaying.current) {
|
|
2255
|
+
return;
|
|
2256
|
+
}
|
|
2257
|
+
if (isPremounting) {
|
|
2252
2258
|
return;
|
|
2253
2259
|
}
|
|
2254
2260
|
return playAndHandleNotAllowedError(mediaRef, mediaType, onAutoPlayError);
|
|
@@ -2258,7 +2264,15 @@ var useMediaInTimeline = ({
|
|
|
2258
2264
|
return () => {
|
|
2259
2265
|
audioAndVideoTags.current = audioAndVideoTags.current.filter((a) => a.id !== id);
|
|
2260
2266
|
};
|
|
2261
|
-
}, [
|
|
2267
|
+
}, [
|
|
2268
|
+
audioAndVideoTags,
|
|
2269
|
+
id,
|
|
2270
|
+
mediaRef,
|
|
2271
|
+
mediaType,
|
|
2272
|
+
onAutoPlayError,
|
|
2273
|
+
imperativePlaying,
|
|
2274
|
+
isPremounting
|
|
2275
|
+
]);
|
|
2262
2276
|
};
|
|
2263
2277
|
|
|
2264
2278
|
// src/use-media-playback.ts
|
|
@@ -2454,6 +2468,11 @@ var useMediaBuffering = ({
|
|
|
2454
2468
|
return;
|
|
2455
2469
|
}
|
|
2456
2470
|
if (isPremounting) {
|
|
2471
|
+
if (current.readyState < current.HAVE_FUTURE_DATA) {
|
|
2472
|
+
if (!navigator.userAgent.includes("Firefox/")) {
|
|
2473
|
+
current.load();
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2457
2476
|
return;
|
|
2458
2477
|
}
|
|
2459
2478
|
const cleanup = () => {
|
|
@@ -3394,7 +3413,8 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
3394
3413
|
stack: _remotionInternalStack,
|
|
3395
3414
|
showInTimeline,
|
|
3396
3415
|
premountDisplay: null,
|
|
3397
|
-
onAutoPlayError: null
|
|
3416
|
+
onAutoPlayError: null,
|
|
3417
|
+
isPremounting: Boolean(sequenceContext?.premounting)
|
|
3398
3418
|
});
|
|
3399
3419
|
useMediaPlayback({
|
|
3400
3420
|
mediaRef: audioRef,
|
|
@@ -4474,6 +4494,10 @@ var ImgRefForwarding = ({
|
|
|
4474
4494
|
}
|
|
4475
4495
|
return;
|
|
4476
4496
|
}
|
|
4497
|
+
const { current } = imageRef;
|
|
4498
|
+
if (!current) {
|
|
4499
|
+
return;
|
|
4500
|
+
}
|
|
4477
4501
|
const newHandle = delayRender("Loading <Img> with src=" + actualSrc, {
|
|
4478
4502
|
retries: delayRenderRetries ?? undefined,
|
|
4479
4503
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
@@ -4481,10 +4505,10 @@ var ImgRefForwarding = ({
|
|
|
4481
4505
|
const unblock = pauseWhenLoading && !isPremounting ? delayPlayback().unblock : () => {
|
|
4482
4506
|
return;
|
|
4483
4507
|
};
|
|
4484
|
-
const { current } = imageRef;
|
|
4485
4508
|
let unmounted = false;
|
|
4486
4509
|
const onComplete = () => {
|
|
4487
4510
|
if (unmounted) {
|
|
4511
|
+
continueRender(newHandle);
|
|
4488
4512
|
return;
|
|
4489
4513
|
}
|
|
4490
4514
|
if ((errors.current[imageRef.current?.src] ?? 0) > 0) {
|
|
@@ -4492,25 +4516,31 @@ var ImgRefForwarding = ({
|
|
|
4492
4516
|
console.info(`Retry successful - ${imageRef.current?.src} is now loaded`);
|
|
4493
4517
|
}
|
|
4494
4518
|
if (current) {
|
|
4495
|
-
current.src = actualSrc;
|
|
4496
4519
|
onImageFrame?.(current);
|
|
4497
4520
|
}
|
|
4498
4521
|
unblock();
|
|
4499
4522
|
continueRender(newHandle);
|
|
4500
4523
|
};
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4524
|
+
if (!imageRef.current) {
|
|
4525
|
+
onComplete();
|
|
4526
|
+
return;
|
|
4527
|
+
}
|
|
4528
|
+
current.src = actualSrc;
|
|
4529
|
+
if (current.complete) {
|
|
4530
|
+
onComplete();
|
|
4531
|
+
} else {
|
|
4532
|
+
current.decode().then(onComplete).catch((err) => {
|
|
4533
|
+
console.warn(err);
|
|
4534
|
+
if (current.complete) {
|
|
4535
|
+
onComplete();
|
|
4536
|
+
} else {
|
|
4537
|
+
current.addEventListener("load", onComplete);
|
|
4538
|
+
}
|
|
4539
|
+
});
|
|
4540
|
+
}
|
|
4511
4541
|
return () => {
|
|
4512
4542
|
unmounted = true;
|
|
4513
|
-
|
|
4543
|
+
current.removeEventListener("load", onComplete);
|
|
4514
4544
|
unblock();
|
|
4515
4545
|
continueRender(newHandle);
|
|
4516
4546
|
};
|
|
@@ -5843,7 +5873,8 @@ var OffthreadVideoForRendering = ({
|
|
|
5843
5873
|
const execute = async () => {
|
|
5844
5874
|
try {
|
|
5845
5875
|
const res = await fetch(actualSrc, {
|
|
5846
|
-
signal: controller.signal
|
|
5876
|
+
signal: controller.signal,
|
|
5877
|
+
cache: "no-store"
|
|
5847
5878
|
});
|
|
5848
5879
|
if (res.status !== 200) {
|
|
5849
5880
|
if (res.status === 500) {
|
|
@@ -6019,7 +6050,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6019
6050
|
stack: _remotionInternalStack,
|
|
6020
6051
|
showInTimeline,
|
|
6021
6052
|
premountDisplay: null,
|
|
6022
|
-
onAutoPlayError: onAutoPlayError ?? null
|
|
6053
|
+
onAutoPlayError: onAutoPlayError ?? null,
|
|
6054
|
+
isPremounting: Boolean(parentSequence?.premounting)
|
|
6023
6055
|
});
|
|
6024
6056
|
useSyncVolumeWithMediaTag({
|
|
6025
6057
|
volumePropFrame,
|
package/dist/esm/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
|
|
4
4
|
},
|
|
5
5
|
"name": "remotion",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.240",
|
|
7
7
|
"description": "Make videos programmatically",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack": "5.96.1",
|
|
30
30
|
"zod": "3.22.3",
|
|
31
31
|
"eslint": "9.14.0",
|
|
32
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
32
|
+
"@remotion/eslint-config-internal": "4.0.240"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"remotion",
|