@remotion/promo-pages 4.0.496 → 4.0.498

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/experts.js CHANGED
@@ -2349,7 +2349,7 @@ var getSingleChildComponent = (children) => {
2349
2349
  }
2350
2350
  return child.type;
2351
2351
  };
2352
- var VERSION = "4.0.496";
2352
+ var VERSION = "4.0.498";
2353
2353
  var checkMultipleRemotionVersions = () => {
2354
2354
  if (typeof globalThis === "undefined") {
2355
2355
  return;
@@ -2827,6 +2827,45 @@ var textSchema = {
2827
2827
  hiddenFromList: false
2828
2828
  }
2829
2829
  };
2830
+ var borderSchema = {
2831
+ "style.borderWidth": {
2832
+ type: "number",
2833
+ default: undefined,
2834
+ min: 0,
2835
+ step: 1,
2836
+ description: "Border width",
2837
+ hiddenFromList: false
2838
+ },
2839
+ "style.borderStyle": {
2840
+ type: "enum",
2841
+ default: "none",
2842
+ description: "Border style",
2843
+ variants: {
2844
+ none: {},
2845
+ hidden: {},
2846
+ solid: {},
2847
+ dashed: {},
2848
+ dotted: {},
2849
+ double: {},
2850
+ groove: {},
2851
+ ridge: {},
2852
+ inset: {},
2853
+ outset: {}
2854
+ }
2855
+ },
2856
+ "style.borderColor": {
2857
+ type: "color",
2858
+ default: undefined,
2859
+ description: "Border color"
2860
+ }
2861
+ };
2862
+ var backgroundSchema = {
2863
+ "style.backgroundColor": {
2864
+ type: "color",
2865
+ default: "transparent",
2866
+ description: "Color"
2867
+ }
2868
+ };
2830
2869
  var textContentSchema = {
2831
2870
  children: {
2832
2871
  type: "text-content",
@@ -2854,20 +2893,13 @@ var premountSchema = {
2854
2893
  keyframable: false
2855
2894
  }
2856
2895
  };
2857
- var premountStyleSchema = {
2858
- styleWhilePremounted: {
2859
- type: "hidden"
2860
- },
2861
- styleWhilePostmounted: {
2862
- type: "hidden"
2863
- }
2864
- };
2865
2896
  var sequencePremountSchema = {
2866
- ...premountSchema,
2867
- ...premountStyleSchema
2897
+ ...premountSchema
2868
2898
  };
2869
2899
  var sequenceStyleSchema = {
2870
2900
  ...transformSchema,
2901
+ ...backgroundSchema,
2902
+ ...borderSchema,
2871
2903
  ...sequencePremountSchema
2872
2904
  };
2873
2905
  var hiddenField = {
@@ -3155,6 +3187,9 @@ var PremountContext = createContext15({
3155
3187
  premountFramesRemaining: 0
3156
3188
  });
3157
3189
  var ENABLE_V5_BREAKING_CHANGES = false;
3190
+ var resolveV5Default = (value) => {
3191
+ return value ?? ENABLE_V5_BREAKING_CHANGES;
3192
+ };
3158
3193
  var usePremounting = ({
3159
3194
  from,
3160
3195
  durationInFrames,
@@ -6203,38 +6238,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
6203
6238
  });
6204
6239
  };
6205
6240
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
6206
- var CACHE_SIZE = 5;
6207
- var getActualTime = ({
6208
- loopBehavior,
6209
- durationFound,
6210
- timeInSec
6211
- }) => {
6212
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6213
- };
6214
- var decodeImage = async ({
6241
+ var createImageDecoder = async ({
6215
6242
  resolvedSrc,
6216
6243
  signal,
6217
6244
  requestInit,
6218
- currentTime,
6219
- initialLoopBehavior
6245
+ contentType
6220
6246
  }) => {
6221
6247
  if (typeof ImageDecoder === "undefined") {
6222
6248
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
6223
6249
  }
6224
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
6225
- const { body } = res;
6250
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
6251
+ const { body } = response;
6226
6252
  if (!body) {
6227
6253
  throw new Error("Got no body");
6228
6254
  }
6229
6255
  const decoder = new ImageDecoder({
6230
6256
  data: body,
6231
- type: res.headers.get("Content-Type") || "image/gif"
6257
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
6232
6258
  });
6233
- await decoder.completed;
6259
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
6234
6260
  const { selectedTrack } = decoder.tracks;
6235
6261
  if (!selectedTrack) {
6262
+ decoder.close();
6236
6263
  throw new Error("No selected track");
6237
6264
  }
6265
+ return { decoder, selectedTrack };
6266
+ };
6267
+ var CACHE_SIZE = 5;
6268
+ var getActualTime = ({
6269
+ loopBehavior,
6270
+ durationFound,
6271
+ timeInSec
6272
+ }) => {
6273
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6274
+ };
6275
+ var decodeImage = async ({
6276
+ resolvedSrc,
6277
+ signal,
6278
+ requestInit,
6279
+ currentTime,
6280
+ initialLoopBehavior
6281
+ }) => {
6282
+ const { decoder, selectedTrack } = await createImageDecoder({
6283
+ resolvedSrc,
6284
+ signal,
6285
+ requestInit,
6286
+ contentType: null
6287
+ });
6238
6288
  const cache2 = [];
6239
6289
  let durationFound = null;
6240
6290
  const getFrameByIndex = async (frameIndex) => {
@@ -6340,6 +6390,13 @@ var decodeImage = async ({
6340
6390
  return closest;
6341
6391
  };
6342
6392
  return {
6393
+ close: () => {
6394
+ for (const item of cache2) {
6395
+ item.frame?.close();
6396
+ item.frame = null;
6397
+ }
6398
+ decoder.close();
6399
+ },
6343
6400
  getFrame,
6344
6401
  frameCount: selectedTrack.frameCount
6345
6402
  };
@@ -6377,6 +6434,7 @@ var animatedImageSchema = {
6377
6434
  keyframable: false
6378
6435
  },
6379
6436
  ...baseSchema,
6437
+ ...premountSchema,
6380
6438
  playbackRate: {
6381
6439
  type: "number",
6382
6440
  min: 0,
@@ -6387,7 +6445,9 @@ var animatedImageSchema = {
6387
6445
  hiddenFromList: false,
6388
6446
  keyframable: false
6389
6447
  },
6390
- ...transformSchema
6448
+ ...transformSchema,
6449
+ ...backgroundSchema,
6450
+ ...borderSchema
6391
6451
  };
6392
6452
  var getCanvasPropsFromSequenceProps = (props) => {
6393
6453
  const canvasProps = {};
@@ -6439,6 +6499,15 @@ var AnimatedImageContent = forwardRef4(({
6439
6499
  const [initialLoopBehavior] = useState6(() => loopBehavior);
6440
6500
  useEffect5(() => {
6441
6501
  const controller = new AbortController;
6502
+ let cancelled = false;
6503
+ let continued = false;
6504
+ const continueRenderOnce = () => {
6505
+ if (continued) {
6506
+ return;
6507
+ }
6508
+ continued = true;
6509
+ continueRender2(decodeHandle);
6510
+ };
6442
6511
  decodeImage({
6443
6512
  resolvedSrc,
6444
6513
  signal: controller.signal,
@@ -6446,22 +6515,31 @@ var AnimatedImageContent = forwardRef4(({
6446
6515
  currentTime: currentTimeRef.current,
6447
6516
  initialLoopBehavior
6448
6517
  }).then((d) => {
6518
+ if (cancelled) {
6519
+ d.close();
6520
+ return;
6521
+ }
6449
6522
  setImageDecoder(d);
6450
- continueRender2(decodeHandle);
6523
+ continueRenderOnce();
6451
6524
  }).catch((err) => {
6525
+ if (cancelled) {
6526
+ return;
6527
+ }
6452
6528
  if (err.name === "AbortError") {
6453
- continueRender2(decodeHandle);
6529
+ continueRenderOnce();
6454
6530
  return;
6455
6531
  }
6456
6532
  if (onError) {
6457
6533
  onError?.(err);
6458
- continueRender2(decodeHandle);
6534
+ continueRenderOnce();
6459
6535
  } else {
6460
6536
  cancelRender(err);
6461
6537
  }
6462
6538
  });
6463
6539
  return () => {
6540
+ cancelled = true;
6464
6541
  controller.abort();
6542
+ continueRenderOnce();
6465
6543
  };
6466
6544
  }, [
6467
6545
  resolvedSrc,
@@ -6471,6 +6549,11 @@ var AnimatedImageContent = forwardRef4(({
6471
6549
  initialLoopBehavior,
6472
6550
  continueRender2
6473
6551
  ]);
6552
+ useEffect5(() => {
6553
+ return () => {
6554
+ imageDecoder?.close();
6555
+ };
6556
+ }, [imageDecoder]);
6474
6557
  useLayoutEffect2(() => {
6475
6558
  if (!imageDecoder) {
6476
6559
  return;
@@ -6540,6 +6623,11 @@ var AnimatedImageInner = ({
6540
6623
  className,
6541
6624
  style,
6542
6625
  durationInFrames,
6626
+ from,
6627
+ premountFor,
6628
+ postmountFor,
6629
+ styleWhilePremounted,
6630
+ styleWhilePostmounted,
6543
6631
  requestInit,
6544
6632
  effects = [],
6545
6633
  controls,
@@ -6551,6 +6639,24 @@ var AnimatedImageInner = ({
6551
6639
  useImperativeHandle2(ref, () => {
6552
6640
  return actualRef.current;
6553
6641
  }, []);
6642
+ const {
6643
+ effectivePostmountFor,
6644
+ effectivePremountFor,
6645
+ freezeFrame,
6646
+ isPremountingOrPostmounting,
6647
+ postmountingActive,
6648
+ premountingActive,
6649
+ premountingStyle
6650
+ } = usePremounting({
6651
+ from: from ?? 0,
6652
+ durationInFrames: durationInFrames ?? Infinity,
6653
+ premountFor: premountFor ?? null,
6654
+ postmountFor: postmountFor ?? null,
6655
+ style: style ?? null,
6656
+ styleWhilePremounted: styleWhilePremounted ?? null,
6657
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
6658
+ hideWhilePremounted: "display-none"
6659
+ });
6554
6660
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
6555
6661
  const animatedImageProps = {
6556
6662
  src,
@@ -6562,24 +6668,33 @@ var AnimatedImageInner = ({
6562
6668
  loopBehavior,
6563
6669
  id,
6564
6670
  className,
6565
- style,
6671
+ style: premountingStyle ?? undefined,
6566
6672
  requestInit,
6567
6673
  ...canvasProps
6568
6674
  };
6569
- return /* @__PURE__ */ jsx14(Sequence, {
6570
- layout: "none",
6571
- durationInFrames,
6572
- name: "<AnimatedImage>",
6573
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6574
- controls,
6575
- _remotionInternalEffects: memoizedEffectDefinitions,
6576
- ...sequenceProps,
6577
- outlineRef: actualRef,
6578
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6579
- ...animatedImageProps,
6580
- ref: actualRef,
6581
- effects,
6582
- controls
6675
+ return /* @__PURE__ */ jsx14(Freeze, {
6676
+ frame: freezeFrame,
6677
+ active: isPremountingOrPostmounting,
6678
+ children: /* @__PURE__ */ jsx14(Sequence, {
6679
+ layout: "none",
6680
+ from: from ?? 0,
6681
+ durationInFrames: durationInFrames ?? Infinity,
6682
+ name: "<AnimatedImage>",
6683
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6684
+ controls,
6685
+ _remotionInternalEffects: memoizedEffectDefinitions,
6686
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
6687
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
6688
+ _remotionInternalIsPremounting: premountingActive,
6689
+ _remotionInternalIsPostmounting: postmountingActive,
6690
+ ...sequenceProps,
6691
+ outlineRef: actualRef,
6692
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6693
+ ...animatedImageProps,
6694
+ ref: actualRef,
6695
+ effects,
6696
+ controls
6697
+ })
6583
6698
  })
6584
6699
  });
6585
6700
  };
@@ -7295,13 +7410,17 @@ var makeSharedElementSourceNode = ({
7295
7410
  }) => {
7296
7411
  let connected = null;
7297
7412
  let disposed = false;
7413
+ let currentAudioContext = audioContext;
7298
7414
  return {
7415
+ setAudioContext: (newAudioContext) => {
7416
+ currentAudioContext = newAudioContext;
7417
+ },
7299
7418
  attemptToConnect: () => {
7300
7419
  if (disposed) {
7301
7420
  throw new Error("SharedElementSourceNode has been disposed");
7302
7421
  }
7303
- if (!connected && ref.current) {
7304
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
7422
+ if (!connected && ref.current && currentAudioContext) {
7423
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
7305
7424
  connected = mediaElementSourceNode;
7306
7425
  }
7307
7426
  },
@@ -7629,19 +7748,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7629
7748
  const audioCtx = useContext21(SharedAudioContext);
7630
7749
  const audioContext = audioCtx?.audioContext ?? null;
7631
7750
  const resume = audioCtx?.resume;
7632
- const refs = useMemo22(() => {
7751
+ const [refs] = useState10(() => {
7633
7752
  return new Array(numberOfAudioTags).fill(true).map(() => {
7634
7753
  const ref = createRef2();
7635
7754
  return {
7636
7755
  id: Math.random(),
7637
7756
  ref,
7638
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
7757
+ mediaElementSourceNode: makeSharedElementSourceNode({
7639
7758
  audioContext,
7640
7759
  ref
7641
- }) : null
7760
+ })
7642
7761
  };
7643
7762
  });
7644
- }, [audioContext, numberOfAudioTags]);
7763
+ });
7764
+ for (const { mediaElementSourceNode } of refs) {
7765
+ mediaElementSourceNode?.setAudioContext(audioContext);
7766
+ }
7645
7767
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7646
7768
  effectToUse(() => {
7647
7769
  return () => {
@@ -7709,7 +7831,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7709
7831
  const cloned = [...takenAudios.current];
7710
7832
  const index = refs.findIndex((r) => r.id === id);
7711
7833
  if (index === -1) {
7712
- throw new TypeError("Error occured in ");
7834
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r) => r.id).join(", ")}`);
7713
7835
  }
7714
7836
  cloned[index] = false;
7715
7837
  takenAudios.current = cloned;
@@ -7813,10 +7935,10 @@ var useSharedAudio = ({
7813
7935
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
7814
7936
  }
7815
7937
  const el = React20.createRef();
7816
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
7817
- audioContext: audioCtx.audioContext,
7938
+ const mediaElementSourceNode = makeSharedElementSourceNode({
7939
+ audioContext: audioCtx?.audioContext ?? null,
7818
7940
  ref: el
7819
- }) : null;
7941
+ });
7820
7942
  return {
7821
7943
  el,
7822
7944
  id: Math.random(),
@@ -7831,6 +7953,7 @@ var useSharedAudio = ({
7831
7953
  }
7832
7954
  };
7833
7955
  });
7956
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
7834
7957
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7835
7958
  if (typeof document !== "undefined") {
7836
7959
  effectToUse(() => {
@@ -9542,6 +9665,7 @@ var AudioRefForwardingFunction = (props, ref) => {
9542
9665
  const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
9543
9666
  const { fps } = useVideoConfig();
9544
9667
  const environment = useRemotionEnvironment();
9668
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
9545
9669
  if (environment.isClientSideRendering) {
9546
9670
  throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
9547
9671
  }
@@ -9611,7 +9735,7 @@ var AudioRefForwardingFunction = (props, ref) => {
9611
9735
  name,
9612
9736
  children: /* @__PURE__ */ jsx23(Html5Audio, {
9613
9737
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
9614
- pauseWhenBuffering: pauseWhenBuffering ?? false,
9738
+ pauseWhenBuffering: shouldPauseWhenBuffering,
9615
9739
  ...otherProps,
9616
9740
  ref
9617
9741
  })
@@ -9639,7 +9763,7 @@ var AudioRefForwardingFunction = (props, ref) => {
9639
9763
  ref,
9640
9764
  onNativeError: onError,
9641
9765
  onDuration,
9642
- pauseWhenBuffering: pauseWhenBuffering ?? false,
9766
+ pauseWhenBuffering: shouldPauseWhenBuffering,
9643
9767
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
9644
9768
  showInTimeline: showInTimeline ?? true
9645
9769
  });
@@ -9688,7 +9812,9 @@ var solidSchema = {
9688
9812
  description: "Pixel density",
9689
9813
  hiddenFromList: false
9690
9814
  },
9691
- ...transformSchema
9815
+ ...transformSchema,
9816
+ ...backgroundSchema,
9817
+ ...borderSchema
9692
9818
  };
9693
9819
  var SolidInner = ({
9694
9820
  color,
@@ -10242,7 +10368,9 @@ var htmlInCanvasSchema = {
10242
10368
  description: "Pixel density",
10243
10369
  hiddenFromList: false
10244
10370
  },
10245
- ...transformSchema
10371
+ ...transformSchema,
10372
+ ...backgroundSchema,
10373
+ ...borderSchema
10246
10374
  };
10247
10375
  var HtmlInCanvasWrapped = withInteractivitySchema({
10248
10376
  Component: HtmlInCanvasInner,
@@ -10264,6 +10392,7 @@ function truncateSrcForLabel(src) {
10264
10392
  }
10265
10393
  var canvasImageSchema = {
10266
10394
  ...baseSchema,
10395
+ ...premountSchema,
10267
10396
  fit: {
10268
10397
  type: "enum",
10269
10398
  default: "fill",
@@ -10274,7 +10403,9 @@ var canvasImageSchema = {
10274
10403
  cover: {}
10275
10404
  }
10276
10405
  },
10277
- ...transformSchema
10406
+ ...transformSchema,
10407
+ ...backgroundSchema,
10408
+ ...borderSchema
10278
10409
  };
10279
10410
  var makeAbortError = () => {
10280
10411
  if (typeof DOMException !== "undefined") {
@@ -10598,6 +10729,10 @@ var CanvasImageInner = forwardRef10(({
10598
10729
  from,
10599
10730
  trimBefore,
10600
10731
  freeze,
10732
+ premountFor,
10733
+ postmountFor,
10734
+ styleWhilePremounted,
10735
+ styleWhilePostmounted,
10601
10736
  hidden,
10602
10737
  name,
10603
10738
  showInTimeline,
@@ -10615,39 +10750,65 @@ var CanvasImageInner = forwardRef10(({
10615
10750
  useImperativeHandle7(ref, () => {
10616
10751
  return actualRef.current;
10617
10752
  }, []);
10618
- return /* @__PURE__ */ jsx26(Sequence, {
10619
- layout: "none",
10753
+ const {
10754
+ effectivePostmountFor,
10755
+ effectivePremountFor,
10756
+ freezeFrame,
10757
+ isPremountingOrPostmounting,
10758
+ postmountingActive,
10759
+ premountingActive,
10760
+ premountingStyle
10761
+ } = usePremounting({
10620
10762
  from: from ?? 0,
10621
- trimBefore,
10622
10763
  durationInFrames: durationInFrames ?? Infinity,
10623
- freeze,
10624
- hidden,
10625
- showInTimeline: showInTimeline ?? true,
10626
- name: name ?? "<CanvasImage>",
10627
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10628
- controls,
10629
- _remotionInternalEffects: memoizedEffectDefinitions,
10630
- _remotionInternalIsMedia: { type: "image", src },
10631
- _remotionInternalStack: stack,
10632
- outlineRef: outlineRef ?? actualRef,
10633
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10634
- ref: actualRef,
10635
- src,
10636
- width,
10637
- height,
10638
- fit,
10639
- effects,
10764
+ premountFor: premountFor ?? null,
10765
+ postmountFor: postmountFor ?? null,
10766
+ style: style ?? null,
10767
+ styleWhilePremounted: styleWhilePremounted ?? null,
10768
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
10769
+ hideWhilePremounted: "display-none"
10770
+ });
10771
+ return /* @__PURE__ */ jsx26(Freeze, {
10772
+ frame: freezeFrame,
10773
+ active: isPremountingOrPostmounting,
10774
+ children: /* @__PURE__ */ jsx26(Sequence, {
10775
+ layout: "none",
10776
+ from: from ?? 0,
10777
+ trimBefore,
10778
+ durationInFrames: durationInFrames ?? Infinity,
10779
+ freeze,
10780
+ hidden,
10781
+ showInTimeline: showInTimeline ?? true,
10782
+ name: name ?? "<CanvasImage>",
10783
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10640
10784
  controls,
10641
- className,
10642
- style,
10643
- id,
10644
- onError,
10645
- pauseWhenLoading,
10646
- maxRetries,
10647
- delayRenderRetries,
10648
- delayRenderTimeoutInMilliseconds,
10649
- refForOutline: outlineRef ?? null,
10650
- ...canvasProps
10785
+ _remotionInternalEffects: memoizedEffectDefinitions,
10786
+ _remotionInternalIsMedia: { type: "image", src },
10787
+ _remotionInternalStack: stack,
10788
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
10789
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
10790
+ _remotionInternalIsPremounting: premountingActive,
10791
+ _remotionInternalIsPostmounting: postmountingActive,
10792
+ outlineRef: outlineRef ?? actualRef,
10793
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10794
+ ref: actualRef,
10795
+ src,
10796
+ width,
10797
+ height,
10798
+ fit,
10799
+ effects,
10800
+ controls,
10801
+ className,
10802
+ style: premountingStyle ?? undefined,
10803
+ id,
10804
+ onError,
10805
+ pauseWhenLoading,
10806
+ maxRetries,
10807
+ delayRenderRetries,
10808
+ delayRenderTimeoutInMilliseconds,
10809
+ refForOutline: outlineRef ?? null,
10810
+ ...canvasProps
10811
+ })
10651
10812
  })
10652
10813
  });
10653
10814
  });
@@ -10864,6 +11025,11 @@ var NativeImgInner = ({
10864
11025
  trimBefore,
10865
11026
  durationInFrames,
10866
11027
  freeze,
11028
+ premountFor,
11029
+ postmountFor,
11030
+ style,
11031
+ styleWhilePremounted,
11032
+ styleWhilePostmounted,
10867
11033
  controls,
10868
11034
  outlineRef: refForOutline,
10869
11035
  ...props2
@@ -10871,24 +11037,51 @@ var NativeImgInner = ({
10871
11037
  if (!src) {
10872
11038
  throw new Error('No "src" prop was passed to <Img>.');
10873
11039
  }
10874
- return /* @__PURE__ */ jsx28(Sequence, {
10875
- layout: "none",
11040
+ const {
11041
+ effectivePostmountFor,
11042
+ effectivePremountFor,
11043
+ freezeFrame,
11044
+ isPremountingOrPostmounting,
11045
+ postmountingActive,
11046
+ premountingActive,
11047
+ premountingStyle
11048
+ } = usePremounting({
10876
11049
  from: from ?? 0,
10877
- trimBefore,
10878
11050
  durationInFrames: durationInFrames ?? Infinity,
10879
- freeze,
10880
- _remotionInternalStack: stack,
10881
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
10882
- _remotionInternalIsMedia: { type: "image", src },
10883
- name: name ?? "<Img>",
10884
- controls,
10885
- showInTimeline: showInTimeline ?? true,
10886
- hidden,
10887
- outlineRef: refForOutline,
10888
- children: /* @__PURE__ */ jsx28(ImgContent, {
10889
- src,
10890
- refForOutline,
10891
- ...props2
11051
+ premountFor: premountFor ?? null,
11052
+ postmountFor: postmountFor ?? null,
11053
+ style: style ?? null,
11054
+ styleWhilePremounted: styleWhilePremounted ?? null,
11055
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
11056
+ hideWhilePremounted: "display-none"
11057
+ });
11058
+ return /* @__PURE__ */ jsx28(Freeze, {
11059
+ frame: freezeFrame,
11060
+ active: isPremountingOrPostmounting,
11061
+ children: /* @__PURE__ */ jsx28(Sequence, {
11062
+ layout: "none",
11063
+ from: from ?? 0,
11064
+ trimBefore,
11065
+ durationInFrames: durationInFrames ?? Infinity,
11066
+ freeze,
11067
+ _remotionInternalStack: stack,
11068
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
11069
+ _remotionInternalIsMedia: { type: "image", src },
11070
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
11071
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
11072
+ _remotionInternalIsPremounting: premountingActive,
11073
+ _remotionInternalIsPostmounting: postmountingActive,
11074
+ name: name ?? "<Img>",
11075
+ controls,
11076
+ showInTimeline: showInTimeline ?? true,
11077
+ hidden,
11078
+ outlineRef: refForOutline,
11079
+ children: /* @__PURE__ */ jsx28(ImgContent, {
11080
+ src,
11081
+ refForOutline,
11082
+ style: premountingStyle ?? undefined,
11083
+ ...props2
11084
+ })
10892
11085
  })
10893
11086
  });
10894
11087
  };
@@ -10901,7 +11094,10 @@ var imgSchema = {
10901
11094
  keyframable: false
10902
11095
  },
10903
11096
  ...baseSchema,
10904
- ...transformSchema
11097
+ ...premountSchema,
11098
+ ...transformSchema,
11099
+ ...backgroundSchema,
11100
+ ...borderSchema
10905
11101
  };
10906
11102
  var imgCanvasFallbackIncompatibleProps = new Set([
10907
11103
  "alt",
@@ -10957,6 +11153,10 @@ var ImgInner = ({
10957
11153
  trimBefore,
10958
11154
  durationInFrames,
10959
11155
  freeze,
11156
+ premountFor,
11157
+ postmountFor,
11158
+ styleWhilePremounted,
11159
+ styleWhilePostmounted,
10960
11160
  controls,
10961
11161
  width,
10962
11162
  height,
@@ -10970,6 +11170,7 @@ var ImgInner = ({
10970
11170
  ...props2
10971
11171
  }) => {
10972
11172
  const refForOutline = useRef24(null);
11173
+ const shouldPauseWhenLoading = resolveV5Default(pauseWhenLoading);
10973
11174
  if (effects.length === 0) {
10974
11175
  return /* @__PURE__ */ jsx28(NativeImgInner, {
10975
11176
  ...props2,
@@ -10983,13 +11184,17 @@ var ImgInner = ({
10983
11184
  trimBefore,
10984
11185
  durationInFrames,
10985
11186
  freeze,
11187
+ premountFor,
11188
+ postmountFor,
11189
+ styleWhilePremounted,
11190
+ styleWhilePostmounted,
10986
11191
  controls,
10987
11192
  width,
10988
11193
  height,
10989
11194
  className,
10990
11195
  style,
10991
11196
  id,
10992
- pauseWhenLoading,
11197
+ pauseWhenLoading: shouldPauseWhenLoading,
10993
11198
  maxRetries,
10994
11199
  delayRenderRetries,
10995
11200
  delayRenderTimeoutInMilliseconds,
@@ -11018,7 +11223,7 @@ var ImgInner = ({
11018
11223
  className,
11019
11224
  style,
11020
11225
  id,
11021
- pauseWhenLoading,
11226
+ pauseWhenLoading: shouldPauseWhenLoading,
11022
11227
  maxRetries,
11023
11228
  delayRenderRetries,
11024
11229
  delayRenderTimeoutInMilliseconds,
@@ -11026,6 +11231,10 @@ var ImgInner = ({
11026
11231
  trimBefore,
11027
11232
  durationInFrames,
11028
11233
  freeze,
11234
+ premountFor,
11235
+ postmountFor,
11236
+ styleWhilePremounted,
11237
+ styleWhilePostmounted,
11029
11238
  hidden,
11030
11239
  name: name ?? "<Img>",
11031
11240
  showInTimeline,
@@ -11064,7 +11273,20 @@ var interactiveElementSchema = {
11064
11273
  ...baseSchema,
11065
11274
  ...transformSchema
11066
11275
  };
11276
+ var interactiveBackgroundElementSchema = {
11277
+ ...interactiveElementSchema,
11278
+ ...backgroundSchema
11279
+ };
11280
+ var interactiveBorderElementSchema = {
11281
+ ...interactiveBackgroundElementSchema,
11282
+ ...borderSchema
11283
+ };
11067
11284
  var interactiveTextElementSchema = {
11285
+ ...interactiveBorderElementSchema,
11286
+ ...textSchema,
11287
+ ...textContentSchema
11288
+ };
11289
+ var interactiveSvgTextElementSchema = {
11068
11290
  ...interactiveElementSchema,
11069
11291
  ...textSchema,
11070
11292
  ...textContentSchema
@@ -11143,6 +11365,8 @@ var Interactive = {
11143
11365
  baseSchema,
11144
11366
  transformSchema,
11145
11367
  textSchema,
11368
+ backgroundSchema,
11369
+ borderSchema,
11146
11370
  premountSchema,
11147
11371
  sequenceSchema,
11148
11372
  withSchema,
@@ -11179,10 +11403,39 @@ var Interactive = {
11179
11403
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
11180
11404
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
11181
11405
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
11182
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
11183
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
11406
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
11407
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
11184
11408
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
11185
11409
  };
11410
+ var getAnimatedImageDurationInSeconds = async ({
11411
+ resolvedSrc,
11412
+ signal,
11413
+ requestInit,
11414
+ contentType
11415
+ }) => {
11416
+ const { decoder, selectedTrack } = await createImageDecoder({
11417
+ resolvedSrc,
11418
+ signal,
11419
+ requestInit,
11420
+ contentType
11421
+ });
11422
+ try {
11423
+ const { image } = await decoder.decode({
11424
+ frameIndex: selectedTrack.frameCount - 1,
11425
+ completeFramesOnly: true
11426
+ });
11427
+ try {
11428
+ if (image.duration === null) {
11429
+ throw new Error("Could not determine animated image duration");
11430
+ }
11431
+ return (image.timestamp + image.duration) / 1e6;
11432
+ } finally {
11433
+ image.close();
11434
+ }
11435
+ } finally {
11436
+ decoder.close();
11437
+ }
11438
+ };
11186
11439
  var compositionsRef = React31.createRef();
11187
11440
  var CompositionManagerProvider = ({
11188
11441
  children,
@@ -12164,6 +12417,7 @@ var InnerOffthreadVideo = (props2) => {
12164
12417
  ...otherProps
12165
12418
  } = props2;
12166
12419
  const environment = useRemotionEnvironment();
12420
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
12167
12421
  if (environment.isClientSideRendering) {
12168
12422
  throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
12169
12423
  }
@@ -12188,7 +12442,7 @@ var InnerOffthreadVideo = (props2) => {
12188
12442
  durationInFrames: trimAfterValue,
12189
12443
  name,
12190
12444
  children: /* @__PURE__ */ jsx35(InnerOffthreadVideo, {
12191
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12445
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12192
12446
  ...otherProps,
12193
12447
  trimAfter: undefined,
12194
12448
  name: undefined,
@@ -12203,7 +12457,7 @@ var InnerOffthreadVideo = (props2) => {
12203
12457
  validateMediaProps(props2, "Video");
12204
12458
  if (environment.isRendering) {
12205
12459
  return /* @__PURE__ */ jsx35(OffthreadVideoForRendering, {
12206
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12460
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12207
12461
  ...otherProps,
12208
12462
  trimAfter: undefined,
12209
12463
  name: undefined,
@@ -12228,7 +12482,7 @@ var InnerOffthreadVideo = (props2) => {
12228
12482
  _remotionInternalStack: stack ?? null,
12229
12483
  onDuration,
12230
12484
  onlyWarnForMediaSeekingError: true,
12231
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12485
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12232
12486
  showInTimeline: showInTimeline ?? true,
12233
12487
  onAutoPlayError: onAutoPlayError ?? undefined,
12234
12488
  onVideoFrame: onVideoFrame ?? null,
@@ -12286,7 +12540,7 @@ var OffthreadVideo = ({
12286
12540
  onAutoPlayError: onAutoPlayError ?? null,
12287
12541
  onError,
12288
12542
  onVideoFrame,
12289
- pauseWhenBuffering: pauseWhenBuffering ?? true,
12543
+ pauseWhenBuffering: resolveV5Default(pauseWhenBuffering),
12290
12544
  playbackRate: playbackRate ?? 1,
12291
12545
  preservePitch,
12292
12546
  toneFrequency: toneFrequency ?? 1,
@@ -12410,6 +12664,7 @@ var Internals = {
12410
12664
  useAbsoluteTimelinePosition,
12411
12665
  evaluateVolume,
12412
12666
  getAbsoluteSrc,
12667
+ getAnimatedImageDurationInSeconds,
12413
12668
  getAssetDisplayName,
12414
12669
  Timeline: exports_timeline_position_state,
12415
12670
  validateMediaTrimProps,
@@ -12434,7 +12689,6 @@ var Internals = {
12434
12689
  textSchema,
12435
12690
  transformSchema,
12436
12691
  premountSchema,
12437
- premountStyleSchema,
12438
12692
  flattenActiveSchema,
12439
12693
  getFlatSchemaWithAllKeys,
12440
12694
  RemotionRootContexts,
@@ -12573,6 +12827,7 @@ var seriesSequenceSchema = {
12573
12827
  hidden: Interactive.sequenceSchema.hidden,
12574
12828
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
12575
12829
  freeze: Interactive.baseSchema.freeze,
12830
+ trimBefore: Interactive.sequenceSchema.trimBefore,
12576
12831
  layout: Interactive.sequenceSchema.layout
12577
12832
  };
12578
12833
  var SeriesSequenceInner = forwardRef14(({
@@ -13168,6 +13423,7 @@ var VideoForwardingFunction = (props2, ref) => {
13168
13423
  const { loop, ...propsOtherThanLoop } = props2;
13169
13424
  const { fps } = useVideoConfig();
13170
13425
  const environment = useRemotionEnvironment();
13426
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
13171
13427
  if (environment.isClientSideRendering) {
13172
13428
  throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
13173
13429
  }
@@ -13226,7 +13482,7 @@ var VideoForwardingFunction = (props2, ref) => {
13226
13482
  durationInFrames: trimAfterValue === undefined ? undefined : trimAfterValue / (props2.playbackRate ?? 1),
13227
13483
  name,
13228
13484
  children: /* @__PURE__ */ jsx39(Html5Video, {
13229
- pauseWhenBuffering: pauseWhenBuffering ?? false,
13485
+ pauseWhenBuffering: shouldPauseWhenBuffering,
13230
13486
  onVideoFrame,
13231
13487
  ...otherProps,
13232
13488
  ref,
@@ -13252,7 +13508,7 @@ var VideoForwardingFunction = (props2, ref) => {
13252
13508
  ...otherProps,
13253
13509
  ref,
13254
13510
  onVideoFrame: onVideoFrame ?? null,
13255
- pauseWhenBuffering: pauseWhenBuffering ?? false,
13511
+ pauseWhenBuffering: shouldPauseWhenBuffering,
13256
13512
  onDuration,
13257
13513
  _remotionInternalStack: stack ?? null,
13258
13514
  _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed ?? false,