remotion 4.0.354 → 4.0.356
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/CompositionManager.d.ts +1 -1
- package/dist/cjs/Sequence.js +4 -0
- package/dist/cjs/SequenceContext.d.ts +2 -0
- package/dist/cjs/audio/Audio.js +3 -3
- package/dist/cjs/audio/AudioForPreview.js +3 -3
- package/dist/cjs/audio/AudioForRendering.js +1 -1
- package/dist/cjs/internals.d.ts +5 -1
- package/dist/cjs/internals.js +2 -0
- package/dist/cjs/validate-media-props.d.ts +5 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideo.d.ts +2 -1
- package/dist/cjs/video/OffthreadVideo.js +18 -12
- package/dist/cjs/video/OffthreadVideoForRendering.d.ts +2 -2
- package/dist/cjs/video/OffthreadVideoForRendering.js +7 -7
- package/dist/cjs/video/Video.d.ts +1 -2
- package/dist/cjs/video/Video.js +3 -3
- package/dist/cjs/video/VideoForPreview.js +4 -4
- package/dist/cjs/video/VideoForRendering.js +1 -1
- package/dist/cjs/video/props.d.ts +39 -34
- package/dist/esm/index.mjs +473 -383
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/dist/cjs/video/use-audio-channel-index.d.ts +0 -4
- package/dist/cjs/video/use-audio-channel-index.js +0 -13
- package/dist/esm/index.mjs.map +0 -137
package/dist/esm/index.mjs
CHANGED
|
@@ -105,7 +105,7 @@ function truthy(value) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// src/version.ts
|
|
108
|
-
var VERSION = "4.0.
|
|
108
|
+
var VERSION = "4.0.356";
|
|
109
109
|
|
|
110
110
|
// src/multiple-versions-warning.ts
|
|
111
111
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -1413,7 +1413,9 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1413
1413
|
height: height ?? parentSequence?.height ?? null,
|
|
1414
1414
|
width: width ?? parentSequence?.width ?? null,
|
|
1415
1415
|
premounting,
|
|
1416
|
-
postmounting
|
|
1416
|
+
postmounting,
|
|
1417
|
+
premountDisplay: premountDisplay ?? null,
|
|
1418
|
+
postmountDisplay: postmountDisplay ?? null
|
|
1417
1419
|
};
|
|
1418
1420
|
}, [
|
|
1419
1421
|
cumulatedFrom,
|
|
@@ -1424,7 +1426,9 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
1424
1426
|
height,
|
|
1425
1427
|
width,
|
|
1426
1428
|
premounting,
|
|
1427
|
-
postmounting
|
|
1429
|
+
postmounting,
|
|
1430
|
+
premountDisplay,
|
|
1431
|
+
postmountDisplay
|
|
1428
1432
|
]);
|
|
1429
1433
|
const timelineClipName = useMemo9(() => {
|
|
1430
1434
|
return name ?? "";
|
|
@@ -4600,8 +4604,8 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
4600
4604
|
id: timelineId,
|
|
4601
4605
|
stack: _remotionInternalStack,
|
|
4602
4606
|
showInTimeline,
|
|
4603
|
-
premountDisplay: null,
|
|
4604
|
-
postmountDisplay: null,
|
|
4607
|
+
premountDisplay: sequenceContext?.premountDisplay ?? null,
|
|
4608
|
+
postmountDisplay: sequenceContext?.postmountDisplay ?? null,
|
|
4605
4609
|
onAutoPlayError: null,
|
|
4606
4610
|
isPremounting: Boolean(sequenceContext?.premounting),
|
|
4607
4611
|
isPostmounting: Boolean(sequenceContext?.postmounting)
|
|
@@ -4732,7 +4736,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
|
|
|
4732
4736
|
volume,
|
|
4733
4737
|
mediaFrame: frame,
|
|
4734
4738
|
playbackRate: props.playbackRate ?? 1,
|
|
4735
|
-
toneFrequency: toneFrequency ??
|
|
4739
|
+
toneFrequency: toneFrequency ?? 1,
|
|
4736
4740
|
audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
|
|
4737
4741
|
audioStreamIndex: audioStreamIndex ?? 0
|
|
4738
4742
|
});
|
|
@@ -4864,10 +4868,10 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4864
4868
|
return /* @__PURE__ */ jsx19(Loop, {
|
|
4865
4869
|
layout: "none",
|
|
4866
4870
|
durationInFrames: calculateLoopDuration({
|
|
4867
|
-
endAt: trimAfterValue
|
|
4871
|
+
endAt: trimAfterValue,
|
|
4868
4872
|
mediaDuration: duration,
|
|
4869
4873
|
playbackRate: props.playbackRate ?? 1,
|
|
4870
|
-
startFrom: trimBeforeValue
|
|
4874
|
+
startFrom: trimBeforeValue
|
|
4871
4875
|
}),
|
|
4872
4876
|
children: /* @__PURE__ */ jsx19(Audio, {
|
|
4873
4877
|
...propsOtherThanLoop,
|
|
@@ -4891,7 +4895,7 @@ var AudioRefForwardingFunction = (props, ref) => {
|
|
|
4891
4895
|
})
|
|
4892
4896
|
});
|
|
4893
4897
|
}
|
|
4894
|
-
validateMediaProps(props, "Audio");
|
|
4898
|
+
validateMediaProps({ playbackRate: props.playbackRate, volume: props.volume }, "Audio");
|
|
4895
4899
|
if (environment.isRendering) {
|
|
4896
4900
|
return /* @__PURE__ */ jsx19(AudioForRendering, {
|
|
4897
4901
|
onDuration,
|
|
@@ -6069,24 +6073,251 @@ var useCurrentScale = (options) => {
|
|
|
6069
6073
|
});
|
|
6070
6074
|
};
|
|
6071
6075
|
|
|
6076
|
+
// src/video/OffthreadVideo.tsx
|
|
6077
|
+
import { useCallback as useCallback16 } from "react";
|
|
6078
|
+
|
|
6079
|
+
// src/video/OffthreadVideoForRendering.tsx
|
|
6080
|
+
import {
|
|
6081
|
+
useCallback as useCallback15,
|
|
6082
|
+
useContext as useContext29,
|
|
6083
|
+
useEffect as useEffect18,
|
|
6084
|
+
useLayoutEffect as useLayoutEffect9,
|
|
6085
|
+
useMemo as useMemo26,
|
|
6086
|
+
useState as useState18
|
|
6087
|
+
} from "react";
|
|
6088
|
+
|
|
6089
|
+
// src/video/offthread-video-source.ts
|
|
6090
|
+
var getOffthreadVideoSource = ({
|
|
6091
|
+
src,
|
|
6092
|
+
transparent,
|
|
6093
|
+
currentTime,
|
|
6094
|
+
toneMapped
|
|
6095
|
+
}) => {
|
|
6096
|
+
return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(Math.max(0, currentTime))}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
|
|
6097
|
+
};
|
|
6098
|
+
|
|
6099
|
+
// src/video/OffthreadVideoForRendering.tsx
|
|
6100
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6101
|
+
var OffthreadVideoForRendering = ({
|
|
6102
|
+
onError,
|
|
6103
|
+
volume: volumeProp,
|
|
6104
|
+
playbackRate,
|
|
6105
|
+
src,
|
|
6106
|
+
muted,
|
|
6107
|
+
allowAmplificationDuringRender,
|
|
6108
|
+
transparent,
|
|
6109
|
+
toneMapped,
|
|
6110
|
+
toneFrequency,
|
|
6111
|
+
name,
|
|
6112
|
+
loopVolumeCurveBehavior,
|
|
6113
|
+
delayRenderRetries,
|
|
6114
|
+
delayRenderTimeoutInMilliseconds,
|
|
6115
|
+
onVideoFrame,
|
|
6116
|
+
crossOrigin,
|
|
6117
|
+
audioStreamIndex,
|
|
6118
|
+
...props2
|
|
6119
|
+
}) => {
|
|
6120
|
+
const absoluteFrame = useTimelinePosition();
|
|
6121
|
+
const frame = useCurrentFrame();
|
|
6122
|
+
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
|
|
6123
|
+
const videoConfig = useUnsafeVideoConfig();
|
|
6124
|
+
const sequenceContext = useContext29(SequenceContext);
|
|
6125
|
+
const mediaStartsAt = useMediaStartsAt();
|
|
6126
|
+
const { registerRenderAsset, unregisterRenderAsset } = useContext29(RenderAssetManager);
|
|
6127
|
+
if (!src) {
|
|
6128
|
+
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
6129
|
+
}
|
|
6130
|
+
const id = useMemo26(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
6131
|
+
src,
|
|
6132
|
+
sequenceContext?.cumulatedFrom,
|
|
6133
|
+
sequenceContext?.relativeFrom,
|
|
6134
|
+
sequenceContext?.durationInFrames
|
|
6135
|
+
]);
|
|
6136
|
+
if (!videoConfig) {
|
|
6137
|
+
throw new Error("No video config found");
|
|
6138
|
+
}
|
|
6139
|
+
const volume = evaluateVolume({
|
|
6140
|
+
volume: volumeProp,
|
|
6141
|
+
frame: volumePropsFrame,
|
|
6142
|
+
mediaVolume: 1
|
|
6143
|
+
});
|
|
6144
|
+
warnAboutTooHighVolume(volume);
|
|
6145
|
+
useEffect18(() => {
|
|
6146
|
+
if (!src) {
|
|
6147
|
+
throw new Error("No src passed");
|
|
6148
|
+
}
|
|
6149
|
+
if (!window.remotion_audioEnabled) {
|
|
6150
|
+
return;
|
|
6151
|
+
}
|
|
6152
|
+
if (muted) {
|
|
6153
|
+
return;
|
|
6154
|
+
}
|
|
6155
|
+
if (volume <= 0) {
|
|
6156
|
+
return;
|
|
6157
|
+
}
|
|
6158
|
+
registerRenderAsset({
|
|
6159
|
+
type: "video",
|
|
6160
|
+
src: getAbsoluteSrc(src),
|
|
6161
|
+
id,
|
|
6162
|
+
frame: absoluteFrame,
|
|
6163
|
+
volume,
|
|
6164
|
+
mediaFrame: frame,
|
|
6165
|
+
playbackRate,
|
|
6166
|
+
toneFrequency,
|
|
6167
|
+
audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
|
|
6168
|
+
audioStreamIndex
|
|
6169
|
+
});
|
|
6170
|
+
return () => unregisterRenderAsset(id);
|
|
6171
|
+
}, [
|
|
6172
|
+
muted,
|
|
6173
|
+
src,
|
|
6174
|
+
registerRenderAsset,
|
|
6175
|
+
id,
|
|
6176
|
+
unregisterRenderAsset,
|
|
6177
|
+
volume,
|
|
6178
|
+
frame,
|
|
6179
|
+
absoluteFrame,
|
|
6180
|
+
playbackRate,
|
|
6181
|
+
toneFrequency,
|
|
6182
|
+
sequenceContext?.relativeFrom,
|
|
6183
|
+
audioStreamIndex
|
|
6184
|
+
]);
|
|
6185
|
+
const currentTime = useMemo26(() => {
|
|
6186
|
+
return getExpectedMediaFrameUncorrected({
|
|
6187
|
+
frame,
|
|
6188
|
+
playbackRate: playbackRate || 1,
|
|
6189
|
+
startFrom: -mediaStartsAt
|
|
6190
|
+
}) / videoConfig.fps;
|
|
6191
|
+
}, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
|
|
6192
|
+
const actualSrc = useMemo26(() => {
|
|
6193
|
+
return getOffthreadVideoSource({
|
|
6194
|
+
src,
|
|
6195
|
+
currentTime,
|
|
6196
|
+
transparent,
|
|
6197
|
+
toneMapped
|
|
6198
|
+
});
|
|
6199
|
+
}, [toneMapped, currentTime, src, transparent]);
|
|
6200
|
+
const [imageSrc, setImageSrc] = useState18(null);
|
|
6201
|
+
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
6202
|
+
useLayoutEffect9(() => {
|
|
6203
|
+
if (!window.remotion_videoEnabled) {
|
|
6204
|
+
return;
|
|
6205
|
+
}
|
|
6206
|
+
const cleanup = [];
|
|
6207
|
+
setImageSrc(null);
|
|
6208
|
+
const controller = new AbortController;
|
|
6209
|
+
const newHandle = delayRender2(`Fetching ${actualSrc} from server`, {
|
|
6210
|
+
retries: delayRenderRetries ?? undefined,
|
|
6211
|
+
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
6212
|
+
});
|
|
6213
|
+
const execute = async () => {
|
|
6214
|
+
try {
|
|
6215
|
+
const res = await fetch(actualSrc, {
|
|
6216
|
+
signal: controller.signal,
|
|
6217
|
+
cache: "no-store"
|
|
6218
|
+
});
|
|
6219
|
+
if (res.status !== 200) {
|
|
6220
|
+
if (res.status === 500) {
|
|
6221
|
+
const json = await res.json();
|
|
6222
|
+
if (json.error) {
|
|
6223
|
+
const cleanedUpErrorMessage = json.error.replace(/^Error: /, "");
|
|
6224
|
+
throw new Error(cleanedUpErrorMessage);
|
|
6225
|
+
}
|
|
6226
|
+
}
|
|
6227
|
+
throw new Error(`Server returned status ${res.status} while fetching ${actualSrc}`);
|
|
6228
|
+
}
|
|
6229
|
+
const blob = await res.blob();
|
|
6230
|
+
const url = URL.createObjectURL(blob);
|
|
6231
|
+
cleanup.push(() => URL.revokeObjectURL(url));
|
|
6232
|
+
setImageSrc({
|
|
6233
|
+
src: url,
|
|
6234
|
+
handle: newHandle
|
|
6235
|
+
});
|
|
6236
|
+
} catch (err) {
|
|
6237
|
+
if (err.message.includes("aborted")) {
|
|
6238
|
+
continueRender2(newHandle);
|
|
6239
|
+
return;
|
|
6240
|
+
}
|
|
6241
|
+
if (controller.signal.aborted) {
|
|
6242
|
+
continueRender2(newHandle);
|
|
6243
|
+
return;
|
|
6244
|
+
}
|
|
6245
|
+
if (err.message.includes("Failed to fetch")) {
|
|
6246
|
+
err = new Error(`Failed to fetch ${actualSrc}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`, { cause: err });
|
|
6247
|
+
}
|
|
6248
|
+
if (onError) {
|
|
6249
|
+
onError(err);
|
|
6250
|
+
} else {
|
|
6251
|
+
cancelRender(err);
|
|
6252
|
+
}
|
|
6253
|
+
}
|
|
6254
|
+
};
|
|
6255
|
+
execute();
|
|
6256
|
+
cleanup.push(() => {
|
|
6257
|
+
if (controller.signal.aborted) {
|
|
6258
|
+
return;
|
|
6259
|
+
}
|
|
6260
|
+
controller.abort();
|
|
6261
|
+
});
|
|
6262
|
+
return () => {
|
|
6263
|
+
cleanup.forEach((c2) => c2());
|
|
6264
|
+
};
|
|
6265
|
+
}, [
|
|
6266
|
+
actualSrc,
|
|
6267
|
+
delayRenderRetries,
|
|
6268
|
+
delayRenderTimeoutInMilliseconds,
|
|
6269
|
+
onError,
|
|
6270
|
+
continueRender2,
|
|
6271
|
+
delayRender2
|
|
6272
|
+
]);
|
|
6273
|
+
const onErr = useCallback15(() => {
|
|
6274
|
+
if (onError) {
|
|
6275
|
+
onError?.(new Error("Failed to load image with src " + imageSrc));
|
|
6276
|
+
} else {
|
|
6277
|
+
cancelRender("Failed to load image with src " + imageSrc);
|
|
6278
|
+
}
|
|
6279
|
+
}, [imageSrc, onError]);
|
|
6280
|
+
const className = useMemo26(() => {
|
|
6281
|
+
return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
|
|
6282
|
+
}, [props2.className]);
|
|
6283
|
+
const onImageFrame = useCallback15((img) => {
|
|
6284
|
+
if (onVideoFrame) {
|
|
6285
|
+
onVideoFrame(img);
|
|
6286
|
+
}
|
|
6287
|
+
}, [onVideoFrame]);
|
|
6288
|
+
if (!imageSrc || !window.remotion_videoEnabled) {
|
|
6289
|
+
return null;
|
|
6290
|
+
}
|
|
6291
|
+
continueRender2(imageSrc.handle);
|
|
6292
|
+
return /* @__PURE__ */ jsx27(Img, {
|
|
6293
|
+
src: imageSrc.src,
|
|
6294
|
+
delayRenderRetries,
|
|
6295
|
+
delayRenderTimeoutInMilliseconds,
|
|
6296
|
+
onImageFrame,
|
|
6297
|
+
...props2,
|
|
6298
|
+
onError: onErr,
|
|
6299
|
+
className
|
|
6300
|
+
});
|
|
6301
|
+
};
|
|
6302
|
+
|
|
6072
6303
|
// src/video/VideoForPreview.tsx
|
|
6073
6304
|
import {
|
|
6074
6305
|
forwardRef as forwardRef9,
|
|
6075
|
-
useContext as
|
|
6076
|
-
useEffect as
|
|
6306
|
+
useContext as useContext30,
|
|
6307
|
+
useEffect as useEffect20,
|
|
6077
6308
|
useImperativeHandle as useImperativeHandle9,
|
|
6078
|
-
useMemo as
|
|
6309
|
+
useMemo as useMemo27,
|
|
6079
6310
|
useRef as useRef16,
|
|
6080
|
-
useState as
|
|
6311
|
+
useState as useState19
|
|
6081
6312
|
} from "react";
|
|
6082
6313
|
|
|
6083
6314
|
// src/video/emit-video-frame.ts
|
|
6084
|
-
import { useEffect as
|
|
6315
|
+
import { useEffect as useEffect19 } from "react";
|
|
6085
6316
|
var useEmitVideoFrame = ({
|
|
6086
6317
|
ref,
|
|
6087
6318
|
onVideoFrame
|
|
6088
6319
|
}) => {
|
|
6089
|
-
|
|
6320
|
+
useEffect19(() => {
|
|
6090
6321
|
const { current } = ref;
|
|
6091
6322
|
if (!current) {
|
|
6092
6323
|
return;
|
|
@@ -6110,14 +6341,14 @@ var useEmitVideoFrame = ({
|
|
|
6110
6341
|
};
|
|
6111
6342
|
|
|
6112
6343
|
// src/video/VideoForPreview.tsx
|
|
6113
|
-
import { jsx as
|
|
6344
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6114
6345
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
6115
|
-
const context =
|
|
6346
|
+
const context = useContext30(SharedAudioContext);
|
|
6116
6347
|
if (!context) {
|
|
6117
6348
|
throw new Error("SharedAudioContext not found");
|
|
6118
6349
|
}
|
|
6119
6350
|
const videoRef = useRef16(null);
|
|
6120
|
-
const sharedSource =
|
|
6351
|
+
const sharedSource = useMemo27(() => {
|
|
6121
6352
|
if (!context.audioContext) {
|
|
6122
6353
|
return null;
|
|
6123
6354
|
}
|
|
@@ -6160,11 +6391,11 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6160
6391
|
}
|
|
6161
6392
|
const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
6162
6393
|
const { fps, durationInFrames } = useVideoConfig();
|
|
6163
|
-
const parentSequence =
|
|
6164
|
-
const { hidden } =
|
|
6394
|
+
const parentSequence = useContext30(SequenceContext);
|
|
6395
|
+
const { hidden } = useContext30(SequenceVisibilityToggleContext);
|
|
6165
6396
|
const logLevel = useLogLevel();
|
|
6166
6397
|
const mountTime = useMountTime();
|
|
6167
|
-
const [timelineId] =
|
|
6398
|
+
const [timelineId] = useState19(() => String(Math.random()));
|
|
6168
6399
|
const isSequenceHidden = hidden[timelineId] ?? false;
|
|
6169
6400
|
if (typeof acceptableTimeShift !== "undefined") {
|
|
6170
6401
|
throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
|
|
@@ -6188,8 +6419,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6188
6419
|
id: timelineId,
|
|
6189
6420
|
stack: _remotionInternalStack,
|
|
6190
6421
|
showInTimeline,
|
|
6191
|
-
premountDisplay: null,
|
|
6192
|
-
postmountDisplay: null,
|
|
6422
|
+
premountDisplay: parentSequence?.premountDisplay ?? null,
|
|
6423
|
+
postmountDisplay: parentSequence?.postmountDisplay ?? null,
|
|
6193
6424
|
onAutoPlayError: onAutoPlayError ?? null,
|
|
6194
6425
|
isPremounting: Boolean(parentSequence?.premounting),
|
|
6195
6426
|
isPostmounting: Boolean(parentSequence?.postmounting)
|
|
@@ -6225,13 +6456,13 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6225
6456
|
useImperativeHandle9(ref, () => {
|
|
6226
6457
|
return videoRef.current;
|
|
6227
6458
|
}, []);
|
|
6228
|
-
|
|
6459
|
+
useState19(() => playbackLogging({
|
|
6229
6460
|
logLevel,
|
|
6230
6461
|
message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
|
|
6231
6462
|
tag: "video",
|
|
6232
6463
|
mountTime
|
|
6233
6464
|
}));
|
|
6234
|
-
|
|
6465
|
+
useEffect20(() => {
|
|
6235
6466
|
const { current } = videoRef;
|
|
6236
6467
|
if (!current) {
|
|
6237
6468
|
return;
|
|
@@ -6262,7 +6493,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6262
6493
|
const currentOnDurationCallback = useRef16(onDuration);
|
|
6263
6494
|
currentOnDurationCallback.current = onDuration;
|
|
6264
6495
|
useEmitVideoFrame({ ref: videoRef, onVideoFrame });
|
|
6265
|
-
|
|
6496
|
+
useEffect20(() => {
|
|
6266
6497
|
const { current } = videoRef;
|
|
6267
6498
|
if (!current) {
|
|
6268
6499
|
return;
|
|
@@ -6279,7 +6510,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6279
6510
|
current.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
6280
6511
|
};
|
|
6281
6512
|
}, [src]);
|
|
6282
|
-
|
|
6513
|
+
useEffect20(() => {
|
|
6283
6514
|
const { current } = videoRef;
|
|
6284
6515
|
if (!current) {
|
|
6285
6516
|
return;
|
|
@@ -6290,7 +6521,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6290
6521
|
current.preload = "auto";
|
|
6291
6522
|
}
|
|
6292
6523
|
}, []);
|
|
6293
|
-
const actualStyle =
|
|
6524
|
+
const actualStyle = useMemo27(() => {
|
|
6294
6525
|
return {
|
|
6295
6526
|
...style,
|
|
6296
6527
|
opacity: isSequenceHidden ? 0 : style?.opacity ?? 1
|
|
@@ -6300,7 +6531,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6300
6531
|
crossOrigin,
|
|
6301
6532
|
requestsVideoFrame: Boolean(onVideoFrame)
|
|
6302
6533
|
});
|
|
6303
|
-
return /* @__PURE__ */
|
|
6534
|
+
return /* @__PURE__ */ jsx28("video", {
|
|
6304
6535
|
ref: videoRef,
|
|
6305
6536
|
muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
|
|
6306
6537
|
playsInline: true,
|
|
@@ -6314,13 +6545,169 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
6314
6545
|
};
|
|
6315
6546
|
var VideoForPreview = forwardRef9(VideoForDevelopmentRefForwardingFunction);
|
|
6316
6547
|
|
|
6317
|
-
// src/
|
|
6318
|
-
|
|
6319
|
-
var
|
|
6320
|
-
|
|
6321
|
-
|
|
6548
|
+
// src/video/OffthreadVideo.tsx
|
|
6549
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6550
|
+
var InnerOffthreadVideo = (props2) => {
|
|
6551
|
+
const {
|
|
6552
|
+
startFrom,
|
|
6553
|
+
endAt,
|
|
6554
|
+
trimBefore,
|
|
6555
|
+
trimAfter,
|
|
6556
|
+
name,
|
|
6557
|
+
pauseWhenBuffering,
|
|
6558
|
+
stack,
|
|
6559
|
+
showInTimeline,
|
|
6560
|
+
...otherProps
|
|
6561
|
+
} = props2;
|
|
6562
|
+
const environment = useRemotionEnvironment();
|
|
6563
|
+
const onDuration = useCallback16(() => {
|
|
6564
|
+
return;
|
|
6565
|
+
}, []);
|
|
6566
|
+
if (typeof props2.src !== "string") {
|
|
6567
|
+
throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
|
|
6322
6568
|
}
|
|
6323
|
-
|
|
6569
|
+
validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
|
|
6570
|
+
const { trimBeforeValue, trimAfterValue } = resolveTrimProps({
|
|
6571
|
+
startFrom,
|
|
6572
|
+
endAt,
|
|
6573
|
+
trimBefore,
|
|
6574
|
+
trimAfter
|
|
6575
|
+
});
|
|
6576
|
+
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
6577
|
+
return /* @__PURE__ */ jsx29(Sequence, {
|
|
6578
|
+
layout: "none",
|
|
6579
|
+
from: 0 - (trimBeforeValue ?? 0),
|
|
6580
|
+
showInTimeline: false,
|
|
6581
|
+
durationInFrames: trimAfterValue,
|
|
6582
|
+
name,
|
|
6583
|
+
children: /* @__PURE__ */ jsx29(InnerOffthreadVideo, {
|
|
6584
|
+
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6585
|
+
...otherProps,
|
|
6586
|
+
trimAfter: undefined,
|
|
6587
|
+
name: undefined,
|
|
6588
|
+
showInTimeline,
|
|
6589
|
+
trimBefore: undefined,
|
|
6590
|
+
stack: undefined,
|
|
6591
|
+
startFrom: undefined,
|
|
6592
|
+
endAt: undefined
|
|
6593
|
+
})
|
|
6594
|
+
});
|
|
6595
|
+
}
|
|
6596
|
+
validateMediaProps(props2, "Video");
|
|
6597
|
+
if (environment.isRendering) {
|
|
6598
|
+
return /* @__PURE__ */ jsx29(OffthreadVideoForRendering, {
|
|
6599
|
+
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6600
|
+
...otherProps,
|
|
6601
|
+
trimAfter: undefined,
|
|
6602
|
+
name: undefined,
|
|
6603
|
+
showInTimeline,
|
|
6604
|
+
trimBefore: undefined,
|
|
6605
|
+
stack: undefined,
|
|
6606
|
+
startFrom: undefined,
|
|
6607
|
+
endAt: undefined
|
|
6608
|
+
});
|
|
6609
|
+
}
|
|
6610
|
+
const {
|
|
6611
|
+
transparent,
|
|
6612
|
+
toneMapped,
|
|
6613
|
+
onAutoPlayError,
|
|
6614
|
+
onVideoFrame,
|
|
6615
|
+
crossOrigin,
|
|
6616
|
+
delayRenderRetries,
|
|
6617
|
+
delayRenderTimeoutInMilliseconds,
|
|
6618
|
+
...propsForPreview
|
|
6619
|
+
} = otherProps;
|
|
6620
|
+
return /* @__PURE__ */ jsx29(VideoForPreview, {
|
|
6621
|
+
_remotionInternalStack: stack ?? null,
|
|
6622
|
+
onDuration,
|
|
6623
|
+
onlyWarnForMediaSeekingError: true,
|
|
6624
|
+
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
6625
|
+
showInTimeline: showInTimeline ?? true,
|
|
6626
|
+
onAutoPlayError: onAutoPlayError ?? undefined,
|
|
6627
|
+
onVideoFrame: onVideoFrame ?? null,
|
|
6628
|
+
crossOrigin,
|
|
6629
|
+
...propsForPreview,
|
|
6630
|
+
_remotionInternalNativeLoopPassed: false
|
|
6631
|
+
});
|
|
6632
|
+
};
|
|
6633
|
+
var OffthreadVideo = ({
|
|
6634
|
+
src,
|
|
6635
|
+
acceptableTimeShiftInSeconds,
|
|
6636
|
+
allowAmplificationDuringRender,
|
|
6637
|
+
audioStreamIndex,
|
|
6638
|
+
className,
|
|
6639
|
+
crossOrigin,
|
|
6640
|
+
delayRenderRetries,
|
|
6641
|
+
delayRenderTimeoutInMilliseconds,
|
|
6642
|
+
id,
|
|
6643
|
+
loopVolumeCurveBehavior,
|
|
6644
|
+
muted,
|
|
6645
|
+
name,
|
|
6646
|
+
onAutoPlayError,
|
|
6647
|
+
onError,
|
|
6648
|
+
onVideoFrame,
|
|
6649
|
+
pauseWhenBuffering,
|
|
6650
|
+
playbackRate,
|
|
6651
|
+
showInTimeline,
|
|
6652
|
+
style,
|
|
6653
|
+
toneFrequency,
|
|
6654
|
+
toneMapped,
|
|
6655
|
+
transparent,
|
|
6656
|
+
trimAfter,
|
|
6657
|
+
trimBefore,
|
|
6658
|
+
useWebAudioApi,
|
|
6659
|
+
volume,
|
|
6660
|
+
_remotionInternalNativeLoopPassed,
|
|
6661
|
+
endAt,
|
|
6662
|
+
stack,
|
|
6663
|
+
startFrom,
|
|
6664
|
+
imageFormat
|
|
6665
|
+
}) => {
|
|
6666
|
+
if (imageFormat) {
|
|
6667
|
+
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
6668
|
+
}
|
|
6669
|
+
return /* @__PURE__ */ jsx29(InnerOffthreadVideo, {
|
|
6670
|
+
acceptableTimeShiftInSeconds,
|
|
6671
|
+
allowAmplificationDuringRender: allowAmplificationDuringRender ?? true,
|
|
6672
|
+
audioStreamIndex: audioStreamIndex ?? 0,
|
|
6673
|
+
className,
|
|
6674
|
+
crossOrigin,
|
|
6675
|
+
delayRenderRetries,
|
|
6676
|
+
delayRenderTimeoutInMilliseconds,
|
|
6677
|
+
id,
|
|
6678
|
+
loopVolumeCurveBehavior: loopVolumeCurveBehavior ?? "repeat",
|
|
6679
|
+
muted: muted ?? false,
|
|
6680
|
+
name,
|
|
6681
|
+
onAutoPlayError: onAutoPlayError ?? null,
|
|
6682
|
+
onError,
|
|
6683
|
+
onVideoFrame,
|
|
6684
|
+
pauseWhenBuffering: pauseWhenBuffering ?? true,
|
|
6685
|
+
playbackRate: playbackRate ?? 1,
|
|
6686
|
+
toneFrequency: toneFrequency ?? 1,
|
|
6687
|
+
showInTimeline: showInTimeline ?? true,
|
|
6688
|
+
src,
|
|
6689
|
+
stack,
|
|
6690
|
+
startFrom,
|
|
6691
|
+
_remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed ?? false,
|
|
6692
|
+
endAt,
|
|
6693
|
+
style,
|
|
6694
|
+
toneMapped: toneMapped ?? true,
|
|
6695
|
+
transparent: transparent ?? false,
|
|
6696
|
+
trimAfter,
|
|
6697
|
+
trimBefore,
|
|
6698
|
+
useWebAudioApi: useWebAudioApi ?? false,
|
|
6699
|
+
volume
|
|
6700
|
+
});
|
|
6701
|
+
};
|
|
6702
|
+
addSequenceStackTraces(OffthreadVideo);
|
|
6703
|
+
|
|
6704
|
+
// src/watch-static-file.ts
|
|
6705
|
+
var WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
|
|
6706
|
+
var watchStaticFile = (fileName, callback) => {
|
|
6707
|
+
if (ENABLE_V5_BREAKING_CHANGES) {
|
|
6708
|
+
throw new Error("watchStaticFile() has moved into the `@remotion/studio` package. Update your imports.");
|
|
6709
|
+
}
|
|
6710
|
+
if (!getRemotionEnvironment().isStudio) {
|
|
6324
6711
|
console.warn("The watchStaticFile() API is only available while using the Remotion Studio.");
|
|
6325
6712
|
return { cancel: () => {
|
|
6326
6713
|
return;
|
|
@@ -6352,22 +6739,22 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
6352
6739
|
};
|
|
6353
6740
|
|
|
6354
6741
|
// src/wrap-remotion-context.tsx
|
|
6355
|
-
import
|
|
6356
|
-
import { jsx as
|
|
6742
|
+
import React30, { useMemo as useMemo28 } from "react";
|
|
6743
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6357
6744
|
function useRemotionContexts() {
|
|
6358
|
-
const compositionManagerCtx =
|
|
6359
|
-
const timelineContext =
|
|
6360
|
-
const setTimelineContext =
|
|
6361
|
-
const sequenceContext =
|
|
6362
|
-
const nonceContext =
|
|
6363
|
-
const canUseRemotionHooksContext =
|
|
6364
|
-
const preloadContext =
|
|
6365
|
-
const resolveCompositionContext =
|
|
6366
|
-
const renderAssetManagerContext =
|
|
6367
|
-
const sequenceManagerContext =
|
|
6368
|
-
const bufferManagerContext =
|
|
6369
|
-
const logLevelContext =
|
|
6370
|
-
return
|
|
6745
|
+
const compositionManagerCtx = React30.useContext(CompositionManager);
|
|
6746
|
+
const timelineContext = React30.useContext(TimelineContext);
|
|
6747
|
+
const setTimelineContext = React30.useContext(SetTimelineContext);
|
|
6748
|
+
const sequenceContext = React30.useContext(SequenceContext);
|
|
6749
|
+
const nonceContext = React30.useContext(NonceContext);
|
|
6750
|
+
const canUseRemotionHooksContext = React30.useContext(CanUseRemotionHooks);
|
|
6751
|
+
const preloadContext = React30.useContext(PreloadContext);
|
|
6752
|
+
const resolveCompositionContext = React30.useContext(ResolveCompositionContext);
|
|
6753
|
+
const renderAssetManagerContext = React30.useContext(RenderAssetManager);
|
|
6754
|
+
const sequenceManagerContext = React30.useContext(SequenceManager);
|
|
6755
|
+
const bufferManagerContext = React30.useContext(BufferingContextReact);
|
|
6756
|
+
const logLevelContext = React30.useContext(LogLevelContext);
|
|
6757
|
+
return useMemo28(() => ({
|
|
6371
6758
|
compositionManagerCtx,
|
|
6372
6759
|
timelineContext,
|
|
6373
6760
|
setTimelineContext,
|
|
@@ -6397,29 +6784,29 @@ function useRemotionContexts() {
|
|
|
6397
6784
|
}
|
|
6398
6785
|
var RemotionContextProvider = (props2) => {
|
|
6399
6786
|
const { children, contexts } = props2;
|
|
6400
|
-
return /* @__PURE__ */
|
|
6787
|
+
return /* @__PURE__ */ jsx30(LogLevelContext.Provider, {
|
|
6401
6788
|
value: contexts.logLevelContext,
|
|
6402
|
-
children: /* @__PURE__ */
|
|
6789
|
+
children: /* @__PURE__ */ jsx30(CanUseRemotionHooks.Provider, {
|
|
6403
6790
|
value: contexts.canUseRemotionHooksContext,
|
|
6404
|
-
children: /* @__PURE__ */
|
|
6791
|
+
children: /* @__PURE__ */ jsx30(NonceContext.Provider, {
|
|
6405
6792
|
value: contexts.nonceContext,
|
|
6406
|
-
children: /* @__PURE__ */
|
|
6793
|
+
children: /* @__PURE__ */ jsx30(PreloadContext.Provider, {
|
|
6407
6794
|
value: contexts.preloadContext,
|
|
6408
|
-
children: /* @__PURE__ */
|
|
6795
|
+
children: /* @__PURE__ */ jsx30(CompositionManager.Provider, {
|
|
6409
6796
|
value: contexts.compositionManagerCtx,
|
|
6410
|
-
children: /* @__PURE__ */
|
|
6797
|
+
children: /* @__PURE__ */ jsx30(SequenceManager.Provider, {
|
|
6411
6798
|
value: contexts.sequenceManagerContext,
|
|
6412
|
-
children: /* @__PURE__ */
|
|
6799
|
+
children: /* @__PURE__ */ jsx30(RenderAssetManager.Provider, {
|
|
6413
6800
|
value: contexts.renderAssetManagerContext,
|
|
6414
|
-
children: /* @__PURE__ */
|
|
6801
|
+
children: /* @__PURE__ */ jsx30(ResolveCompositionContext.Provider, {
|
|
6415
6802
|
value: contexts.resolveCompositionContext,
|
|
6416
|
-
children: /* @__PURE__ */
|
|
6803
|
+
children: /* @__PURE__ */ jsx30(TimelineContext.Provider, {
|
|
6417
6804
|
value: contexts.timelineContext,
|
|
6418
|
-
children: /* @__PURE__ */
|
|
6805
|
+
children: /* @__PURE__ */ jsx30(SetTimelineContext.Provider, {
|
|
6419
6806
|
value: contexts.setTimelineContext,
|
|
6420
|
-
children: /* @__PURE__ */
|
|
6807
|
+
children: /* @__PURE__ */ jsx30(SequenceContext.Provider, {
|
|
6421
6808
|
value: contexts.sequenceContext,
|
|
6422
|
-
children: /* @__PURE__ */
|
|
6809
|
+
children: /* @__PURE__ */ jsx30(BufferingContextReact.Provider, {
|
|
6423
6810
|
value: contexts.bufferManagerContext,
|
|
6424
6811
|
children
|
|
6425
6812
|
})
|
|
@@ -6517,7 +6904,8 @@ var Internals = {
|
|
|
6517
6904
|
RemotionEnvironmentContext,
|
|
6518
6905
|
warnAboutTooHighVolume,
|
|
6519
6906
|
AudioForPreview,
|
|
6520
|
-
OBJECTFIT_CONTAIN_CLASS_NAME
|
|
6907
|
+
OBJECTFIT_CONTAIN_CLASS_NAME,
|
|
6908
|
+
InnerOffthreadVideo
|
|
6521
6909
|
};
|
|
6522
6910
|
// src/interpolate-colors.ts
|
|
6523
6911
|
var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
@@ -6882,25 +7270,15 @@ var validateFrame = ({
|
|
|
6882
7270
|
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
6883
7271
|
}
|
|
6884
7272
|
};
|
|
6885
|
-
|
|
6886
|
-
// src/video/offthread-video-source.ts
|
|
6887
|
-
var getOffthreadVideoSource = ({
|
|
6888
|
-
src,
|
|
6889
|
-
transparent,
|
|
6890
|
-
currentTime,
|
|
6891
|
-
toneMapped
|
|
6892
|
-
}) => {
|
|
6893
|
-
return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(Math.max(0, currentTime))}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
|
|
6894
|
-
};
|
|
6895
7273
|
// src/series/index.tsx
|
|
6896
|
-
import { Children, forwardRef as forwardRef10, useMemo as
|
|
7274
|
+
import { Children, forwardRef as forwardRef10, useMemo as useMemo29 } from "react";
|
|
6897
7275
|
|
|
6898
7276
|
// src/series/flatten-children.tsx
|
|
6899
|
-
import
|
|
7277
|
+
import React31 from "react";
|
|
6900
7278
|
var flattenChildren = (children) => {
|
|
6901
|
-
const childrenArray =
|
|
7279
|
+
const childrenArray = React31.Children.toArray(children);
|
|
6902
7280
|
return childrenArray.reduce((flatChildren, child) => {
|
|
6903
|
-
if (child.type ===
|
|
7281
|
+
if (child.type === React31.Fragment) {
|
|
6904
7282
|
return flatChildren.concat(flattenChildren(child.props.children));
|
|
6905
7283
|
}
|
|
6906
7284
|
flatChildren.push(child);
|
|
@@ -6909,39 +7287,39 @@ var flattenChildren = (children) => {
|
|
|
6909
7287
|
};
|
|
6910
7288
|
|
|
6911
7289
|
// src/series/is-inside-series.tsx
|
|
6912
|
-
import
|
|
6913
|
-
import { jsx as
|
|
7290
|
+
import React32, { createContext as createContext19 } from "react";
|
|
7291
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
6914
7292
|
var IsInsideSeriesContext = createContext19(false);
|
|
6915
7293
|
var IsInsideSeriesContainer = ({ children }) => {
|
|
6916
|
-
return /* @__PURE__ */
|
|
7294
|
+
return /* @__PURE__ */ jsx31(IsInsideSeriesContext.Provider, {
|
|
6917
7295
|
value: true,
|
|
6918
7296
|
children
|
|
6919
7297
|
});
|
|
6920
7298
|
};
|
|
6921
7299
|
var IsNotInsideSeriesProvider = ({ children }) => {
|
|
6922
|
-
return /* @__PURE__ */
|
|
7300
|
+
return /* @__PURE__ */ jsx31(IsInsideSeriesContext.Provider, {
|
|
6923
7301
|
value: false,
|
|
6924
7302
|
children
|
|
6925
7303
|
});
|
|
6926
7304
|
};
|
|
6927
7305
|
var useRequireToBeInsideSeries = () => {
|
|
6928
|
-
const isInsideSeries =
|
|
7306
|
+
const isInsideSeries = React32.useContext(IsInsideSeriesContext);
|
|
6929
7307
|
if (!isInsideSeries) {
|
|
6930
7308
|
throw new Error("This component must be inside a <Series /> component.");
|
|
6931
7309
|
}
|
|
6932
7310
|
};
|
|
6933
7311
|
|
|
6934
7312
|
// src/series/index.tsx
|
|
6935
|
-
import { jsx as
|
|
7313
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6936
7314
|
var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
|
|
6937
7315
|
useRequireToBeInsideSeries();
|
|
6938
|
-
return /* @__PURE__ */
|
|
7316
|
+
return /* @__PURE__ */ jsx32(IsNotInsideSeriesProvider, {
|
|
6939
7317
|
children
|
|
6940
7318
|
});
|
|
6941
7319
|
};
|
|
6942
7320
|
var SeriesSequence = forwardRef10(SeriesSequenceRefForwardingFunction);
|
|
6943
7321
|
var Series = (props2) => {
|
|
6944
|
-
const childrenValue =
|
|
7322
|
+
const childrenValue = useMemo29(() => {
|
|
6945
7323
|
let startFrame = 0;
|
|
6946
7324
|
const flattenedChildren = flattenChildren(props2.children);
|
|
6947
7325
|
return Children.map(flattenedChildren, (child, i) => {
|
|
@@ -6985,7 +7363,7 @@ var Series = (props2) => {
|
|
|
6985
7363
|
}
|
|
6986
7364
|
const currentStartFrame = startFrame + offset;
|
|
6987
7365
|
startFrame += durationInFramesProp + offset;
|
|
6988
|
-
return /* @__PURE__ */
|
|
7366
|
+
return /* @__PURE__ */ jsx32(Sequence, {
|
|
6989
7367
|
name: name || "<Series.Sequence>",
|
|
6990
7368
|
from: currentStartFrame,
|
|
6991
7369
|
durationInFrames: durationInFramesProp,
|
|
@@ -6996,14 +7374,14 @@ var Series = (props2) => {
|
|
|
6996
7374
|
});
|
|
6997
7375
|
}, [props2.children]);
|
|
6998
7376
|
if (ENABLE_V5_BREAKING_CHANGES) {
|
|
6999
|
-
return /* @__PURE__ */
|
|
7000
|
-
children: /* @__PURE__ */
|
|
7377
|
+
return /* @__PURE__ */ jsx32(IsInsideSeriesContainer, {
|
|
7378
|
+
children: /* @__PURE__ */ jsx32(Sequence, {
|
|
7001
7379
|
...props2,
|
|
7002
7380
|
children: childrenValue
|
|
7003
7381
|
})
|
|
7004
7382
|
});
|
|
7005
7383
|
}
|
|
7006
|
-
return /* @__PURE__ */
|
|
7384
|
+
return /* @__PURE__ */ jsx32(IsInsideSeriesContainer, {
|
|
7007
7385
|
children: childrenValue
|
|
7008
7386
|
});
|
|
7009
7387
|
};
|
|
@@ -7340,302 +7718,14 @@ var staticFile = (path) => {
|
|
|
7340
7718
|
return preparsed;
|
|
7341
7719
|
};
|
|
7342
7720
|
// src/Still.tsx
|
|
7343
|
-
import
|
|
7721
|
+
import React34 from "react";
|
|
7344
7722
|
var Still = (props2) => {
|
|
7345
7723
|
const newProps = {
|
|
7346
7724
|
...props2,
|
|
7347
7725
|
durationInFrames: 1,
|
|
7348
7726
|
fps: 1
|
|
7349
7727
|
};
|
|
7350
|
-
return
|
|
7351
|
-
};
|
|
7352
|
-
// src/video/OffthreadVideo.tsx
|
|
7353
|
-
import { useCallback as useCallback16 } from "react";
|
|
7354
|
-
|
|
7355
|
-
// src/video/OffthreadVideoForRendering.tsx
|
|
7356
|
-
import {
|
|
7357
|
-
useCallback as useCallback15,
|
|
7358
|
-
useContext as useContext30,
|
|
7359
|
-
useEffect as useEffect20,
|
|
7360
|
-
useLayoutEffect as useLayoutEffect9,
|
|
7361
|
-
useMemo as useMemo29,
|
|
7362
|
-
useState as useState19
|
|
7363
|
-
} from "react";
|
|
7364
|
-
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
7365
|
-
var OffthreadVideoForRendering = ({
|
|
7366
|
-
onError,
|
|
7367
|
-
volume: volumeProp,
|
|
7368
|
-
playbackRate,
|
|
7369
|
-
src,
|
|
7370
|
-
muted,
|
|
7371
|
-
allowAmplificationDuringRender,
|
|
7372
|
-
transparent = false,
|
|
7373
|
-
toneMapped = true,
|
|
7374
|
-
toneFrequency,
|
|
7375
|
-
name,
|
|
7376
|
-
loopVolumeCurveBehavior,
|
|
7377
|
-
delayRenderRetries,
|
|
7378
|
-
delayRenderTimeoutInMilliseconds,
|
|
7379
|
-
onVideoFrame,
|
|
7380
|
-
crossOrigin,
|
|
7381
|
-
audioStreamIndex,
|
|
7382
|
-
...props2
|
|
7383
|
-
}) => {
|
|
7384
|
-
const absoluteFrame = useTimelinePosition();
|
|
7385
|
-
const frame = useCurrentFrame();
|
|
7386
|
-
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
7387
|
-
const videoConfig = useUnsafeVideoConfig();
|
|
7388
|
-
const sequenceContext = useContext30(SequenceContext);
|
|
7389
|
-
const mediaStartsAt = useMediaStartsAt();
|
|
7390
|
-
const { registerRenderAsset, unregisterRenderAsset } = useContext30(RenderAssetManager);
|
|
7391
|
-
if (!src) {
|
|
7392
|
-
throw new TypeError("No `src` was passed to <OffthreadVideo>.");
|
|
7393
|
-
}
|
|
7394
|
-
const id = useMemo29(() => `offthreadvideo-${random(src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
|
|
7395
|
-
src,
|
|
7396
|
-
sequenceContext?.cumulatedFrom,
|
|
7397
|
-
sequenceContext?.relativeFrom,
|
|
7398
|
-
sequenceContext?.durationInFrames
|
|
7399
|
-
]);
|
|
7400
|
-
if (!videoConfig) {
|
|
7401
|
-
throw new Error("No video config found");
|
|
7402
|
-
}
|
|
7403
|
-
const volume = evaluateVolume({
|
|
7404
|
-
volume: volumeProp,
|
|
7405
|
-
frame: volumePropsFrame,
|
|
7406
|
-
mediaVolume: 1
|
|
7407
|
-
});
|
|
7408
|
-
warnAboutTooHighVolume(volume);
|
|
7409
|
-
useEffect20(() => {
|
|
7410
|
-
if (!src) {
|
|
7411
|
-
throw new Error("No src passed");
|
|
7412
|
-
}
|
|
7413
|
-
if (!window.remotion_audioEnabled) {
|
|
7414
|
-
return;
|
|
7415
|
-
}
|
|
7416
|
-
if (muted) {
|
|
7417
|
-
return;
|
|
7418
|
-
}
|
|
7419
|
-
if (volume <= 0) {
|
|
7420
|
-
return;
|
|
7421
|
-
}
|
|
7422
|
-
registerRenderAsset({
|
|
7423
|
-
type: "video",
|
|
7424
|
-
src: getAbsoluteSrc(src),
|
|
7425
|
-
id,
|
|
7426
|
-
frame: absoluteFrame,
|
|
7427
|
-
volume,
|
|
7428
|
-
mediaFrame: frame,
|
|
7429
|
-
playbackRate: playbackRate ?? 1,
|
|
7430
|
-
toneFrequency: toneFrequency ?? null,
|
|
7431
|
-
audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
|
|
7432
|
-
audioStreamIndex: audioStreamIndex ?? 0
|
|
7433
|
-
});
|
|
7434
|
-
return () => unregisterRenderAsset(id);
|
|
7435
|
-
}, [
|
|
7436
|
-
muted,
|
|
7437
|
-
src,
|
|
7438
|
-
registerRenderAsset,
|
|
7439
|
-
id,
|
|
7440
|
-
unregisterRenderAsset,
|
|
7441
|
-
volume,
|
|
7442
|
-
frame,
|
|
7443
|
-
absoluteFrame,
|
|
7444
|
-
playbackRate,
|
|
7445
|
-
toneFrequency,
|
|
7446
|
-
sequenceContext?.relativeFrom,
|
|
7447
|
-
audioStreamIndex
|
|
7448
|
-
]);
|
|
7449
|
-
const currentTime = useMemo29(() => {
|
|
7450
|
-
return getExpectedMediaFrameUncorrected({
|
|
7451
|
-
frame,
|
|
7452
|
-
playbackRate: playbackRate || 1,
|
|
7453
|
-
startFrom: -mediaStartsAt
|
|
7454
|
-
}) / videoConfig.fps;
|
|
7455
|
-
}, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
|
|
7456
|
-
const actualSrc = useMemo29(() => {
|
|
7457
|
-
return getOffthreadVideoSource({
|
|
7458
|
-
src,
|
|
7459
|
-
currentTime,
|
|
7460
|
-
transparent,
|
|
7461
|
-
toneMapped
|
|
7462
|
-
});
|
|
7463
|
-
}, [toneMapped, currentTime, src, transparent]);
|
|
7464
|
-
const [imageSrc, setImageSrc] = useState19(null);
|
|
7465
|
-
const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
|
|
7466
|
-
useLayoutEffect9(() => {
|
|
7467
|
-
if (!window.remotion_videoEnabled) {
|
|
7468
|
-
return;
|
|
7469
|
-
}
|
|
7470
|
-
const cleanup = [];
|
|
7471
|
-
setImageSrc(null);
|
|
7472
|
-
const controller = new AbortController;
|
|
7473
|
-
const newHandle = delayRender2(`Fetching ${actualSrc} from server`, {
|
|
7474
|
-
retries: delayRenderRetries ?? undefined,
|
|
7475
|
-
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
7476
|
-
});
|
|
7477
|
-
const execute = async () => {
|
|
7478
|
-
try {
|
|
7479
|
-
const res = await fetch(actualSrc, {
|
|
7480
|
-
signal: controller.signal,
|
|
7481
|
-
cache: "no-store"
|
|
7482
|
-
});
|
|
7483
|
-
if (res.status !== 200) {
|
|
7484
|
-
if (res.status === 500) {
|
|
7485
|
-
const json = await res.json();
|
|
7486
|
-
if (json.error) {
|
|
7487
|
-
const cleanedUpErrorMessage = json.error.replace(/^Error: /, "");
|
|
7488
|
-
throw new Error(cleanedUpErrorMessage);
|
|
7489
|
-
}
|
|
7490
|
-
}
|
|
7491
|
-
throw new Error(`Server returned status ${res.status} while fetching ${actualSrc}`);
|
|
7492
|
-
}
|
|
7493
|
-
const blob = await res.blob();
|
|
7494
|
-
const url = URL.createObjectURL(blob);
|
|
7495
|
-
cleanup.push(() => URL.revokeObjectURL(url));
|
|
7496
|
-
setImageSrc({
|
|
7497
|
-
src: url,
|
|
7498
|
-
handle: newHandle
|
|
7499
|
-
});
|
|
7500
|
-
} catch (err) {
|
|
7501
|
-
if (err.message.includes("aborted")) {
|
|
7502
|
-
continueRender2(newHandle);
|
|
7503
|
-
return;
|
|
7504
|
-
}
|
|
7505
|
-
if (controller.signal.aborted) {
|
|
7506
|
-
continueRender2(newHandle);
|
|
7507
|
-
return;
|
|
7508
|
-
}
|
|
7509
|
-
if (err.message.includes("Failed to fetch")) {
|
|
7510
|
-
err = new Error(`Failed to fetch ${actualSrc}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`, { cause: err });
|
|
7511
|
-
}
|
|
7512
|
-
if (onError) {
|
|
7513
|
-
onError(err);
|
|
7514
|
-
} else {
|
|
7515
|
-
cancelRender(err);
|
|
7516
|
-
}
|
|
7517
|
-
}
|
|
7518
|
-
};
|
|
7519
|
-
execute();
|
|
7520
|
-
cleanup.push(() => {
|
|
7521
|
-
if (controller.signal.aborted) {
|
|
7522
|
-
return;
|
|
7523
|
-
}
|
|
7524
|
-
controller.abort();
|
|
7525
|
-
});
|
|
7526
|
-
return () => {
|
|
7527
|
-
cleanup.forEach((c2) => c2());
|
|
7528
|
-
};
|
|
7529
|
-
}, [
|
|
7530
|
-
actualSrc,
|
|
7531
|
-
delayRenderRetries,
|
|
7532
|
-
delayRenderTimeoutInMilliseconds,
|
|
7533
|
-
onError,
|
|
7534
|
-
continueRender2,
|
|
7535
|
-
delayRender2
|
|
7536
|
-
]);
|
|
7537
|
-
const onErr = useCallback15(() => {
|
|
7538
|
-
if (onError) {
|
|
7539
|
-
onError?.(new Error("Failed to load image with src " + imageSrc));
|
|
7540
|
-
} else {
|
|
7541
|
-
cancelRender("Failed to load image with src " + imageSrc);
|
|
7542
|
-
}
|
|
7543
|
-
}, [imageSrc, onError]);
|
|
7544
|
-
const className = useMemo29(() => {
|
|
7545
|
-
return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
|
|
7546
|
-
}, [props2.className]);
|
|
7547
|
-
const onImageFrame = useCallback15((img) => {
|
|
7548
|
-
if (onVideoFrame) {
|
|
7549
|
-
onVideoFrame(img);
|
|
7550
|
-
}
|
|
7551
|
-
}, [onVideoFrame]);
|
|
7552
|
-
if (!imageSrc || !window.remotion_videoEnabled) {
|
|
7553
|
-
return null;
|
|
7554
|
-
}
|
|
7555
|
-
continueRender2(imageSrc.handle);
|
|
7556
|
-
return /* @__PURE__ */ jsx31(Img, {
|
|
7557
|
-
src: imageSrc.src,
|
|
7558
|
-
className,
|
|
7559
|
-
delayRenderRetries,
|
|
7560
|
-
delayRenderTimeoutInMilliseconds,
|
|
7561
|
-
onImageFrame,
|
|
7562
|
-
...props2,
|
|
7563
|
-
onError: onErr
|
|
7564
|
-
});
|
|
7565
|
-
};
|
|
7566
|
-
|
|
7567
|
-
// src/video/OffthreadVideo.tsx
|
|
7568
|
-
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
7569
|
-
var OffthreadVideo = (props2) => {
|
|
7570
|
-
const {
|
|
7571
|
-
startFrom,
|
|
7572
|
-
endAt,
|
|
7573
|
-
trimBefore,
|
|
7574
|
-
trimAfter,
|
|
7575
|
-
name,
|
|
7576
|
-
pauseWhenBuffering,
|
|
7577
|
-
stack,
|
|
7578
|
-
showInTimeline,
|
|
7579
|
-
...otherProps
|
|
7580
|
-
} = props2;
|
|
7581
|
-
const environment = useRemotionEnvironment();
|
|
7582
|
-
const onDuration = useCallback16(() => {
|
|
7583
|
-
return;
|
|
7584
|
-
}, []);
|
|
7585
|
-
if (typeof props2.src !== "string") {
|
|
7586
|
-
throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
|
|
7587
|
-
}
|
|
7588
|
-
if (props2.imageFormat) {
|
|
7589
|
-
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
7590
|
-
}
|
|
7591
|
-
validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
|
|
7592
|
-
const { trimBeforeValue, trimAfterValue } = resolveTrimProps({
|
|
7593
|
-
startFrom,
|
|
7594
|
-
endAt,
|
|
7595
|
-
trimBefore,
|
|
7596
|
-
trimAfter
|
|
7597
|
-
});
|
|
7598
|
-
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
7599
|
-
return /* @__PURE__ */ jsx32(Sequence, {
|
|
7600
|
-
layout: "none",
|
|
7601
|
-
from: 0 - (trimBeforeValue ?? 0),
|
|
7602
|
-
showInTimeline: false,
|
|
7603
|
-
durationInFrames: trimAfterValue,
|
|
7604
|
-
name,
|
|
7605
|
-
children: /* @__PURE__ */ jsx32(OffthreadVideo, {
|
|
7606
|
-
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
7607
|
-
...otherProps
|
|
7608
|
-
})
|
|
7609
|
-
});
|
|
7610
|
-
}
|
|
7611
|
-
validateMediaProps(props2, "Video");
|
|
7612
|
-
if (environment.isRendering) {
|
|
7613
|
-
return /* @__PURE__ */ jsx32(OffthreadVideoForRendering, {
|
|
7614
|
-
...otherProps
|
|
7615
|
-
});
|
|
7616
|
-
}
|
|
7617
|
-
const {
|
|
7618
|
-
transparent,
|
|
7619
|
-
toneMapped,
|
|
7620
|
-
onAutoPlayError,
|
|
7621
|
-
onVideoFrame,
|
|
7622
|
-
crossOrigin,
|
|
7623
|
-
delayRenderRetries,
|
|
7624
|
-
delayRenderTimeoutInMilliseconds,
|
|
7625
|
-
...propsForPreview
|
|
7626
|
-
} = otherProps;
|
|
7627
|
-
return /* @__PURE__ */ jsx32(VideoForPreview, {
|
|
7628
|
-
_remotionInternalStack: stack ?? null,
|
|
7629
|
-
_remotionInternalNativeLoopPassed: false,
|
|
7630
|
-
onDuration,
|
|
7631
|
-
onlyWarnForMediaSeekingError: true,
|
|
7632
|
-
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
7633
|
-
showInTimeline: showInTimeline ?? true,
|
|
7634
|
-
onAutoPlayError: onAutoPlayError ?? undefined,
|
|
7635
|
-
onVideoFrame: onVideoFrame ?? null,
|
|
7636
|
-
crossOrigin,
|
|
7637
|
-
...propsForPreview
|
|
7638
|
-
});
|
|
7728
|
+
return React34.createElement(Composition, newProps);
|
|
7639
7729
|
};
|
|
7640
7730
|
// src/video/Video.tsx
|
|
7641
7731
|
import { forwardRef as forwardRef12, useCallback as useCallback17, useContext as useContext32 } from "react";
|
|
@@ -7840,7 +7930,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
7840
7930
|
volume,
|
|
7841
7931
|
mediaFrame: frame,
|
|
7842
7932
|
playbackRate: playbackRate ?? 1,
|
|
7843
|
-
toneFrequency: toneFrequency ??
|
|
7933
|
+
toneFrequency: toneFrequency ?? 1,
|
|
7844
7934
|
audioStartFrame: Math.max(0, -(sequenceContext?.relativeFrom ?? 0)),
|
|
7845
7935
|
audioStreamIndex: audioStreamIndex ?? 0
|
|
7846
7936
|
});
|
|
@@ -8038,10 +8128,10 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8038
8128
|
const mediaDuration = durationFetched * fps;
|
|
8039
8129
|
return /* @__PURE__ */ jsx34(Loop, {
|
|
8040
8130
|
durationInFrames: calculateLoopDuration({
|
|
8041
|
-
endAt: trimAfterValue
|
|
8131
|
+
endAt: trimAfterValue,
|
|
8042
8132
|
mediaDuration,
|
|
8043
8133
|
playbackRate: props2.playbackRate ?? 1,
|
|
8044
|
-
startFrom: trimBeforeValue
|
|
8134
|
+
startFrom: trimBeforeValue
|
|
8045
8135
|
}),
|
|
8046
8136
|
layout: "none",
|
|
8047
8137
|
name,
|
|
@@ -8066,7 +8156,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
8066
8156
|
})
|
|
8067
8157
|
});
|
|
8068
8158
|
}
|
|
8069
|
-
validateMediaProps(props2, "Video");
|
|
8159
|
+
validateMediaProps({ playbackRate: props2.playbackRate, volume: props2.volume }, "Video");
|
|
8070
8160
|
if (environment.isRendering) {
|
|
8071
8161
|
return /* @__PURE__ */ jsx34(VideoForRendering, {
|
|
8072
8162
|
onDuration,
|