@remotion/promo-pages 4.0.390 → 4.0.391

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/Homepage.js CHANGED
@@ -755,7 +755,7 @@ var __defProp2, __export2 = (target, all) => {
755
755
  });
756
756
  }, useIsPlayer = () => {
757
757
  return useContext(IsPlayerContext);
758
- }, VERSION = "4.0.390", checkMultipleRemotionVersions = () => {
758
+ }, VERSION = "4.0.391", checkMultipleRemotionVersions = () => {
759
759
  if (typeof globalThis === "undefined") {
760
760
  return;
761
761
  }
@@ -1582,6 +1582,9 @@ Check that all your Remotion packages are on the same version. If your dependenc
1582
1582
  }
1583
1583
  const unclamped = state.frame[videoConfig.id] ?? (env.isPlayer ? 0 : getFrameForComposition(videoConfig.id));
1584
1584
  return Math.min(videoConfig.durationInFrames - 1, unclamped);
1585
+ }, useTimelineFrameRef = () => {
1586
+ const { frameRef } = useContext6(TimelineContext);
1587
+ return frameRef;
1585
1588
  }, useTimelineSetFrame = () => {
1586
1589
  const { setFrame } = useContext6(SetTimelineContext);
1587
1590
  return setFrame;
@@ -1647,7 +1650,7 @@ Check that all your Remotion packages are on the same version. If your dependenc
1647
1650
  }
1648
1651
  }, error = (options, ...args) => {
1649
1652
  return console.error(...transformArgs({ args, logLevel: "error", tag: options.tag }));
1650
- }, Log, handles, DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:", DELAY_RENDER_RETRIES_LEFT = "Retries left: ", DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.", DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after", defaultTimeout = 30000, delayRenderInternal = ({
1653
+ }, Log, DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:", DELAY_RENDER_RETRIES_LEFT = "Retries left: ", DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.", DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after", defaultTimeout = 30000, delayRenderInternal = ({
1651
1654
  scope,
1652
1655
  environment,
1653
1656
  label,
@@ -1657,33 +1660,29 @@ Check that all your Remotion packages are on the same version. If your dependenc
1657
1660
  throw new Error("The label parameter of delayRender() must be a string or undefined, got: " + JSON.stringify(label));
1658
1661
  }
1659
1662
  const handle = Math.random();
1660
- handles.push(handle);
1663
+ scope.remotion_delayRenderHandles.push(handle);
1661
1664
  const called = Error().stack?.replace(/^Error/g, "") ?? "";
1662
1665
  if (environment.isRendering) {
1663
- const timeoutToUse = (options?.timeoutInMilliseconds ?? (typeof scope === "undefined" ? defaultTimeout : scope.remotion_puppeteerTimeout ?? defaultTimeout)) - 2000;
1664
- if (typeof scope !== "undefined") {
1665
- const retriesLeft = (options?.retries ?? 0) - (scope.remotion_attempt - 1);
1666
- scope.remotion_delayRenderTimeouts[handle] = {
1667
- label: label ?? null,
1668
- startTime: Date.now(),
1669
- timeout: setTimeout(() => {
1670
- const message = [
1671
- `A delayRender()`,
1672
- label ? `"${label}"` : null,
1673
- `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
1674
- retriesLeft > 0 ? DELAY_RENDER_RETRIES_LEFT + retriesLeft : null,
1675
- retriesLeft > 0 ? DELAY_RENDER_RETRY_TOKEN : null,
1676
- DELAY_RENDER_CALLSTACK_TOKEN,
1677
- called
1678
- ].filter(truthy2).join(" ");
1679
- cancelRenderInternal(scope, Error(message));
1680
- }, timeoutToUse)
1681
- };
1682
- }
1683
- }
1684
- if (typeof scope !== "undefined") {
1685
- scope.remotion_renderReady = false;
1666
+ const timeoutToUse = (options?.timeoutInMilliseconds ?? scope.remotion_puppeteerTimeout ?? defaultTimeout) - 2000;
1667
+ const retriesLeft = (options?.retries ?? 0) - (scope.remotion_attempt - 1);
1668
+ scope.remotion_delayRenderTimeouts[handle] = {
1669
+ label: label ?? null,
1670
+ startTime: Date.now(),
1671
+ timeout: setTimeout(() => {
1672
+ const message = [
1673
+ `A delayRender()`,
1674
+ label ? `"${label}"` : null,
1675
+ `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
1676
+ retriesLeft > 0 ? DELAY_RENDER_RETRIES_LEFT + retriesLeft : null,
1677
+ retriesLeft > 0 ? DELAY_RENDER_RETRY_TOKEN : null,
1678
+ DELAY_RENDER_CALLSTACK_TOKEN,
1679
+ called
1680
+ ].filter(truthy2).join(" ");
1681
+ cancelRenderInternal(scope, Error(message));
1682
+ }, timeoutToUse)
1683
+ };
1686
1684
  }
1685
+ scope.remotion_renderReady = false;
1687
1686
  return handle;
1688
1687
  }, continueRenderInternal = ({
1689
1688
  scope,
@@ -1697,7 +1696,7 @@ Check that all your Remotion packages are on the same version. If your dependenc
1697
1696
  if (typeof handle !== "number") {
1698
1697
  throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: " + JSON.stringify(handle));
1699
1698
  }
1700
- handles = handles.filter((h) => {
1699
+ scope.remotion_delayRenderHandles = scope.remotion_delayRenderHandles.filter((h) => {
1701
1700
  if (h === handle) {
1702
1701
  if (environment.isRendering && scope !== undefined) {
1703
1702
  if (!scope.remotion_delayRenderTimeouts[handle]) {
@@ -1717,7 +1716,7 @@ Check that all your Remotion packages are on the same version. If your dependenc
1717
1716
  }
1718
1717
  return true;
1719
1718
  });
1720
- if (handles.length === 0 && typeof scope !== "undefined") {
1719
+ if (scope.remotion_delayRenderHandles.length === 0) {
1721
1720
  scope.remotion_renderReady = true;
1722
1721
  }
1723
1722
  }, LogLevelContext, useLogLevel = () => {
@@ -1734,19 +1733,25 @@ Check that all your Remotion packages are on the same version. If your dependenc
1734
1733
  return mountTime;
1735
1734
  }, DelayRenderContextType, useDelayRender = () => {
1736
1735
  const environment = useRemotionEnvironment();
1737
- const scope = useContext8(DelayRenderContextType);
1736
+ const scope = useContext8(DelayRenderContextType) ?? (typeof window !== "undefined" ? window : undefined);
1738
1737
  const logLevel = useLogLevel();
1739
1738
  const delayRender2 = useCallback4((label, options) => {
1739
+ if (!scope) {
1740
+ return Math.random();
1741
+ }
1740
1742
  return delayRenderInternal({
1741
- scope: scope ?? (typeof window !== "undefined" ? window : undefined),
1743
+ scope,
1742
1744
  environment,
1743
1745
  label: label ?? null,
1744
1746
  options: options ?? {}
1745
1747
  });
1746
1748
  }, [environment, scope]);
1747
1749
  const continueRender2 = useCallback4((handle) => {
1750
+ if (!scope) {
1751
+ return;
1752
+ }
1748
1753
  continueRenderInternal({
1749
- scope: scope ?? (typeof window !== "undefined" ? window : undefined),
1754
+ scope,
1750
1755
  handle,
1751
1756
  environment,
1752
1757
  logLevel
@@ -1764,6 +1769,7 @@ Check that all your Remotion packages are on the same version. If your dependenc
1764
1769
  const [remotionRootId] = useState5(() => String(random(null)));
1765
1770
  const [_frame, setFrame] = useState5(() => getInitialFrameState());
1766
1771
  const frame = frameState ?? _frame;
1772
+ const frameRef = useRef2(0);
1767
1773
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
1768
1774
  if (typeof window !== "undefined") {
1769
1775
  useLayoutEffect(() => {
@@ -1799,7 +1805,8 @@ Check that all your Remotion packages are on the same version. If your dependenc
1799
1805
  rootId: remotionRootId,
1800
1806
  playbackRate,
1801
1807
  setPlaybackRate,
1802
- audioAndVideoTags
1808
+ audioAndVideoTags,
1809
+ frameRef
1803
1810
  };
1804
1811
  }, [frame, playbackRate, playing, remotionRootId]);
1805
1812
  const setTimelineContextValue = useMemo7(() => {
@@ -3105,7 +3112,7 @@ Check that all your Remotion packages are on the same version. If your dependenc
3105
3112
  });
3106
3113
  }, [refs]);
3107
3114
  const registerAudio = useCallback7((options) => {
3108
- const { aud, audioId, premounting } = options;
3115
+ const { aud, audioId, premounting, postmounting } = options;
3109
3116
  const found = audios.current?.find((a) => a.audioId === audioId);
3110
3117
  if (found) {
3111
3118
  return found;
@@ -3124,7 +3131,9 @@ Check that all your Remotion packages are on the same version. If your dependenc
3124
3131
  el: ref,
3125
3132
  audioId,
3126
3133
  mediaElementSourceNode,
3127
- premounting
3134
+ premounting,
3135
+ audioMounted: Boolean(ref.current),
3136
+ postmounting
3128
3137
  };
3129
3138
  audios.current?.push(newElem);
3130
3139
  rerenderAudios();
@@ -3145,12 +3154,17 @@ Check that all your Remotion packages are on the same version. If your dependenc
3145
3154
  aud,
3146
3155
  audioId,
3147
3156
  id,
3148
- premounting
3157
+ premounting,
3158
+ postmounting
3149
3159
  }) => {
3150
3160
  let changed = false;
3151
3161
  audios.current = audios.current?.map((prevA) => {
3162
+ const audioMounted = Boolean(prevA.el.current);
3163
+ if (prevA.audioMounted !== audioMounted) {
3164
+ changed = true;
3165
+ }
3152
3166
  if (prevA.id === id) {
3153
- const isTheSame = compareProps(aud, prevA.props) && prevA.premounting === premounting;
3167
+ const isTheSame = compareProps(aud, prevA.props) && prevA.premounting === premounting && prevA.postmounting === postmounting;
3154
3168
  if (isTheSame) {
3155
3169
  return prevA;
3156
3170
  }
@@ -3159,7 +3173,9 @@ Check that all your Remotion packages are on the same version. If your dependenc
3159
3173
  ...prevA,
3160
3174
  props: aud,
3161
3175
  premounting,
3162
- audioId
3176
+ postmounting,
3177
+ audioId,
3178
+ audioMounted
3163
3179
  };
3164
3180
  }
3165
3181
  return prevA;
@@ -3221,12 +3237,13 @@ Check that all your Remotion packages are on the same version. If your dependenc
3221
3237
  }, useSharedAudio = ({
3222
3238
  aud,
3223
3239
  audioId,
3224
- premounting
3240
+ premounting,
3241
+ postmounting
3225
3242
  }) => {
3226
3243
  const ctx = useContext16(SharedAudioContext);
3227
3244
  const [elem] = useState11(() => {
3228
3245
  if (ctx && ctx.numberOfAudioTags > 0) {
3229
- return ctx.registerAudio({ aud, audioId, premounting });
3246
+ return ctx.registerAudio({ aud, audioId, premounting, postmounting });
3230
3247
  }
3231
3248
  const el = React15.createRef();
3232
3249
  const mediaElementSourceNode = ctx?.audioContext ? makeSharedElementSourceNode({
@@ -3239,16 +3256,18 @@ Check that all your Remotion packages are on the same version. If your dependenc
3239
3256
  props: aud,
3240
3257
  audioId,
3241
3258
  mediaElementSourceNode,
3242
- premounting
3259
+ premounting,
3260
+ audioMounted: Boolean(el.current),
3261
+ postmounting
3243
3262
  };
3244
3263
  });
3245
3264
  const effectToUse = React15.useInsertionEffect ?? React15.useLayoutEffect;
3246
3265
  if (typeof document !== "undefined") {
3247
3266
  effectToUse(() => {
3248
3267
  if (ctx && ctx.numberOfAudioTags > 0) {
3249
- ctx.updateAudio({ id: elem.id, aud, audioId, premounting });
3268
+ ctx.updateAudio({ id: elem.id, aud, audioId, premounting, postmounting });
3250
3269
  }
3251
- }, [aud, ctx, elem.id, audioId, premounting]);
3270
+ }, [aud, ctx, elem.id, audioId, premounting, postmounting]);
3252
3271
  effectToUse(() => {
3253
3272
  return () => {
3254
3273
  if (ctx && ctx.numberOfAudioTags > 0) {
@@ -4486,7 +4505,8 @@ Check that all your Remotion packages are on the same version. If your dependenc
4486
4505
  const { el: audioRef, mediaElementSourceNode } = useSharedAudio({
4487
4506
  aud: propsToPass,
4488
4507
  audioId: id,
4489
- premounting: Boolean(sequenceContext?.premounting)
4508
+ premounting: Boolean(sequenceContext?.premounting),
4509
+ postmounting: Boolean(sequenceContext?.postmounting)
4490
4510
  });
4491
4511
  useMediaInTimeline({
4492
4512
  volume,
@@ -6780,6 +6800,7 @@ var init_esm = __esm(() => {
6780
6800
  __export2(exports_timeline_position_state, {
6781
6801
  useTimelineSetFrame: () => useTimelineSetFrame,
6782
6802
  useTimelinePosition: () => useTimelinePosition,
6803
+ useTimelineFrameRef: () => useTimelineFrameRef,
6783
6804
  usePlayingState: () => usePlayingState,
6784
6805
  persistCurrentFrame: () => persistCurrentFrame,
6785
6806
  getInitialFrameState: () => getInitialFrameState,
@@ -6855,12 +6876,12 @@ var init_esm = __esm(() => {
6855
6876
  warn,
6856
6877
  error
6857
6878
  };
6858
- handles = [];
6859
6879
  if (typeof window !== "undefined") {
6860
6880
  window.remotion_renderReady = false;
6861
6881
  if (!window.remotion_delayRenderTimeouts) {
6862
6882
  window.remotion_delayRenderTimeouts = {};
6863
6883
  }
6884
+ window.remotion_delayRenderHandles = [];
6864
6885
  }
6865
6886
  LogLevelContext = createContext8({
6866
6887
  logLevel: "info",
@@ -6877,6 +6898,7 @@ var init_esm = __esm(() => {
6877
6898
  });
6878
6899
  TimelineContext = createContext10({
6879
6900
  frame: {},
6901
+ frameRef: { current: 0 },
6880
6902
  playing: false,
6881
6903
  playbackRate: 1,
6882
6904
  rootId: "",
@@ -20516,23 +20538,23 @@ init_esm();
20516
20538
  import { jsx as jsx50, jsxs as jsxs14 } from "react/jsx-runtime";
20517
20539
  import { jsx as jsx213, jsxs as jsxs24, Fragment as Fragment6 } from "react/jsx-runtime";
20518
20540
  import React41 from "react";
20519
- import { useContext as useContext210, useEffect as useEffect210, useState as useState35 } from "react";
20520
- import { useContext as useContext40, useEffect as useEffect36 } from "react";
20541
+ import { useContext as useContext210, useEffect as useEffect36, useState as useState35 } from "react";
20542
+ import { useContext as useContext40, useLayoutEffect as useLayoutEffect15 } from "react";
20521
20543
  import { jsx as jsx310 } from "react/jsx-runtime";
20522
- import { useCallback as useCallback27, useRef as useRef33 } from "react";
20523
- import { useEffect as useEffect37, useState as useState210 } from "react";
20524
- import { useContext as useContext42, useEffect as useEffect62, useRef as useRef42 } from "react";
20525
- import { useEffect as useEffect42 } from "react";
20526
- import { useCallback as useCallback28, useContext as useContext37, useMemo as useMemo42, useRef as useRef24, useState as useState36 } from "react";
20527
- import { useEffect as useEffect52, useRef as useRef34 } from "react";
20528
- import { useCallback as useCallback32, useEffect as useEffect72, useMemo as useMemo212, useState as useState42 } from "react";
20544
+ import { useCallback as useCallback27 } from "react";
20545
+ import { useEffect as useEffect210, useState as useState210 } from "react";
20546
+ import { useContext as useContext42, useEffect as useEffect52, useRef as useRef33 } from "react";
20547
+ import { useEffect as useEffect37 } from "react";
20548
+ import { useCallback as useCallback28, useContext as useContext37, useMemo as useMemo42, useRef as useRef34, useState as useState36 } from "react";
20549
+ import { useEffect as useEffect42, useRef as useRef24 } from "react";
20550
+ import { useCallback as useCallback32, useEffect as useEffect62, useMemo as useMemo212, useState as useState42 } from "react";
20529
20551
  import {
20530
20552
  forwardRef as forwardRef26,
20531
- useEffect as useEffect142,
20553
+ useEffect as useEffect132,
20532
20554
  useImperativeHandle as useImperativeHandle22,
20533
- useLayoutEffect as useLayoutEffect15,
20555
+ useLayoutEffect as useLayoutEffect23,
20534
20556
  useMemo as useMemo142,
20535
- useRef as useRef112,
20557
+ useRef as useRef102,
20536
20558
  useState as useState132
20537
20559
  } from "react";
20538
20560
  import React102, {
@@ -20540,28 +20562,28 @@ import React102, {
20540
20562
  forwardRef as forwardRef27,
20541
20563
  useCallback as useCallback112,
20542
20564
  useContext as useContext62,
20543
- useEffect as useEffect132,
20565
+ useEffect as useEffect122,
20544
20566
  useImperativeHandle as useImperativeHandle12,
20545
20567
  useMemo as useMemo122,
20546
- useRef as useRef102,
20568
+ useRef as useRef92,
20547
20569
  useState as useState113
20548
20570
  } from "react";
20549
- import { useCallback as useCallback82, useEffect as useEffect112, useMemo as useMemo92, useRef as useRef82, useState as useState102 } from "react";
20571
+ import { useCallback as useCallback82, useEffect as useEffect102, useMemo as useMemo92, useRef as useRef72, useState as useState102 } from "react";
20550
20572
  import { jsx as jsx45 } from "react/jsx-runtime";
20551
- import { useCallback as useCallback52, useMemo as useMemo43, useRef as useRef52, useState as useState62 } from "react";
20573
+ import { useCallback as useCallback52, useMemo as useMemo43, useRef as useRef42, useState as useState62 } from "react";
20552
20574
  import React38, { useCallback as useCallback42, useMemo as useMemo34, useState as useState52 } from "react";
20553
20575
  import { jsx as jsx54, jsxs as jsxs33 } from "react/jsx-runtime";
20554
20576
  import { jsx as jsx64, jsxs as jsxs42 } from "react/jsx-runtime";
20555
20577
  import {
20556
20578
  useCallback as useCallback62,
20557
20579
  useContext as useContext52,
20558
- useEffect as useEffect92,
20580
+ useEffect as useEffect83,
20559
20581
  useMemo as useMemo52,
20560
20582
  useState as useState82
20561
20583
  } from "react";
20562
- import { useEffect as useEffect83, useRef as useRef62, useState as useState72 } from "react";
20584
+ import { useEffect as useEffect72, useRef as useRef52, useState as useState72 } from "react";
20563
20585
  import { jsx as jsx74, jsxs as jsxs52 } from "react/jsx-runtime";
20564
- import { useCallback as useCallback72, useEffect as useEffect102, useMemo as useMemo62, useRef as useRef72, useState as useState92 } from "react";
20586
+ import { useCallback as useCallback72, useEffect as useEffect92, useMemo as useMemo62, useRef as useRef62, useState as useState92 } from "react";
20565
20587
  import { jsx as jsx84, jsxs as jsxs62 } from "react/jsx-runtime";
20566
20588
  import { useMemo as useMemo72 } from "react";
20567
20589
  import { jsxs as jsxs7 } from "react/jsx-runtime";
@@ -20569,10 +20591,10 @@ import { useMemo as useMemo82 } from "react";
20569
20591
  import { jsx as jsx94, jsxs as jsxs82, Fragment as Fragment22 } from "react/jsx-runtime";
20570
20592
  import React82 from "react";
20571
20593
  import { jsx as jsx104 } from "react/jsx-runtime";
20572
- import React92, { useEffect as useEffect122 } from "react";
20594
+ import React92, { useEffect as useEffect112 } from "react";
20573
20595
  import { jsx as jsx113 } from "react/jsx-runtime";
20574
20596
  import { useCallback as useCallback102, useMemo as useMemo112 } from "react";
20575
- import { useCallback as useCallback92, useMemo as useMemo102, useRef as useRef92 } from "react";
20597
+ import { useCallback as useCallback92, useMemo as useMemo102, useRef as useRef82 } from "react";
20576
20598
  import { jsx as jsx123, jsxs as jsxs92, Fragment as Fragment32 } from "react/jsx-runtime";
20577
20599
  import { useCallback as useCallback122, useMemo as useMemo132, useState as useState122 } from "react";
20578
20600
  import { jsx as jsx133 } from "react/jsx-runtime";
@@ -20685,6 +20707,7 @@ if (typeof window !== "undefined") {
20685
20707
  if (!window.remotion_delayRenderTimeouts) {
20686
20708
  window.remotion_delayRenderTimeouts = {};
20687
20709
  }
20710
+ window.remotion_delayRenderHandles = [];
20688
20711
  }
20689
20712
  var DELAY_RENDER_CALLSTACK_TOKEN2 = "The delayRender was called:";
20690
20713
  var DELAY_RENDER_RETRIES_LEFT2 = "Retries left: ";
@@ -21210,9 +21233,9 @@ import { jsx as jsx143 } from "react/jsx-runtime";
21210
21233
  import {
21211
21234
  forwardRef as forwardRef42,
21212
21235
  useImperativeHandle as useImperativeHandle42,
21213
- useLayoutEffect as useLayoutEffect23,
21236
+ useLayoutEffect as useLayoutEffect33,
21214
21237
  useMemo as useMemo172,
21215
- useRef as useRef132,
21238
+ useRef as useRef122,
21216
21239
  useState as useState142
21217
21240
  } from "react";
21218
21241
  import React132, {
@@ -21221,7 +21244,7 @@ import React132, {
21221
21244
  useCallback as useCallback132,
21222
21245
  useImperativeHandle as useImperativeHandle32,
21223
21246
  useMemo as useMemo162,
21224
- useRef as useRef122
21247
+ useRef as useRef112
21225
21248
  } from "react";
21226
21249
  import { useContext as useContext72, useMemo as useMemo152 } from "react";
21227
21250
  import { jsx as jsx153 } from "react/jsx-runtime";
@@ -21663,7 +21686,7 @@ var useBufferStateEmitter = (emitter) => {
21663
21686
  if (!bufferManager) {
21664
21687
  throw new Error("BufferingContextReact not found");
21665
21688
  }
21666
- useEffect36(() => {
21689
+ useLayoutEffect15(() => {
21667
21690
  const clear1 = bufferManager.listenForBuffering(() => {
21668
21691
  bufferManager.buffering.current = true;
21669
21692
  emitter.dispatchWaiting({});
@@ -21684,7 +21707,7 @@ var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
21684
21707
  if (!bufferManager) {
21685
21708
  throw new Error("BufferingContextReact not found");
21686
21709
  }
21687
- useEffect210(() => {
21710
+ useEffect36(() => {
21688
21711
  if (currentPlaybackRate) {
21689
21712
  emitter.dispatchRateChange(currentPlaybackRate);
21690
21713
  }
@@ -21697,7 +21720,7 @@ var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
21697
21720
  };
21698
21721
  var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
21699
21722
  const [hovered, setHovered] = useState210(false);
21700
- useEffect37(() => {
21723
+ useEffect210(() => {
21701
21724
  const { current } = ref;
21702
21725
  if (!current) {
21703
21726
  return;
@@ -21739,12 +21762,12 @@ var usePlayer = () => {
21739
21762
  const [playing, setPlaying, imperativePlaying] = Internals.Timeline.usePlayingState();
21740
21763
  const [hasPlayed, setHasPlayed] = useState36(false);
21741
21764
  const frame = Internals.Timeline.useTimelinePosition();
21742
- const playStart = useRef24(frame);
21765
+ const playStart = useRef34(frame);
21743
21766
  const setFrame = Internals.Timeline.useTimelineSetFrame();
21744
21767
  const setTimelinePosition = Internals.Timeline.useTimelineSetFrame();
21745
21768
  const audioContext = useContext37(Internals.SharedAudioContext);
21746
21769
  const { audioAndVideoTags } = useContext37(Internals.TimelineContext);
21747
- const frameRef = useRef24(frame);
21770
+ const frameRef = Internals.Timeline.useTimelineFrameRef();
21748
21771
  frameRef.current = frame;
21749
21772
  const video = Internals.useVideo();
21750
21773
  const config = Internals.useUnsafeVideoConfig();
@@ -21760,13 +21783,16 @@ var usePlayer = () => {
21760
21783
  throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
21761
21784
  }
21762
21785
  const { buffering } = bufferingContext;
21786
+ const setFrameAndImperative = useCallback28((newFrame, videoIdToSet) => {
21787
+ setTimelinePosition((c) => ({ ...c, [videoIdToSet]: newFrame }));
21788
+ frameRef.current = newFrame;
21789
+ }, [frameRef, setTimelinePosition]);
21763
21790
  const seek2 = useCallback28((newFrame) => {
21764
21791
  if (video?.id) {
21765
- setTimelinePosition((c) => ({ ...c, [video.id]: newFrame }));
21792
+ setFrameAndImperative(newFrame, video.id);
21766
21793
  }
21767
- frameRef.current = newFrame;
21768
21794
  emitter.dispatchSeek(newFrame);
21769
- }, [emitter, setTimelinePosition, video?.id]);
21795
+ }, [emitter, setFrameAndImperative, video?.id]);
21770
21796
  const play = useCallback28((e) => {
21771
21797
  if (imperativePlaying.current) {
21772
21798
  return;
@@ -21791,7 +21817,8 @@ var usePlayer = () => {
21791
21817
  setPlaying,
21792
21818
  emitter,
21793
21819
  seek2,
21794
- audioAndVideoTags
21820
+ audioAndVideoTags,
21821
+ frameRef
21795
21822
  ]);
21796
21823
  const pause = useCallback28(() => {
21797
21824
  if (imperativePlaying.current) {
@@ -21814,7 +21841,14 @@ var usePlayer = () => {
21814
21841
  emitter.dispatchPause();
21815
21842
  }
21816
21843
  }
21817
- }, [config, emitter, imperativePlaying, setPlaying, setTimelinePosition]);
21844
+ }, [
21845
+ config,
21846
+ emitter,
21847
+ imperativePlaying,
21848
+ setPlaying,
21849
+ setTimelinePosition,
21850
+ frameRef
21851
+ ]);
21818
21852
  const videoId = video?.id;
21819
21853
  const frameBack = useCallback28((frames) => {
21820
21854
  if (!videoId) {
@@ -21872,12 +21906,15 @@ var usePlayer = () => {
21872
21906
  pause,
21873
21907
  seek: seek2,
21874
21908
  isFirstFrame,
21875
- getCurrentFrame: () => frameRef.current,
21909
+ getCurrentFrame: () => {
21910
+ return frameRef.current;
21911
+ },
21876
21912
  isPlaying: () => imperativePlaying.current,
21877
21913
  isBuffering: () => buffering.current,
21878
21914
  pauseAndReturnToPlayStart,
21879
21915
  hasPlayed,
21880
- toggle
21916
+ toggle,
21917
+ setFrameAndImperative
21881
21918
  };
21882
21919
  }, [
21883
21920
  buffering,
@@ -21893,7 +21930,9 @@ var usePlayer = () => {
21893
21930
  play,
21894
21931
  playing,
21895
21932
  seek2,
21896
- toggle
21933
+ toggle,
21934
+ setFrameAndImperative,
21935
+ frameRef
21897
21936
  ]);
21898
21937
  return returnValue;
21899
21938
  };
@@ -21903,7 +21942,7 @@ var useBrowserMediaSession = ({
21903
21942
  playbackRate
21904
21943
  }) => {
21905
21944
  const { playing, pause, play, emitter, getCurrentFrame, seek: seek2 } = usePlayer();
21906
- useEffect42(() => {
21945
+ useEffect37(() => {
21907
21946
  if (!navigator.mediaSession) {
21908
21947
  return;
21909
21948
  }
@@ -21916,7 +21955,7 @@ var useBrowserMediaSession = ({
21916
21955
  navigator.mediaSession.playbackState = "paused";
21917
21956
  }
21918
21957
  }, [browserMediaControlsBehavior.mode, playing]);
21919
- useEffect42(() => {
21958
+ useEffect37(() => {
21920
21959
  if (!navigator.mediaSession) {
21921
21960
  return;
21922
21961
  }
@@ -21946,7 +21985,7 @@ var useBrowserMediaSession = ({
21946
21985
  playbackRate,
21947
21986
  videoConfig
21948
21987
  ]);
21949
- useEffect42(() => {
21988
+ useEffect37(() => {
21950
21989
  if (!navigator.mediaSession) {
21951
21990
  return;
21952
21991
  }
@@ -22039,8 +22078,8 @@ var getIsBackgrounded = () => {
22039
22078
  return document.visibilityState === "hidden";
22040
22079
  };
22041
22080
  var useIsBackgrounded = () => {
22042
- const isBackgrounded = useRef34(getIsBackgrounded());
22043
- useEffect52(() => {
22081
+ const isBackgrounded = useRef24(getIsBackgrounded());
22082
+ useEffect42(() => {
22044
22083
  const onVisibilityChange = () => {
22045
22084
  isBackgrounded.current = getIsBackgrounded();
22046
22085
  };
@@ -22062,10 +22101,9 @@ var usePlayback = ({
22062
22101
  }) => {
22063
22102
  const config = Internals.useUnsafeVideoConfig();
22064
22103
  const frame = Internals.Timeline.useTimelinePosition();
22065
- const { playing, pause, emitter } = usePlayer();
22066
- const setFrame = Internals.Timeline.useTimelineSetFrame();
22104
+ const { playing, pause, emitter, setFrameAndImperative } = usePlayer();
22067
22105
  const isBackgroundedRef = useIsBackgrounded();
22068
- const lastTimeUpdateEvent = useRef42(null);
22106
+ const lastTimeUpdateEvent = useRef33(null);
22069
22107
  const context = useContext42(Internals.BufferingContextReact);
22070
22108
  if (!context) {
22071
22109
  throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
@@ -22075,7 +22113,7 @@ var usePlayback = ({
22075
22113
  playbackRate,
22076
22114
  videoConfig: config
22077
22115
  });
22078
- useEffect62(() => {
22116
+ useEffect52(() => {
22079
22117
  if (!config) {
22080
22118
  return;
22081
22119
  }
@@ -22119,7 +22157,7 @@ var usePlayback = ({
22119
22157
  });
22120
22158
  framesAdvanced += framesToAdvance;
22121
22159
  if (nextFrame !== getCurrentFrame() && (!hasEnded || moveToBeginningWhenEnded)) {
22122
- setFrame((c) => ({ ...c, [config.id]: nextFrame }));
22160
+ setFrameAndImperative(nextFrame, config.id);
22123
22161
  }
22124
22162
  if (hasEnded) {
22125
22163
  stop();
@@ -22166,7 +22204,7 @@ var usePlayback = ({
22166
22204
  loop,
22167
22205
  pause,
22168
22206
  playing,
22169
- setFrame,
22207
+ setFrameAndImperative,
22170
22208
  emitter,
22171
22209
  playbackRate,
22172
22210
  inFrame,
@@ -22176,7 +22214,7 @@ var usePlayback = ({
22176
22214
  getCurrentFrame,
22177
22215
  context
22178
22216
  ]);
22179
- useEffect62(() => {
22217
+ useEffect52(() => {
22180
22218
  const interval = setInterval(() => {
22181
22219
  if (lastTimeUpdateEvent.current === getCurrentFrame()) {
22182
22220
  return;
@@ -22186,7 +22224,7 @@ var usePlayback = ({
22186
22224
  }, 250);
22187
22225
  return () => clearInterval(interval);
22188
22226
  }, [emitter, getCurrentFrame]);
22189
- useEffect62(() => {
22227
+ useEffect52(() => {
22190
22228
  emitter.dispatchFrameUpdate({ frame });
22191
22229
  }, [emitter, frame]);
22192
22230
  };
@@ -22269,7 +22307,7 @@ var useElementSize = (ref, options2) => {
22269
22307
  };
22270
22308
  });
22271
22309
  }, [ref]);
22272
- useEffect72(() => {
22310
+ useEffect62(() => {
22273
22311
  if (!observer) {
22274
22312
  return;
22275
22313
  }
@@ -22283,7 +22321,7 @@ var useElementSize = (ref, options2) => {
22283
22321
  }
22284
22322
  };
22285
22323
  }, [observer, ref, updateSize]);
22286
- useEffect72(() => {
22324
+ useEffect62(() => {
22287
22325
  if (!options2.triggerOnWindowResize) {
22288
22326
  return;
22289
22327
  }
@@ -22292,7 +22330,7 @@ var useElementSize = (ref, options2) => {
22292
22330
  window.removeEventListener("resize", updateSize);
22293
22331
  };
22294
22332
  }, [options2.triggerOnWindowResize, updateSize]);
22295
- useEffect72(() => {
22333
+ useEffect62(() => {
22296
22334
  elementSizeHooks.push(updateSize);
22297
22335
  return () => {
22298
22336
  elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
@@ -22424,8 +22462,8 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
22424
22462
  const [mediaMuted, setMediaMuted] = Internals.useMediaMutedState();
22425
22463
  const [mediaVolume, setMediaVolume] = Internals.useMediaVolumeState();
22426
22464
  const [focused, setFocused] = useState62(false);
22427
- const parentDivRef = useRef52(null);
22428
- const inputRef = useRef52(null);
22465
+ const parentDivRef = useRef42(null);
22466
+ const inputRef = useRef42(null);
22429
22467
  const hover = useHoverState(parentDivRef, false);
22430
22468
  const onBlur = useCallback52(() => {
22431
22469
  setTimeout(() => {
@@ -22510,8 +22548,8 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
22510
22548
  };
22511
22549
  function useComponentVisible(initialIsVisible) {
22512
22550
  const [isComponentVisible, setIsComponentVisible] = useState72(initialIsVisible);
22513
- const ref = useRef62(null);
22514
- useEffect83(() => {
22551
+ const ref = useRef52(null);
22552
+ useEffect72(() => {
22515
22553
  const handleClickOutside = (event) => {
22516
22554
  if (ref.current && !ref.current.contains(event.target)) {
22517
22555
  setIsComponentVisible(false);
@@ -22595,7 +22633,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
22595
22633
  var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
22596
22634
  const { setPlaybackRate, playbackRate } = useContext52(Internals.TimelineContext);
22597
22635
  const [keyboardSelectedRate, setKeyboardSelectedRate] = useState82(playbackRate);
22598
- useEffect92(() => {
22636
+ useEffect83(() => {
22599
22637
  const listener = (e) => {
22600
22638
  e.preventDefault();
22601
22639
  if (e.key === "ArrowUp") {
@@ -22760,7 +22798,7 @@ var findBodyInWhichDivIsLocated = (div) => {
22760
22798
  return current;
22761
22799
  };
22762
22800
  var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
22763
- const containerRef = useRef72(null);
22801
+ const containerRef = useRef62(null);
22764
22802
  const barHovered = useHoverState(containerRef, false);
22765
22803
  const size4 = useElementSize(containerRef, {
22766
22804
  triggerOnWindowResize: true,
@@ -22811,7 +22849,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
22811
22849
  }
22812
22850
  onSeekEnd();
22813
22851
  }, [dragging, onSeekEnd, pause, play]);
22814
- useEffect102(() => {
22852
+ useEffect92(() => {
22815
22853
  if (!dragging.dragging) {
22816
22854
  return;
22817
22855
  }
@@ -23036,7 +23074,7 @@ var Controls = ({
23036
23074
  playing,
23037
23075
  toggle
23038
23076
  }) => {
23039
- const playButtonRef = useRef82(null);
23077
+ const playButtonRef = useRef72(null);
23040
23078
  const [supportsFullscreen, setSupportsFullscreen] = useState102(false);
23041
23079
  const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
23042
23080
  const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
@@ -23071,17 +23109,17 @@ var Controls = ({
23071
23109
  opacity: Number(shouldShow)
23072
23110
  };
23073
23111
  }, [hovered, shouldShowInitially, playing, alwaysShowControls]);
23074
- useEffect112(() => {
23112
+ useEffect102(() => {
23075
23113
  if (playButtonRef.current && spaceKeyToPlayOrPause) {
23076
23114
  playButtonRef.current.focus({
23077
23115
  preventScroll: true
23078
23116
  });
23079
23117
  }
23080
23118
  }, [playing, spaceKeyToPlayOrPause]);
23081
- useEffect112(() => {
23119
+ useEffect102(() => {
23082
23120
  setSupportsFullscreen((typeof document !== "undefined" && (document.fullscreenEnabled || document.webkitFullscreenEnabled)) ?? false);
23083
23121
  }, []);
23084
- useEffect112(() => {
23122
+ useEffect102(() => {
23085
23123
  if (shouldShowInitially === false) {
23086
23124
  return;
23087
23125
  }
@@ -23110,8 +23148,8 @@ var Controls = ({
23110
23148
  }
23111
23149
  return null;
23112
23150
  }, [showPlaybackRateControl]);
23113
- const ref = useRef82(null);
23114
- const flexRef = useRef82(null);
23151
+ const ref = useRef72(null);
23152
+ const flexRef = useRef72(null);
23115
23153
  const onPointerDownIfContainer = useCallback82((e) => {
23116
23154
  if (e.target === ref.current || e.target === flexRef.current) {
23117
23155
  onPointerDown?.(e);
@@ -23279,7 +23317,7 @@ var DOMAIN_BLACKLIST = [
23279
23317
  var ran = false;
23280
23318
  var RenderWarningIfBlacklist = () => {
23281
23319
  const [unlicensed, setUnlicensed] = React92.useState(false);
23282
- useEffect122(() => {
23320
+ useEffect112(() => {
23283
23321
  if (ran) {
23284
23322
  return;
23285
23323
  }
@@ -23290,7 +23328,7 @@ var RenderWarningIfBlacklist = () => {
23290
23328
  }
23291
23329
  }).catch(() => {});
23292
23330
  }, []);
23293
- useEffect122(() => {
23331
+ useEffect112(() => {
23294
23332
  if (!unlicensed) {
23295
23333
  return;
23296
23334
  }
@@ -23356,7 +23394,7 @@ var cancellablePromise = (promise) => {
23356
23394
  };
23357
23395
  var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
23358
23396
  var useCancellablePromises = () => {
23359
- const pendingPromises = useRef92([]);
23397
+ const pendingPromises = useRef82([]);
23360
23398
  const appendPendingPromise = useCallback92((promise) => {
23361
23399
  pendingPromises.current = [...pendingPromises.current, promise];
23362
23400
  }, []);
@@ -23460,7 +23498,7 @@ var PlayerUI = ({
23460
23498
  }, ref) => {
23461
23499
  const config = Internals.useUnsafeVideoConfig();
23462
23500
  const video = Internals.useVideo();
23463
- const container4 = useRef102(null);
23501
+ const container4 = useRef92(null);
23464
23502
  const canvasSize = useElementSize(container4, {
23465
23503
  triggerOnWindowResize: false,
23466
23504
  shouldApplyCssTransforms: false
@@ -23486,13 +23524,13 @@ var PlayerUI = ({
23486
23524
  getCurrentFrame: player.getCurrentFrame,
23487
23525
  browserMediaControlsBehavior
23488
23526
  });
23489
- useEffect132(() => {
23527
+ useEffect122(() => {
23490
23528
  if (hasPausedToResume && !player.playing) {
23491
23529
  setHasPausedToResume(false);
23492
23530
  player.play();
23493
23531
  }
23494
23532
  }, [hasPausedToResume, player]);
23495
- useEffect132(() => {
23533
+ useEffect122(() => {
23496
23534
  const { current } = container4;
23497
23535
  if (!current) {
23498
23536
  return;
@@ -23534,7 +23572,7 @@ var PlayerUI = ({
23534
23572
  document.exitFullscreen();
23535
23573
  }
23536
23574
  }, []);
23537
- useEffect132(() => {
23575
+ useEffect122(() => {
23538
23576
  const { current } = container4;
23539
23577
  if (!current) {
23540
23578
  return;
@@ -23571,8 +23609,8 @@ var PlayerUI = ({
23571
23609
  });
23572
23610
  }, [canvasSize, config]);
23573
23611
  const scale = layout?.scale ?? 1;
23574
- const initialScaleIgnored = useRef102(false);
23575
- useEffect132(() => {
23612
+ const initialScaleIgnored = useRef92(false);
23613
+ useEffect122(() => {
23576
23614
  if (!initialScaleIgnored.current) {
23577
23615
  initialScaleIgnored.current = true;
23578
23616
  return;
@@ -23581,17 +23619,17 @@ var PlayerUI = ({
23581
23619
  }, [player.emitter, scale]);
23582
23620
  const { setMediaVolume, setMediaMuted } = useContext62(Internals.SetMediaVolumeContext);
23583
23621
  const { mediaMuted, mediaVolume } = useContext62(Internals.MediaVolumeContext);
23584
- useEffect132(() => {
23622
+ useEffect122(() => {
23585
23623
  player.emitter.dispatchVolumeChange(mediaVolume);
23586
23624
  }, [player.emitter, mediaVolume]);
23587
23625
  const isMuted = mediaMuted || mediaVolume === 0;
23588
- useEffect132(() => {
23626
+ useEffect122(() => {
23589
23627
  player.emitter.dispatchMuteChange({
23590
23628
  isMuted
23591
23629
  });
23592
23630
  }, [player.emitter, isMuted]);
23593
23631
  const [showBufferIndicator, setShowBufferState] = useState113(false);
23594
- useEffect132(() => {
23632
+ useEffect122(() => {
23595
23633
  let timeout = null;
23596
23634
  let stopped = false;
23597
23635
  const onBuffer = () => {
@@ -23763,7 +23801,7 @@ var PlayerUI = ({
23763
23801
  }
23764
23802
  }, [exitFullscreen, isFullscreen, requestFullscreen]);
23765
23803
  const { handlePointerDown, handleDoubleClick } = useClickPreventionOnDoubleClick(onSingleClick, onDoubleClick, doubleClickToFullscreen && allowFullscreen && supportsFullScreen);
23766
- useEffect132(() => {
23804
+ useEffect122(() => {
23767
23805
  if (shouldAutoplay) {
23768
23806
  player.play();
23769
23807
  setShouldAutoPlay(false);
@@ -24219,9 +24257,9 @@ var PlayerFn = ({
24219
24257
  }));
24220
24258
  const [playing, setPlaying] = useState132(false);
24221
24259
  const [rootId] = useState132("player-comp");
24222
- const rootRef = useRef112(null);
24223
- const audioAndVideoTags = useRef112([]);
24224
- const imperativePlaying = useRef112(false);
24260
+ const rootRef = useRef102(null);
24261
+ const audioAndVideoTags = useRef102([]);
24262
+ const imperativePlaying = useRef102(false);
24225
24263
  const [currentPlaybackRate, setCurrentPlaybackRate] = useState132(playbackRate);
24226
24264
  if (typeof compositionHeight !== "number") {
24227
24265
  throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
@@ -24270,7 +24308,7 @@ var PlayerFn = ({
24270
24308
  throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${numberOfSharedAudioTags}' instead`);
24271
24309
  }
24272
24310
  validatePlaybackRate(currentPlaybackRate);
24273
- useEffect142(() => {
24311
+ useEffect132(() => {
24274
24312
  setCurrentPlaybackRate(playbackRate);
24275
24313
  }, [playbackRate]);
24276
24314
  useImperativeHandle22(ref, () => rootRef.current, []);
@@ -24285,6 +24323,7 @@ var PlayerFn = ({
24285
24323
  const timelineContextValue = useMemo142(() => {
24286
24324
  return {
24287
24325
  frame,
24326
+ frameRef: { current: frame[PLAYER_COMP_ID] },
24288
24327
  playing,
24289
24328
  rootId,
24290
24329
  playbackRate: currentPlaybackRate,
@@ -24302,7 +24341,7 @@ var PlayerFn = ({
24302
24341
  };
24303
24342
  }, [setFrame]);
24304
24343
  if (typeof window !== "undefined") {
24305
- useLayoutEffect15(() => {
24344
+ useLayoutEffect23(() => {
24306
24345
  Internals.CSSUtils.injectCSS(Internals.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
24307
24346
  }, [overrideInternalClassName]);
24308
24347
  }
@@ -24406,7 +24445,7 @@ var ThumbnailUI = ({
24406
24445
  }, ref) => {
24407
24446
  const config = Internals.useUnsafeVideoConfig();
24408
24447
  const video = Internals.useVideo();
24409
- const container4 = useRef122(null);
24448
+ const container4 = useRef112(null);
24410
24449
  const canvasSize = useElementSize(container4, {
24411
24450
  triggerOnWindowResize: false,
24412
24451
  shouldApplyCssTransforms: false
@@ -24527,14 +24566,15 @@ var ThumbnailFn = ({
24527
24566
  ...componentProps
24528
24567
  }, ref) => {
24529
24568
  if (typeof window !== "undefined") {
24530
- useLayoutEffect23(() => {
24569
+ useLayoutEffect33(() => {
24531
24570
  window.remotion_isPlayer = true;
24532
24571
  }, []);
24533
24572
  }
24534
24573
  const [thumbnailId] = useState142(() => String(random(null)));
24535
- const rootRef = useRef132(null);
24574
+ const rootRef = useRef122(null);
24536
24575
  const timelineState = useMemo172(() => {
24537
24576
  const value = {
24577
+ frameRef: { current: frameToDisplay },
24538
24578
  playing: false,
24539
24579
  frame: {
24540
24580
  [PLAYER_COMP_ID]: frameToDisplay
@@ -25389,7 +25429,7 @@ import {
25389
25429
 
25390
25430
  // src/components/homepage/Demo/Card.tsx
25391
25431
  init_esm();
25392
- import { useCallback as useCallback31, useRef as useRef35 } from "react";
25432
+ import { useCallback as useCallback31, useRef as useRef36 } from "react";
25393
25433
 
25394
25434
  // src/components/homepage/Demo/math.ts
25395
25435
  var paddingAndMargin = 20;
@@ -25487,7 +25527,7 @@ var Card2 = ({
25487
25527
  onClickRight
25488
25528
  }) => {
25489
25529
  const refToUse = refsToUse[index2];
25490
- const stopPrevious = useRef35([]);
25530
+ const stopPrevious = useRef36([]);
25491
25531
  let newIndices = [...indices];
25492
25532
  const applyPositions = useCallback31((except) => {
25493
25533
  let stopped = false;