@remotion/player 4.0.519 → 4.0.520

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.
@@ -353,8 +353,7 @@ var PlayerEventEmitterContext = React.createContext(undefined);
353
353
  var ThumbnailEmitterContext = React.createContext(undefined);
354
354
 
355
355
  // src/EmitterProvider.tsx
356
- import { useContext as useContext2, useEffect, useState } from "react";
357
- import { Internals as Internals4 } from "remotion";
356
+ import { useEffect, useState } from "react";
358
357
 
359
358
  // src/event-emitter.ts
360
359
  class PlayerEmitter {
@@ -469,101 +468,41 @@ class ThumbnailEmitter {
469
468
  };
470
469
  }
471
470
 
472
- // src/timeline-imperative-context.tsx
473
- import React2, { useMemo, useRef } from "react";
474
- import { Internals as Internals2 } from "remotion";
475
- import { jsx as jsx3 } from "react/jsx-runtime";
476
- var PlayerTimelineImperativeContext = React2.createContext(null);
477
- var getCoreTimelineImperativeContext = () => {
478
- return Internals2.TimelineImperativeContext;
479
- };
480
- var getTimelineImperativeContext = () => {
481
- return getCoreTimelineImperativeContext() ?? PlayerTimelineImperativeContext;
482
- };
483
- var CoreTimelineImperativeContextProvider = ({ children, value }) => {
484
- const TimelineImperativeContext = getCoreTimelineImperativeContext();
485
- if (!TimelineImperativeContext) {
486
- return children;
487
- }
488
- return /* @__PURE__ */ jsx3(TimelineImperativeContext.Provider, {
489
- value,
490
- children
491
- });
492
- };
493
- var LegacyTimelineImperativeContextProvider = ({ children }) => {
494
- const timelineContext = Internals2.Timeline.useTimelineContext();
495
- const frameRef = useRef(timelineContext.frame);
496
- frameRef.current = timelineContext.frame;
497
- const value = useMemo(() => {
498
- return {
499
- frameRef,
500
- imperativePlaying: timelineContext.imperativePlaying,
501
- audioAndVideoTags: timelineContext.audioAndVideoTags
502
- };
503
- }, [timelineContext.audioAndVideoTags, timelineContext.imperativePlaying]);
504
- return /* @__PURE__ */ jsx3(PlayerTimelineImperativeContext.Provider, {
505
- value,
506
- children
507
- });
508
- };
509
- var TimelineImperativeCompatibilityProvider = ({ children }) => {
510
- if (getCoreTimelineImperativeContext()) {
511
- return children;
512
- }
513
- return /* @__PURE__ */ jsx3(LegacyTimelineImperativeContextProvider, {
514
- children
515
- });
516
- };
517
-
518
471
  // src/use-buffer-state-emitter.ts
519
472
  import { useContext, useLayoutEffect } from "react";
520
- import { Internals as Internals3 } from "remotion";
473
+ import { Internals as Internals2 } from "remotion";
521
474
  var useBufferStateEmitter = (emitter) => {
522
- const bufferManager = useContext(Internals3.BufferingContextReact);
523
- if (!bufferManager) {
524
- throw new Error("BufferingContextReact not found");
525
- }
475
+ const { subscribeBuffering } = useContext(Internals2.SetTimelineContext);
526
476
  useLayoutEffect(() => {
527
- const clear1 = bufferManager.listenForBuffering(() => {
528
- bufferManager.buffering.current = true;
529
- emitter.dispatchWaiting({});
530
- });
531
- const clear2 = bufferManager.listenForResume(() => {
532
- bufferManager.buffering.current = false;
533
- emitter.dispatchResume({});
477
+ return subscribeBuffering((state) => {
478
+ if (state.buffering) {
479
+ emitter.dispatchWaiting({});
480
+ } else {
481
+ emitter.dispatchResume({});
482
+ }
534
483
  });
535
- return () => {
536
- clear1.remove();
537
- clear2.remove();
538
- };
539
- }, [bufferManager, emitter]);
484
+ }, [emitter, subscribeBuffering]);
540
485
  };
541
486
 
542
487
  // src/EmitterProvider.tsx
543
- import { jsx as jsx4 } from "react/jsx-runtime";
488
+ import { jsx as jsx3 } from "react/jsx-runtime";
544
489
  var PlayerEmitterProvider = ({ children, currentPlaybackRate }) => {
545
490
  const [emitter] = useState(() => new PlayerEmitter);
546
- const bufferManager = useContext2(Internals4.BufferingContextReact);
547
- if (!bufferManager) {
548
- throw new Error("BufferingContextReact not found");
549
- }
550
491
  useEffect(() => {
551
492
  if (currentPlaybackRate) {
552
493
  emitter.dispatchRateChange(currentPlaybackRate);
553
494
  }
554
495
  }, [emitter, currentPlaybackRate]);
555
496
  useBufferStateEmitter(emitter);
556
- return /* @__PURE__ */ jsx4(TimelineImperativeCompatibilityProvider, {
557
- children: /* @__PURE__ */ jsx4(PlayerEventEmitterContext.Provider, {
558
- value: emitter,
559
- children
560
- })
497
+ return /* @__PURE__ */ jsx3(PlayerEventEmitterContext.Provider, {
498
+ value: emitter,
499
+ children
561
500
  });
562
501
  };
563
502
 
564
503
  // src/timeline-sequence-observer-context.ts
565
- import React4 from "react";
566
- var TimelineSequenceObserverContext = React4.createContext(null);
504
+ import React3 from "react";
505
+ var TimelineSequenceObserverContext = React3.createContext(null);
567
506
 
568
507
  // src/use-hover-state.ts
569
508
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -610,68 +549,60 @@ var useHoverState = (ref, hideControlsWhenPointerDoesntMove) => {
610
549
 
611
550
  // src/use-playback.ts
612
551
  import { useLayoutEffect as useLayoutEffect2 } from "react";
613
- import { useContext as useContext4, useEffect as useEffect5, useRef as useRef5 } from "react";
614
- import { Internals as Internals8 } from "remotion";
552
+ import { useContext as useContext3, useEffect as useEffect5, useRef as useRef4 } from "react";
553
+ import { Internals as Internals6 } from "remotion";
615
554
 
616
555
  // src/browser-mediasession.ts
617
- import { useEffect as useEffect3, useRef as useRef3 } from "react";
618
- import { Internals as Internals6 } from "remotion";
556
+ import { useEffect as useEffect3, useRef as useRef2 } from "react";
557
+ import { Internals as Internals4 } from "remotion";
619
558
 
620
559
  // src/use-player-methods.ts
621
- import { useCallback, useContext as useContext3, useMemo as useMemo2, useRef as useRef2 } from "react";
622
- import { Internals as Internals5, useRemotionEnvironment } from "remotion";
560
+ import { useCallback, useContext as useContext2, useMemo, useRef } from "react";
561
+ import { Internals as Internals3, useRemotionEnvironment } from "remotion";
623
562
  var usePlayerMethods = () => {
624
- const setFrame = Internals5.Timeline.useTimelineSetFrame();
625
- const setTimelinePosition = Internals5.Timeline.useTimelineSetFrame();
626
- const { setPlaying } = useContext3(Internals5.SetTimelineContext);
627
- const timelineImperativeContext = useContext3(getTimelineImperativeContext());
628
- const audioContext = useContext3(Internals5.SharedAudioContext);
629
- const audioTagsContext = useContext3(Internals5.SharedAudioTagsContext);
563
+ const setFrame = Internals3.Timeline.useTimelineSetFrame();
564
+ const setTimelinePosition = Internals3.Timeline.useTimelineSetFrame();
565
+ const {
566
+ setPlaying,
567
+ frameRef,
568
+ audioAndVideoTags,
569
+ isPlaying: readIsPlaying,
570
+ isBuffering
571
+ } = useContext2(Internals3.SetTimelineContext);
572
+ const audioContext = useContext2(Internals3.SharedAudioContext);
573
+ const audioTagsContext = useContext2(Internals3.SharedAudioTagsContext);
630
574
  const environment = useRemotionEnvironment();
631
- const video = Internals5.useVideo();
632
- const config = Internals5.useUnsafeVideoConfig();
633
- const emitter = useContext3(PlayerEventEmitterContext);
634
- const playStart = useRef2(0);
635
- const fallbackFrame = useRef2(null);
636
- if (!timelineImperativeContext) {
637
- throw new Error("Timeline imperative context is not available. This hook must be used inside a <Player> or the Remotion Studio.");
638
- }
575
+ const video = Internals3.useVideo();
576
+ const config = Internals3.useUnsafeVideoConfig();
577
+ const emitter = useContext2(PlayerEventEmitterContext);
578
+ const playStart = useRef(0);
579
+ const fallbackFrame = useRef(null);
639
580
  if (!emitter) {
640
581
  throw new TypeError("Expected Player event emitter context");
641
582
  }
642
- const bufferingContext = useContext3(Internals5.BufferingContextReact);
643
- if (!bufferingContext) {
644
- throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
645
- }
646
583
  const getCurrentFrame = useCallback(() => {
647
584
  if (!video) {
648
585
  return fallbackFrame.current ?? (typeof window === "undefined" ? 0 : window.remotion_initialFrame ?? 0);
649
586
  }
650
- const unclamped = timelineImperativeContext.frameRef.current[video.id] ?? (environment.isPlayer ? 0 : Internals5.Timeline.getFrameForComposition(video.id));
651
- return Internals5.Timeline.clampFrameToCompositionRange(unclamped, video.durationInFrames);
652
- }, [environment.isPlayer, timelineImperativeContext, video]);
587
+ const unclamped = frameRef.current[video.id] ?? (environment.isPlayer ? 0 : Internals3.Timeline.getFrameForComposition(video.id));
588
+ return Internals3.Timeline.clampFrameToCompositionRange(unclamped, video.durationInFrames);
589
+ }, [environment.isPlayer, frameRef, video]);
653
590
  const seek = useCallback((newFrame) => {
654
- const frameToSeekTo = config ? Internals5.TimelinePosition.clampFrameToCompositionRange(newFrame, config.durationInFrames) : Math.max(0, newFrame);
591
+ const frameToSeekTo = config ? Internals3.TimelinePosition.clampFrameToCompositionRange(newFrame, config.durationInFrames) : Math.max(0, newFrame);
655
592
  fallbackFrame.current = frameToSeekTo;
656
593
  if (video?.id) {
657
- if (timelineImperativeContext.frameRef.current[video.id] !== frameToSeekTo) {
658
- timelineImperativeContext.frameRef.current = {
659
- ...timelineImperativeContext.frameRef.current,
594
+ if (frameRef.current[video.id] !== frameToSeekTo) {
595
+ frameRef.current = {
596
+ ...frameRef.current,
660
597
  [video.id]: frameToSeekTo
661
598
  };
662
599
  }
663
600
  setTimelinePosition((currentFrames) => currentFrames[video.id] === frameToSeekTo ? currentFrames : { ...currentFrames, [video.id]: frameToSeekTo });
664
601
  }
665
602
  emitter.dispatchSeek(frameToSeekTo);
666
- }, [
667
- config,
668
- emitter,
669
- setTimelinePosition,
670
- timelineImperativeContext,
671
- video?.id
672
- ]);
603
+ }, [config, emitter, frameRef, setTimelinePosition, video?.id]);
673
604
  const play = useCallback((e) => {
674
- if (timelineImperativeContext.imperativePlaying.current) {
605
+ if (readIsPlaying()) {
675
606
  return;
676
607
  }
677
608
  const lastFrameForPlayback = (config?.durationInFrames ?? 1) - 1;
@@ -682,52 +613,51 @@ var usePlayerMethods = () => {
682
613
  if (audioTagsContext && audioTagsContext.numberOfAudioTags > 0 && e) {
683
614
  audioTagsContext.playAllAudios();
684
615
  }
685
- timelineImperativeContext.audioAndVideoTags.current.forEach((tag) => tag.play("player play() was called and playing audio from a click"));
686
- timelineImperativeContext.imperativePlaying.current = true;
616
+ audioAndVideoTags.current.forEach((tag) => tag.play("player play() was called and playing audio from a click"));
687
617
  setPlaying(true);
688
618
  playStart.current = getCurrentFrame();
689
619
  emitter.dispatchPlay();
690
620
  }, [
621
+ audioAndVideoTags,
691
622
  audioContext,
692
623
  audioTagsContext,
693
624
  config?.durationInFrames,
694
625
  emitter,
695
626
  getCurrentFrame,
627
+ readIsPlaying,
696
628
  seek,
697
- setPlaying,
698
- timelineImperativeContext
629
+ setPlaying
699
630
  ]);
700
631
  const pause = useCallback(() => {
701
- if (timelineImperativeContext.imperativePlaying.current) {
702
- timelineImperativeContext.imperativePlaying.current = false;
632
+ if (readIsPlaying()) {
703
633
  setPlaying(false);
704
634
  emitter.dispatchPause();
705
635
  audioContext?.suspend();
706
636
  }
707
- }, [audioContext, emitter, setPlaying, timelineImperativeContext]);
637
+ }, [audioContext, emitter, readIsPlaying, setPlaying]);
708
638
  const pauseAndReturnToPlayStart = useCallback(() => {
709
- if (timelineImperativeContext.imperativePlaying.current) {
710
- timelineImperativeContext.imperativePlaying.current = false;
639
+ if (readIsPlaying()) {
640
+ setPlaying(false);
711
641
  fallbackFrame.current = playStart.current;
712
642
  if (config) {
713
- timelineImperativeContext.frameRef.current = {
714
- ...timelineImperativeContext.frameRef.current,
643
+ frameRef.current = {
644
+ ...frameRef.current,
715
645
  [config.id]: playStart.current
716
646
  };
717
647
  setTimelinePosition((currentFrames) => ({
718
648
  ...currentFrames,
719
649
  [config.id]: playStart.current
720
650
  }));
721
- setPlaying(false);
722
651
  emitter.dispatchPause();
723
652
  }
724
653
  }
725
654
  }, [
726
655
  config,
727
656
  emitter,
657
+ frameRef,
658
+ readIsPlaying,
728
659
  setPlaying,
729
- setTimelinePosition,
730
- timelineImperativeContext
660
+ setTimelinePosition
731
661
  ]);
732
662
  const videoId = video?.id;
733
663
  const lastFrame = (config?.durationInFrames ?? 1) - 1;
@@ -735,52 +665,46 @@ var usePlayerMethods = () => {
735
665
  if (!videoId) {
736
666
  return null;
737
667
  }
738
- if (timelineImperativeContext.imperativePlaying.current) {
668
+ if (readIsPlaying()) {
739
669
  return;
740
670
  }
741
- const previousFrame = timelineImperativeContext.frameRef.current[videoId] ?? window.remotion_initialFrame ?? 0;
671
+ const previousFrame = frameRef.current[videoId] ?? window.remotion_initialFrame ?? 0;
742
672
  const newFrame = Math.max(0, previousFrame - frames);
743
673
  if (previousFrame === newFrame) {
744
674
  return;
745
675
  }
746
- timelineImperativeContext.frameRef.current = {
747
- ...timelineImperativeContext.frameRef.current,
676
+ frameRef.current = {
677
+ ...frameRef.current,
748
678
  [videoId]: newFrame
749
679
  };
750
680
  setFrame((currentFrames) => currentFrames[videoId] === newFrame ? currentFrames : { ...currentFrames, [videoId]: newFrame });
751
- }, [setFrame, timelineImperativeContext, videoId]);
681
+ }, [frameRef, readIsPlaying, setFrame, videoId]);
752
682
  const frameForward = useCallback((frames) => {
753
683
  if (!videoId) {
754
684
  return null;
755
685
  }
756
- if (timelineImperativeContext.imperativePlaying.current) {
686
+ if (readIsPlaying()) {
757
687
  return;
758
688
  }
759
- const previousFrame = timelineImperativeContext.frameRef.current[videoId] ?? window.remotion_initialFrame ?? 0;
689
+ const previousFrame = frameRef.current[videoId] ?? window.remotion_initialFrame ?? 0;
760
690
  const newFrame = Math.min(lastFrame, previousFrame + frames);
761
691
  if (previousFrame === newFrame) {
762
692
  return;
763
693
  }
764
- timelineImperativeContext.frameRef.current = {
765
- ...timelineImperativeContext.frameRef.current,
694
+ frameRef.current = {
695
+ ...frameRef.current,
766
696
  [videoId]: newFrame
767
697
  };
768
698
  setFrame((currentFrames) => currentFrames[videoId] === newFrame ? currentFrames : { ...currentFrames, [videoId]: newFrame });
769
- }, [lastFrame, setFrame, timelineImperativeContext, videoId]);
699
+ }, [frameRef, lastFrame, readIsPlaying, setFrame, videoId]);
770
700
  const toggle = useCallback((e) => {
771
- if (timelineImperativeContext.imperativePlaying.current) {
701
+ if (readIsPlaying()) {
772
702
  pause();
773
703
  } else {
774
704
  play(e);
775
705
  }
776
- }, [pause, play, timelineImperativeContext]);
777
- const isPlaying = useCallback(() => {
778
- return timelineImperativeContext.imperativePlaying.current;
779
- }, [timelineImperativeContext]);
780
- const isBuffering = useCallback(() => {
781
- return bufferingContext.buffering.current;
782
- }, [bufferingContext.buffering]);
783
- return useMemo2(() => {
706
+ }, [pause, play, readIsPlaying]);
707
+ return useMemo(() => {
784
708
  return {
785
709
  frameBack,
786
710
  frameForward,
@@ -789,7 +713,7 @@ var usePlayerMethods = () => {
789
713
  pause,
790
714
  seek,
791
715
  getCurrentFrame,
792
- isPlaying,
716
+ isPlaying: readIsPlaying,
793
717
  isBuffering,
794
718
  pauseAndReturnToPlayStart,
795
719
  toggle
@@ -799,11 +723,11 @@ var usePlayerMethods = () => {
799
723
  frameBack,
800
724
  frameForward,
801
725
  getCurrentFrame,
802
- isBuffering,
803
- isPlaying,
726
+ readIsPlaying,
804
727
  pause,
805
728
  pauseAndReturnToPlayStart,
806
729
  play,
730
+ isBuffering,
807
731
  seek,
808
732
  toggle
809
733
  ]);
@@ -815,15 +739,13 @@ var useBrowserMediaSession = ({
815
739
  videoConfig,
816
740
  playbackRate
817
741
  }) => {
818
- const [playing] = Internals6.Timeline.usePlayingState();
742
+ const playing = Internals4.usePlaying();
819
743
  const { pause, play, emitter, getCurrentFrame, seek } = usePlayerMethods();
820
- const hasEverPlayed = useRef3(false);
744
+ const hasEverPlayed = useRef2(false);
821
745
  useEffect3(() => {
822
746
  if (playing) {
823
747
  hasEverPlayed.current = true;
824
748
  }
825
- }, [playing]);
826
- useEffect3(() => {
827
749
  if (!navigator.mediaSession) {
828
750
  return;
829
751
  }
@@ -956,7 +878,7 @@ var calculateNextFrame = ({
956
878
  };
957
879
 
958
880
  // src/is-backgrounded.ts
959
- import { useEffect as useEffect4, useRef as useRef4 } from "react";
881
+ import { useEffect as useEffect4, useRef as useRef3 } from "react";
960
882
  var getIsBackgrounded = () => {
961
883
  if (typeof document === "undefined") {
962
884
  return false;
@@ -964,7 +886,7 @@ var getIsBackgrounded = () => {
964
886
  return document.visibilityState === "hidden";
965
887
  };
966
888
  var useIsBackgrounded = () => {
967
- const isBackgrounded = useRef4(getIsBackgrounded());
889
+ const isBackgrounded = useRef3(getIsBackgrounded());
968
890
  useEffect4(() => {
969
891
  const onVisibilityChange = () => {
970
892
  isBackgrounded.current = getIsBackgrounded();
@@ -978,7 +900,7 @@ var useIsBackgrounded = () => {
978
900
  };
979
901
 
980
902
  // src/set-global-time-anchor.ts
981
- import { Internals as Internals7 } from "remotion";
903
+ import { Internals as Internals5 } from "remotion";
982
904
  var ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT = 0.1;
983
905
  var setGlobalTimeAnchor = ({
984
906
  audioContext,
@@ -999,7 +921,7 @@ var setGlobalTimeAnchor = ({
999
921
  if (Math.abs(shift) < Number.EPSILON) {
1000
922
  return false;
1001
923
  }
1002
- Internals7.Log.verbose({ logLevel, tag: "audio-scheduling" }, "Anchor " + (force ? "forcibly " : "") + "changed from %s to %s with shift %s", audioSyncAnchor.value, newAnchor, shift);
924
+ Internals5.Log.verbose({ logLevel, tag: "audio-scheduling" }, "Anchor " + (force ? "forcibly " : "") + "changed from %s to %s with shift %s", audioSyncAnchor.value, newAnchor, shift);
1003
925
  audioSyncAnchor.value = newAnchor;
1004
926
  return true;
1005
927
  };
@@ -1024,20 +946,17 @@ var usePlayback = ({
1024
946
  getCurrentFrame,
1025
947
  muted
1026
948
  }) => {
1027
- const config = Internals8.useUnsafeVideoConfig();
1028
- const frame = Internals8.Timeline.useTimelinePosition();
1029
- const [playing] = Internals8.Timeline.usePlayingState();
949
+ const config = Internals6.useUnsafeVideoConfig();
950
+ const frame = Internals6.Timeline.useTimelinePosition();
951
+ const playing = Internals6.usePlaying();
1030
952
  const { pause, emitter, isPlaying } = usePlayerMethods();
1031
- const setFrame = Internals8.Timeline.useTimelineSetFrame();
1032
- const sharedAudioContext = useContext4(Internals8.SharedAudioContext);
1033
- const { setPlayerMuted } = useContext4(Internals8.SetMediaVolumeContext);
1034
- const logLevel = Internals8.useLogLevel();
953
+ const setFrame = Internals6.Timeline.useTimelineSetFrame();
954
+ const sharedAudioContext = useContext3(Internals6.SharedAudioContext);
955
+ const { setPlayerMuted } = useContext3(Internals6.SetMediaVolumeContext);
956
+ const { isBuffering, subscribeBuffering } = useContext3(Internals6.SetTimelineContext);
957
+ const logLevel = Internals6.useLogLevel();
1035
958
  const isBackgroundedRef = useIsBackgrounded();
1036
- const lastTimeUpdateTimestamp = useRef5(0);
1037
- const context = useContext4(Internals8.BufferingContextReact);
1038
- if (!context) {
1039
- throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");
1040
- }
959
+ const lastTimeUpdateTimestamp = useRef4(0);
1041
960
  useBrowserMediaSession({
1042
961
  browserMediaControlsBehavior,
1043
962
  playbackRate,
@@ -1151,7 +1070,7 @@ var usePlayback = ({
1151
1070
  sharedAudioContext?.suspend?.();
1152
1071
  return;
1153
1072
  }
1154
- if (!muted && !audioContextFailed && !context.buffering.current) {
1073
+ if (!muted && !audioContextFailed && !isBuffering()) {
1155
1074
  sharedAudioContext?.resume?.();
1156
1075
  }
1157
1076
  const time = performance.now() - startedTime;
@@ -1169,7 +1088,7 @@ var usePlayback = ({
1169
1088
  shouldLoop: loop
1170
1089
  });
1171
1090
  framesAdvanced += framesToAdvance;
1172
- if (nextFrame !== getCurrentFrame() && (!hasEnded || moveToBeginningWhenEnded) && !context.buffering.current) {
1091
+ if (nextFrame !== getCurrentFrame() && (!hasEnded || moveToBeginningWhenEnded) && !isBuffering()) {
1173
1092
  setFrame((c) => ({ ...c, [config.id]: nextFrame }));
1174
1093
  }
1175
1094
  if (hasEnded) {
@@ -1201,12 +1120,15 @@ var usePlayback = ({
1201
1120
  });
1202
1121
  return;
1203
1122
  }
1204
- if (context.buffering.current) {
1123
+ if (isBuffering()) {
1205
1124
  if (!muted && !audioContextFailed) {
1206
1125
  sharedAudioContext?.suspend?.();
1207
1126
  }
1208
- const stopListening = context.listenForResume(() => {
1209
- stopListening.remove();
1127
+ const unsubscribe = subscribeBuffering((state) => {
1128
+ if (state.buffering) {
1129
+ return;
1130
+ }
1131
+ unsubscribe();
1210
1132
  if (!muted && !audioContextFailed && sharedAudioContext?._experimentalKeepAudioContextAlive) {
1211
1133
  sharedAudioContext.resume();
1212
1134
  }
@@ -1251,10 +1173,11 @@ var usePlayback = ({
1251
1173
  moveToBeginningWhenEnded,
1252
1174
  isBackgroundedRef,
1253
1175
  getCurrentFrame,
1254
- context,
1176
+ isBuffering,
1255
1177
  isPlaying,
1256
1178
  sharedAudioContext,
1257
1179
  setPlayerMuted,
1180
+ subscribeBuffering,
1258
1181
  logLevel,
1259
1182
  muted
1260
1183
  ]);
@@ -1278,7 +1201,7 @@ var usePlayback = ({
1278
1201
  };
1279
1202
 
1280
1203
  // src/utils/use-element-size.ts
1281
- import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo3, useState as useState3 } from "react";
1204
+ import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo2, useState as useState3 } from "react";
1282
1205
  var elementSizeHooks = [];
1283
1206
  var updateAllElementsSizes = () => {
1284
1207
  for (const listener of elementSizeHooks) {
@@ -1315,7 +1238,7 @@ var useElementSize = (source, options) => {
1315
1238
  }
1316
1239
  };
1317
1240
  });
1318
- const observer = useMemo3(() => {
1241
+ const observer = useMemo2(() => {
1319
1242
  if (typeof ResizeObserver === "undefined") {
1320
1243
  return null;
1321
1244
  }
@@ -1407,7 +1330,7 @@ var useElementSize = (source, options) => {
1407
1330
  elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
1408
1331
  };
1409
1332
  }, [updateSize]);
1410
- return useMemo3(() => {
1333
+ return useMemo2(() => {
1411
1334
  if (!size) {
1412
1335
  return null;
1413
1336
  }
@@ -1416,16 +1339,17 @@ var useElementSize = (source, options) => {
1416
1339
  };
1417
1340
 
1418
1341
  // src/Player.tsx
1419
- import React14, {
1342
+ import React13, {
1420
1343
  forwardRef as forwardRef2,
1344
+ useCallback as useCallback12,
1421
1345
  useEffect as useEffect13,
1422
1346
  useImperativeHandle as useImperativeHandle2,
1423
1347
  useLayoutEffect as useLayoutEffect3,
1424
- useMemo as useMemo15,
1425
- useRef as useRef13,
1348
+ useMemo as useMemo14,
1349
+ useRef as useRef12,
1426
1350
  useState as useState12
1427
1351
  } from "react";
1428
- import { Composition, Internals as Internals17 } from "remotion";
1352
+ import { Composition, Internals as Internals15 } from "remotion";
1429
1353
 
1430
1354
  // src/player-css-classname.ts
1431
1355
  var playerCssClassname = (override) => {
@@ -1433,22 +1357,22 @@ var playerCssClassname = (override) => {
1433
1357
  };
1434
1358
 
1435
1359
  // src/PlayerUI.tsx
1436
- import React12, {
1360
+ import React11, {
1437
1361
  Suspense,
1438
1362
  forwardRef,
1439
1363
  useCallback as useCallback10,
1440
- useContext as useContext5,
1364
+ useContext as useContext4,
1441
1365
  useEffect as useEffect12,
1442
1366
  useImperativeHandle,
1443
- useMemo as useMemo13,
1444
- useRef as useRef11,
1367
+ useMemo as useMemo12,
1368
+ useRef as useRef10,
1445
1369
  useState as useState10
1446
1370
  } from "react";
1447
- import { Internals as Internals13 } from "remotion";
1371
+ import { Internals as Internals11 } from "remotion";
1448
1372
 
1449
1373
  // src/error-boundary.tsx
1450
- import React5 from "react";
1451
- import { jsx as jsx5 } from "react/jsx-runtime";
1374
+ import React4 from "react";
1375
+ import { jsx as jsx4 } from "react/jsx-runtime";
1452
1376
  var errorStyle = {
1453
1377
  display: "flex",
1454
1378
  justifyContent: "center",
@@ -1458,7 +1382,7 @@ var errorStyle = {
1458
1382
  width: "100%"
1459
1383
  };
1460
1384
 
1461
- class ErrorBoundary extends React5.Component {
1385
+ class ErrorBoundary extends React4.Component {
1462
1386
  state = { hasError: null };
1463
1387
  static getDerivedStateFromError(error) {
1464
1388
  return { hasError: error };
@@ -1468,7 +1392,7 @@ class ErrorBoundary extends React5.Component {
1468
1392
  }
1469
1393
  render() {
1470
1394
  if (this.state.hasError) {
1471
- return /* @__PURE__ */ jsx5("div", {
1395
+ return /* @__PURE__ */ jsx4("div", {
1472
1396
  style: errorStyle,
1473
1397
  children: this.props.errorFallback({
1474
1398
  error: this.state.hasError
@@ -1480,8 +1404,8 @@ class ErrorBoundary extends React5.Component {
1480
1404
  }
1481
1405
 
1482
1406
  // src/license-blacklist.tsx
1483
- import React6, { useEffect as useEffect7 } from "react";
1484
- import { jsx as jsx6 } from "react/jsx-runtime";
1407
+ import React5, { useEffect as useEffect7 } from "react";
1408
+ import { jsx as jsx5 } from "react/jsx-runtime";
1485
1409
  var getHashOfDomain = async () => {
1486
1410
  if (typeof window === "undefined") {
1487
1411
  return null;
@@ -1515,7 +1439,7 @@ var DOMAIN_BLACKLIST = [
1515
1439
  ];
1516
1440
  var ran = false;
1517
1441
  var RenderWarningIfBlacklist = () => {
1518
- const [unlicensed, setUnlicensed] = React6.useState(false);
1442
+ const [unlicensed, setUnlicensed] = React5.useState(false);
1519
1443
  useEffect7(() => {
1520
1444
  if (ran) {
1521
1445
  return;
@@ -1557,10 +1481,10 @@ var RenderWarningIfBlacklist = () => {
1557
1481
  if (!unlicensed) {
1558
1482
  return null;
1559
1483
  }
1560
- return /* @__PURE__ */ jsx6("div", {
1484
+ return /* @__PURE__ */ jsx5("div", {
1561
1485
  style,
1562
1486
  className: "warning-banner",
1563
- children: /* @__PURE__ */ jsx6("a", {
1487
+ children: /* @__PURE__ */ jsx5("a", {
1564
1488
  style: { color: "white" },
1565
1489
  href: "https://github.com/remotion-dev/remotion/pull/4589",
1566
1490
  children: "Remotion Unlicensed – Contact hi@remotion.dev"
@@ -1569,30 +1493,30 @@ var RenderWarningIfBlacklist = () => {
1569
1493
  };
1570
1494
 
1571
1495
  // src/PlayerControls.tsx
1572
- import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo10, useRef as useRef9, useState as useState9 } from "react";
1496
+ import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo9, useRef as useRef8, useState as useState9 } from "react";
1573
1497
 
1574
1498
  // src/DefaultPlayPauseButton.tsx
1575
- import { jsx as jsx7 } from "react/jsx-runtime";
1499
+ import { jsx as jsx6 } from "react/jsx-runtime";
1576
1500
  var DefaultPlayPauseButton = ({ playing, buffering }) => {
1577
1501
  if (playing && buffering) {
1578
- return /* @__PURE__ */ jsx7(BufferingIndicator, {
1502
+ return /* @__PURE__ */ jsx6(BufferingIndicator, {
1579
1503
  type: "player"
1580
1504
  });
1581
1505
  }
1582
1506
  if (playing) {
1583
- return /* @__PURE__ */ jsx7(PauseIcon, {});
1507
+ return /* @__PURE__ */ jsx6(PauseIcon, {});
1584
1508
  }
1585
- return /* @__PURE__ */ jsx7(PlayIcon, {});
1509
+ return /* @__PURE__ */ jsx6(PlayIcon, {});
1586
1510
  };
1587
1511
 
1588
1512
  // src/MediaVolumeSlider.tsx
1589
- import { useCallback as useCallback4, useMemo as useMemo5, useRef as useRef6, useState as useState5 } from "react";
1590
- import { Internals as Internals9 } from "remotion";
1513
+ import { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef5, useState as useState5 } from "react";
1514
+ import { Internals as Internals7 } from "remotion";
1591
1515
 
1592
1516
  // src/render-volume-slider.tsx
1593
- import React7, { useCallback as useCallback3, useMemo as useMemo4, useState as useState4 } from "react";
1517
+ import React6, { useCallback as useCallback3, useMemo as useMemo3, useState as useState4 } from "react";
1594
1518
  import { random } from "remotion";
1595
- import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1519
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1596
1520
  var KNOB_SIZE = 12;
1597
1521
  var BAR_HEIGHT = 5;
1598
1522
  var DefaultVolumeSlider = ({
@@ -1602,7 +1526,7 @@ var DefaultVolumeSlider = ({
1602
1526
  inputRef,
1603
1527
  setVolume
1604
1528
  }) => {
1605
- const sliderContainer = useMemo4(() => {
1529
+ const sliderContainer = useMemo3(() => {
1606
1530
  const paddingLeft = 5;
1607
1531
  const common = {
1608
1532
  paddingLeft,
@@ -1622,12 +1546,12 @@ var DefaultVolumeSlider = ({
1622
1546
  ...common
1623
1547
  };
1624
1548
  }, [isVertical]);
1625
- const randomId = typeof React7.useId === "undefined" ? "volume-slider" : React7.useId();
1549
+ const randomId = typeof React6.useId === "undefined" ? "volume-slider" : React6.useId();
1626
1550
  const [randomClass] = useState4(() => `__remotion-volume-slider-${random(randomId)}`.replace(".", ""));
1627
1551
  const onVolumeChange = useCallback3((e) => {
1628
1552
  setVolume(parseFloat(e.target.value));
1629
1553
  }, [setVolume]);
1630
- const inputStyle = useMemo4(() => {
1554
+ const inputStyle = useMemo3(() => {
1631
1555
  const commonStyle = {
1632
1556
  WebkitAppearance: "none",
1633
1557
  backgroundColor: "rgba(255, 255, 255, 0.5)",
@@ -1670,12 +1594,12 @@ var DefaultVolumeSlider = ({
1670
1594
  return /* @__PURE__ */ jsxs3("div", {
1671
1595
  style: sliderContainer,
1672
1596
  children: [
1673
- /* @__PURE__ */ jsx8("style", {
1597
+ /* @__PURE__ */ jsx7("style", {
1674
1598
  dangerouslySetInnerHTML: {
1675
1599
  __html: sliderStyle
1676
1600
  }
1677
1601
  }),
1678
- /* @__PURE__ */ jsx8("input", {
1602
+ /* @__PURE__ */ jsx7("input", {
1679
1603
  ref: inputRef,
1680
1604
  "aria-label": "Change volume",
1681
1605
  className: randomClass,
@@ -1692,20 +1616,20 @@ var DefaultVolumeSlider = ({
1692
1616
  });
1693
1617
  };
1694
1618
  var renderDefaultVolumeSlider = (props) => {
1695
- return /* @__PURE__ */ jsx8(DefaultVolumeSlider, {
1619
+ return /* @__PURE__ */ jsx7(DefaultVolumeSlider, {
1696
1620
  ...props
1697
1621
  });
1698
1622
  };
1699
1623
 
1700
1624
  // src/MediaVolumeSlider.tsx
1701
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1625
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1702
1626
  var VOLUME_SLIDER_WIDTH = 100;
1703
1627
  var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
1704
- const [playerMuted, setPlayerMuted] = Internals9.usePlayerMutedState();
1705
- const [mediaVolume, setMediaVolume] = Internals9.useMediaVolumeState();
1628
+ const [playerMuted, setPlayerMuted] = Internals7.usePlayerMutedState();
1629
+ const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
1706
1630
  const [focused, setFocused] = useState5(false);
1707
- const parentDivRef = useRef6(null);
1708
- const inputRef = useRef6(null);
1631
+ const parentDivRef = useRef5(null);
1632
+ const inputRef = useRef5(null);
1709
1633
  const hover = useHoverState(parentDivRef, false);
1710
1634
  const onBlur = useCallback4(() => {
1711
1635
  setTimeout(() => {
@@ -1723,7 +1647,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1723
1647
  }
1724
1648
  setPlayerMuted((mute) => !mute);
1725
1649
  }, [isVolume0, setPlayerMuted, setMediaVolume]);
1726
- const parentDivStyle = useMemo5(() => {
1650
+ const parentDivStyle = useMemo4(() => {
1727
1651
  return {
1728
1652
  display: "inline-flex",
1729
1653
  background: "none",
@@ -1734,7 +1658,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1734
1658
  ...displayVerticalVolumeSlider && { position: "relative" }
1735
1659
  };
1736
1660
  }, [displayVerticalVolumeSlider]);
1737
- const volumeContainer = useMemo5(() => {
1661
+ const volumeContainer = useMemo4(() => {
1738
1662
  return {
1739
1663
  display: "inline",
1740
1664
  width: ICON_SIZE,
@@ -1748,7 +1672,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1748
1672
  }, []);
1749
1673
  const renderDefaultMuteButton = useCallback4(({ muted, volume }) => {
1750
1674
  const isMutedOrZero = muted || volume === 0;
1751
- return /* @__PURE__ */ jsx9("button", {
1675
+ return /* @__PURE__ */ jsx8("button", {
1752
1676
  "aria-label": isMutedOrZero ? "Unmute sound" : "Mute sound",
1753
1677
  title: isMutedOrZero ? "Unmute sound" : "Mute sound",
1754
1678
  onClick,
@@ -1756,14 +1680,14 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1756
1680
  onFocus: () => setFocused(true),
1757
1681
  style: volumeContainer,
1758
1682
  type: "button",
1759
- children: isMutedOrZero ? /* @__PURE__ */ jsx9(VolumeOffIcon, {}) : /* @__PURE__ */ jsx9(VolumeOnIcon, {})
1683
+ children: isMutedOrZero ? /* @__PURE__ */ jsx8(VolumeOffIcon, {}) : /* @__PURE__ */ jsx8(VolumeOnIcon, {})
1760
1684
  });
1761
1685
  }, [onBlur, onClick, volumeContainer]);
1762
- const muteButton = useMemo5(() => {
1686
+ const muteButton = useMemo4(() => {
1763
1687
  return renderMuteButton ? renderMuteButton({ muted: playerMuted, volume: mediaVolume }) : renderDefaultMuteButton({ muted: playerMuted, volume: mediaVolume });
1764
1688
  }, [playerMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
1765
- const volumeSlider = useMemo5(() => {
1766
- return (focused || hover) && !playerMuted && !Internals9.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
1689
+ const volumeSlider = useMemo4(() => {
1690
+ return (focused || hover) && !playerMuted && !Internals7.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
1767
1691
  isVertical: displayVerticalVolumeSlider,
1768
1692
  volume: mediaVolume,
1769
1693
  onBlur: () => setFocused(false),
@@ -1790,14 +1714,14 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1790
1714
  };
1791
1715
 
1792
1716
  // src/PlaybackrateControl.tsx
1793
- import { useCallback as useCallback5, useEffect as useEffect9, useMemo as useMemo6, useState as useState7 } from "react";
1794
- import { Internals as Internals10 } from "remotion";
1717
+ import { useCallback as useCallback5, useEffect as useEffect9, useMemo as useMemo5, useState as useState7 } from "react";
1718
+ import { Internals as Internals8 } from "remotion";
1795
1719
 
1796
1720
  // src/utils/use-component-visible.ts
1797
- import { useEffect as useEffect8, useRef as useRef7, useState as useState6 } from "react";
1721
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState6 } from "react";
1798
1722
  function useComponentVisible(initialIsVisible) {
1799
1723
  const [isComponentVisible, setIsComponentVisible] = useState6(initialIsVisible);
1800
- const ref = useRef7(null);
1724
+ const ref = useRef6(null);
1801
1725
  useEffect8(() => {
1802
1726
  const handleClickOutside = (event) => {
1803
1727
  if (ref.current && !ref.current.contains(event.target)) {
@@ -1813,7 +1737,7 @@ function useComponentVisible(initialIsVisible) {
1813
1737
  }
1814
1738
 
1815
1739
  // src/PlaybackrateControl.tsx
1816
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1740
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1817
1741
  var BOTTOM = 35;
1818
1742
  var THRESHOLD = 70;
1819
1743
  var rateDiv = {
@@ -1834,10 +1758,10 @@ var checkmarkStyle = {
1834
1758
  height: 14,
1835
1759
  color: "black"
1836
1760
  };
1837
- var Checkmark = () => /* @__PURE__ */ jsx10("svg", {
1761
+ var Checkmark = () => /* @__PURE__ */ jsx9("svg", {
1838
1762
  viewBox: "0 0 512 512",
1839
1763
  style: checkmarkStyle,
1840
- children: /* @__PURE__ */ jsx10("path", {
1764
+ children: /* @__PURE__ */ jsx9("path", {
1841
1765
  fill: "currentColor",
1842
1766
  d: "M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"
1843
1767
  })
@@ -1860,7 +1784,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
1860
1784
  setHovered(false);
1861
1785
  }, []);
1862
1786
  const isFocused = keyboardSelectedRate === rate;
1863
- const actualStyle = useMemo6(() => {
1787
+ const actualStyle = useMemo5(() => {
1864
1788
  return {
1865
1789
  ...rateDiv,
1866
1790
  backgroundColor: hovered || isFocused ? "#eee" : "transparent"
@@ -1873,9 +1797,9 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
1873
1797
  style: actualStyle,
1874
1798
  onClick,
1875
1799
  children: [
1876
- /* @__PURE__ */ jsx10("div", {
1800
+ /* @__PURE__ */ jsx9("div", {
1877
1801
  style: checkmarkContainer,
1878
- children: rate === selectedRate ? /* @__PURE__ */ jsx10(Checkmark, {}) : null
1802
+ children: rate === selectedRate ? /* @__PURE__ */ jsx9(Checkmark, {}) : null
1879
1803
  }),
1880
1804
  formatPlaybackRate(rate),
1881
1805
  "x"
@@ -1883,7 +1807,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
1883
1807
  }, rate);
1884
1808
  };
1885
1809
  var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1886
- const { setPlaybackRate, playbackRate } = Internals10.usePlaybackRate();
1810
+ const { setPlaybackRate, playbackRate } = Internals8.usePlaybackRate();
1887
1811
  const [keyboardSelectedRate, setKeyboardSelectedRate] = useState7(playbackRate);
1888
1812
  useEffect9(() => {
1889
1813
  const listener = (e) => {
@@ -1927,7 +1851,7 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1927
1851
  setPlaybackRate(rate);
1928
1852
  setIsComponentVisible(false);
1929
1853
  }, [setIsComponentVisible, setPlaybackRate]);
1930
- const playbackPopup = useMemo6(() => {
1854
+ const playbackPopup = useMemo5(() => {
1931
1855
  return {
1932
1856
  position: "absolute",
1933
1857
  right: 0,
@@ -1941,10 +1865,10 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1941
1865
  textAlign: "left"
1942
1866
  };
1943
1867
  }, [canvasSize.height]);
1944
- return /* @__PURE__ */ jsx10("div", {
1868
+ return /* @__PURE__ */ jsx9("div", {
1945
1869
  style: playbackPopup,
1946
1870
  children: playbackRates.map((rate) => {
1947
- return /* @__PURE__ */ jsx10(PlaybackrateOption, {
1871
+ return /* @__PURE__ */ jsx9(PlaybackrateOption, {
1948
1872
  selectedRate: playbackRate,
1949
1873
  onSelect,
1950
1874
  rate,
@@ -1985,13 +1909,13 @@ var button = {
1985
1909
  };
1986
1910
  var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
1987
1911
  const { ref, isComponentVisible, setIsComponentVisible } = useComponentVisible(false);
1988
- const { playbackRate } = Internals10.usePlaybackRate();
1912
+ const { playbackRate } = Internals8.usePlaybackRate();
1989
1913
  const onClick = useCallback5((e) => {
1990
1914
  e.stopPropagation();
1991
1915
  e.preventDefault();
1992
1916
  setIsComponentVisible((prevIsComponentVisible) => !prevIsComponentVisible);
1993
1917
  }, [setIsComponentVisible]);
1994
- return /* @__PURE__ */ jsx10("div", {
1918
+ return /* @__PURE__ */ jsx9("div", {
1995
1919
  ref,
1996
1920
  children: /* @__PURE__ */ jsxs5("button", {
1997
1921
  type: "button",
@@ -2006,7 +1930,7 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
2006
1930
  "x"
2007
1931
  ]
2008
1932
  }),
2009
- isComponentVisible && /* @__PURE__ */ jsx10(PlaybackPopup, {
1933
+ isComponentVisible && /* @__PURE__ */ jsx9(PlaybackPopup, {
2010
1934
  canvasSize,
2011
1935
  playbackRates,
2012
1936
  setIsComponentVisible
@@ -2017,9 +1941,9 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
2017
1941
  };
2018
1942
 
2019
1943
  // src/PlayerSeekBar.tsx
2020
- import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef8, useState as useState8 } from "react";
2021
- import { Internals as Internals11, interpolate } from "remotion";
2022
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1944
+ import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo6, useRef as useRef7, useState as useState8 } from "react";
1945
+ import { Internals as Internals9, interpolate } from "remotion";
1946
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2023
1947
  var getFrameFromX = (clientX, durationInFrames, width) => {
2024
1948
  const pos = clientX;
2025
1949
  const frame = Math.round(interpolate(pos, [0, width], [0, durationInFrames - 1], {
@@ -2055,14 +1979,14 @@ var findBodyInWhichDivIsLocated = (div) => {
2055
1979
  return current;
2056
1980
  };
2057
1981
  var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
2058
- const containerRef = useRef8(null);
1982
+ const containerRef = useRef7(null);
2059
1983
  const barHovered = useHoverState(containerRef, false);
2060
1984
  const size = useElementSize(containerRef, {
2061
1985
  triggerOnWindowResize: true,
2062
1986
  shouldApplyCssTransforms: true
2063
1987
  });
2064
1988
  const { seek, play, pause, isPlaying } = usePlayerMethods();
2065
- const frame = Internals11.Timeline.useTimelinePosition();
1989
+ const frame = Internals9.Timeline.useTimelinePosition();
2066
1990
  const [dragging, setDragging] = useState8({
2067
1991
  dragging: false
2068
1992
  });
@@ -2119,7 +2043,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2119
2043
  body.removeEventListener("pointerup", onPointerUp);
2120
2044
  };
2121
2045
  }, [dragging.dragging, onPointerMove, onPointerUp]);
2122
- const knobStyle = useMemo7(() => {
2046
+ const knobStyle = useMemo6(() => {
2123
2047
  return {
2124
2048
  height: KNOB_SIZE2,
2125
2049
  width: KNOB_SIZE2,
@@ -2132,7 +2056,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2132
2056
  opacity: Number(barHovered || dragging.dragging)
2133
2057
  };
2134
2058
  }, [barHovered, dragging.dragging, durationInFrames, frame, width]);
2135
- const fillStyle = useMemo7(() => {
2059
+ const fillStyle = useMemo6(() => {
2136
2060
  return {
2137
2061
  height: BAR_HEIGHT2,
2138
2062
  backgroundColor: "rgba(255, 255, 255, 1)",
@@ -2141,7 +2065,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2141
2065
  borderRadius: BAR_HEIGHT2 / 2
2142
2066
  };
2143
2067
  }, [durationInFrames, frame, inFrame, width]);
2144
- const active = useMemo7(() => {
2068
+ const active = useMemo6(() => {
2145
2069
  return {
2146
2070
  height: BAR_HEIGHT2,
2147
2071
  backgroundColor: "rgba(255, 255, 255, 0.25)",
@@ -2159,15 +2083,15 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2159
2083
  /* @__PURE__ */ jsxs6("div", {
2160
2084
  style: barBackground,
2161
2085
  children: [
2162
- /* @__PURE__ */ jsx11("div", {
2086
+ /* @__PURE__ */ jsx10("div", {
2163
2087
  style: active
2164
2088
  }),
2165
- /* @__PURE__ */ jsx11("div", {
2089
+ /* @__PURE__ */ jsx10("div", {
2166
2090
  style: fillStyle
2167
2091
  })
2168
2092
  ]
2169
2093
  }),
2170
- /* @__PURE__ */ jsx11("div", {
2094
+ /* @__PURE__ */ jsx10("div", {
2171
2095
  style: knobStyle
2172
2096
  })
2173
2097
  ]
@@ -2175,8 +2099,8 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2175
2099
  };
2176
2100
 
2177
2101
  // src/PlayerTimeLabel.tsx
2178
- import { useMemo as useMemo8 } from "react";
2179
- import { Internals as Internals12 } from "remotion";
2102
+ import { useMemo as useMemo7 } from "react";
2103
+ import { Internals as Internals10 } from "remotion";
2180
2104
 
2181
2105
  // src/format-time.ts
2182
2106
  var formatTime = (timeInSeconds) => {
@@ -2188,8 +2112,8 @@ var formatTime = (timeInSeconds) => {
2188
2112
  // src/PlayerTimeLabel.tsx
2189
2113
  import { jsxs as jsxs7 } from "react/jsx-runtime";
2190
2114
  var PlayerTimeLabel = ({ durationInFrames, maxTimeLabelWidth, fps }) => {
2191
- const frame = Internals12.Timeline.useTimelinePosition();
2192
- const timeLabel = useMemo8(() => {
2115
+ const frame = Internals10.Timeline.useTimelinePosition();
2116
+ const timeLabel = useMemo7(() => {
2193
2117
  return {
2194
2118
  color: "white",
2195
2119
  fontFamily: "sans-serif",
@@ -2212,14 +2136,14 @@ var PlayerTimeLabel = ({ durationInFrames, maxTimeLabelWidth, fps }) => {
2212
2136
  };
2213
2137
 
2214
2138
  // src/use-video-controls-resize.ts
2215
- import { useMemo as useMemo9 } from "react";
2139
+ import { useMemo as useMemo8 } from "react";
2216
2140
  var X_SPACER = 10;
2217
2141
  var X_PADDING = 12;
2218
2142
  var useVideoControlsResize = ({
2219
2143
  allowFullscreen: allowFullScreen,
2220
2144
  playerWidth
2221
2145
  }) => {
2222
- const resizeInfo = useMemo9(() => {
2146
+ const resizeInfo = useMemo8(() => {
2223
2147
  const playPauseIconSize = ICON_SIZE;
2224
2148
  const volumeIconSize = ICON_SIZE;
2225
2149
  const _fullscreenIconSize = allowFullScreen ? fullscreenIconSize : 0;
@@ -2239,7 +2163,7 @@ var useVideoControlsResize = ({
2239
2163
  };
2240
2164
 
2241
2165
  // src/PlayerControls.tsx
2242
- import { jsx as jsx12, jsxs as jsxs8, Fragment as Fragment2 } from "react/jsx-runtime";
2166
+ import { jsx as jsx11, jsxs as jsxs8, Fragment as Fragment2 } from "react/jsx-runtime";
2243
2167
  var gradientSteps = [
2244
2168
  0,
2245
2169
  0.013,
@@ -2348,7 +2272,7 @@ var Controls = ({
2348
2272
  toggle,
2349
2273
  renderCustomControls
2350
2274
  }) => {
2351
- const playButtonRef = useRef9(null);
2275
+ const playButtonRef = useRef8(null);
2352
2276
  const [supportsFullscreen, setSupportsFullscreen] = useState9(false);
2353
2277
  const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
2354
2278
  const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
@@ -2376,7 +2300,7 @@ var Controls = ({
2376
2300
  }
2377
2301
  throw new TypeError("initiallyShowControls must be a number or a boolean");
2378
2302
  });
2379
- const containerCss = useMemo10(() => {
2303
+ const containerCss = useMemo9(() => {
2380
2304
  const shouldShow = hovered || !playing || shouldShowInitially || alwaysShowControls;
2381
2305
  return {
2382
2306
  ...containerStyle2,
@@ -2405,7 +2329,7 @@ var Controls = ({
2405
2329
  clearInterval(timeout);
2406
2330
  };
2407
2331
  }, [shouldShowInitially]);
2408
- const playbackRates = useMemo10(() => {
2332
+ const playbackRates = useMemo9(() => {
2409
2333
  if (showPlaybackRateControl === true) {
2410
2334
  return [0.5, 0.8, 1, 1.2, 1.5, 1.8, 2, 2.5, 3];
2411
2335
  }
@@ -2423,8 +2347,8 @@ var Controls = ({
2423
2347
  return null;
2424
2348
  }, [showPlaybackRateControl]);
2425
2349
  const customControlsElement = renderCustomControls ? renderCustomControls() : null;
2426
- const ref = useRef9(null);
2427
- const flexRef = useRef9(null);
2350
+ const ref = useRef8(null);
2351
+ const flexRef = useRef8(null);
2428
2352
  const onPointerDownIfContainer = useCallback7((e) => {
2429
2353
  if (e.target === ref.current || e.target === flexRef.current) {
2430
2354
  onPointerDown?.(e);
@@ -2448,82 +2372,82 @@ var Controls = ({
2448
2372
  /* @__PURE__ */ jsxs8("div", {
2449
2373
  style: leftPartStyle,
2450
2374
  children: [
2451
- /* @__PURE__ */ jsx12("button", {
2375
+ /* @__PURE__ */ jsx11("button", {
2452
2376
  ref: playButtonRef,
2453
2377
  type: "button",
2454
2378
  style: playerButtonStyle,
2455
2379
  onClick: toggle,
2456
2380
  "aria-label": playing ? "Pause video" : "Play video",
2457
2381
  title: playing ? "Pause video" : "Play video",
2458
- children: renderPlayPauseButton === null ? /* @__PURE__ */ jsx12(DefaultPlayPauseButton, {
2382
+ children: renderPlayPauseButton === null ? /* @__PURE__ */ jsx11(DefaultPlayPauseButton, {
2459
2383
  buffering,
2460
2384
  playing
2461
2385
  }) : renderPlayPauseButton({
2462
2386
  playing,
2463
2387
  isBuffering: buffering
2464
- }) ?? /* @__PURE__ */ jsx12(DefaultPlayPauseButton, {
2388
+ }) ?? /* @__PURE__ */ jsx11(DefaultPlayPauseButton, {
2465
2389
  buffering,
2466
2390
  playing
2467
2391
  })
2468
2392
  }),
2469
2393
  showVolumeControls ? /* @__PURE__ */ jsxs8(Fragment2, {
2470
2394
  children: [
2471
- /* @__PURE__ */ jsx12("div", {
2395
+ /* @__PURE__ */ jsx11("div", {
2472
2396
  style: xSpacer
2473
2397
  }),
2474
- /* @__PURE__ */ jsx12(MediaVolumeSlider, {
2398
+ /* @__PURE__ */ jsx11(MediaVolumeSlider, {
2475
2399
  renderMuteButton,
2476
2400
  renderVolumeSlider,
2477
2401
  displayVerticalVolumeSlider
2478
2402
  })
2479
2403
  ]
2480
2404
  }) : null,
2481
- /* @__PURE__ */ jsx12("div", {
2405
+ /* @__PURE__ */ jsx11("div", {
2482
2406
  style: xSpacer
2483
2407
  }),
2484
- /* @__PURE__ */ jsx12(PlayerTimeLabel, {
2408
+ /* @__PURE__ */ jsx11(PlayerTimeLabel, {
2485
2409
  durationInFrames,
2486
2410
  fps,
2487
2411
  maxTimeLabelWidth
2488
2412
  }),
2489
- /* @__PURE__ */ jsx12("div", {
2413
+ /* @__PURE__ */ jsx11("div", {
2490
2414
  style: xSpacer
2491
2415
  })
2492
2416
  ]
2493
2417
  }),
2494
- /* @__PURE__ */ jsx12("div", {
2418
+ /* @__PURE__ */ jsx11("div", {
2495
2419
  style: flex1
2496
2420
  }),
2497
2421
  customControlsElement,
2498
- customControlsElement && playbackRates && canvasSize ? /* @__PURE__ */ jsx12("div", {
2422
+ customControlsElement && playbackRates && canvasSize ? /* @__PURE__ */ jsx11("div", {
2499
2423
  style: xSpacer
2500
2424
  }) : null,
2501
- playbackRates && canvasSize && /* @__PURE__ */ jsx12(PlaybackrateControl, {
2425
+ playbackRates && canvasSize && /* @__PURE__ */ jsx11(PlaybackrateControl, {
2502
2426
  canvasSize,
2503
2427
  playbackRates
2504
2428
  }),
2505
- playbackRates && supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx12("div", {
2429
+ playbackRates && supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx11("div", {
2506
2430
  style: xSpacer
2507
2431
  }) : null,
2508
- /* @__PURE__ */ jsx12("div", {
2432
+ /* @__PURE__ */ jsx11("div", {
2509
2433
  style: fullscreen,
2510
- children: supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx12("button", {
2434
+ children: supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx11("button", {
2511
2435
  type: "button",
2512
2436
  "aria-label": isFullscreen ? "Exit fullscreen" : "Enter Fullscreen",
2513
2437
  title: isFullscreen ? "Exit fullscreen" : "Enter Fullscreen",
2514
2438
  style: playerButtonStyle,
2515
2439
  onClick: isFullscreen ? onExitFullscreenButtonClick : onFullscreenButtonClick,
2516
- children: renderFullscreenButton === null ? /* @__PURE__ */ jsx12(FullscreenIcon, {
2440
+ children: renderFullscreenButton === null ? /* @__PURE__ */ jsx11(FullscreenIcon, {
2517
2441
  isFullscreen
2518
2442
  }) : renderFullscreenButton({ isFullscreen })
2519
2443
  }) : null
2520
2444
  })
2521
2445
  ]
2522
2446
  }),
2523
- /* @__PURE__ */ jsx12("div", {
2447
+ /* @__PURE__ */ jsx11("div", {
2524
2448
  style: ySpacer
2525
2449
  }),
2526
- /* @__PURE__ */ jsx12(PlayerSeekBar, {
2450
+ /* @__PURE__ */ jsx11(PlayerSeekBar, {
2527
2451
  onSeekEnd,
2528
2452
  onSeekStart,
2529
2453
  durationInFrames,
@@ -2538,7 +2462,7 @@ var Controls = ({
2538
2462
  var IS_NODE = typeof document === "undefined";
2539
2463
 
2540
2464
  // src/utils/use-click-prevention-on-double-click.ts
2541
- import { useCallback as useCallback9, useMemo as useMemo12 } from "react";
2465
+ import { useCallback as useCallback9, useMemo as useMemo11 } from "react";
2542
2466
 
2543
2467
  // src/utils/cancellable-promise.ts
2544
2468
  var cancellablePromise = (promise) => {
@@ -2566,9 +2490,9 @@ var cancellablePromise = (promise) => {
2566
2490
  var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
2567
2491
 
2568
2492
  // src/utils/use-cancellable-promises.ts
2569
- import { useCallback as useCallback8, useMemo as useMemo11, useRef as useRef10 } from "react";
2493
+ import { useCallback as useCallback8, useMemo as useMemo10, useRef as useRef9 } from "react";
2570
2494
  var useCancellablePromises = () => {
2571
- const pendingPromises = useRef10([]);
2495
+ const pendingPromises = useRef9([]);
2572
2496
  const appendPendingPromise = useCallback8((promise) => {
2573
2497
  pendingPromises.current = [...pendingPromises.current, promise];
2574
2498
  }, []);
@@ -2576,7 +2500,7 @@ var useCancellablePromises = () => {
2576
2500
  pendingPromises.current = pendingPromises.current.filter((p) => p !== promise);
2577
2501
  }, []);
2578
2502
  const clearPendingPromises = useCallback8(() => pendingPromises.current.map((p) => p.cancel()), []);
2579
- const api = useMemo11(() => ({
2503
+ const api = useMemo10(() => ({
2580
2504
  appendPendingPromise,
2581
2505
  removePendingPromise,
2582
2506
  clearPendingPromises
@@ -2618,7 +2542,7 @@ var useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFull
2618
2542
  api.clearPendingPromises();
2619
2543
  onDoubleClick();
2620
2544
  }, [api, onDoubleClick]);
2621
- const returnValue = useMemo12(() => {
2545
+ const returnValue = useMemo11(() => {
2622
2546
  if (!doubleClickToFullscreen) {
2623
2547
  return { handlePointerDown: onClick, handleDoubleClick: () => {
2624
2548
  return;
@@ -2630,8 +2554,8 @@ var useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFull
2630
2554
  };
2631
2555
 
2632
2556
  // src/PlayerUI.tsx
2633
- import { jsx as jsx13, jsxs as jsxs9, Fragment as Fragment3 } from "react/jsx-runtime";
2634
- var reactVersion = React12.version.split(".")[0];
2557
+ import { jsx as jsx12, jsxs as jsxs9, Fragment as Fragment3 } from "react/jsx-runtime";
2558
+ var reactVersion = React11.version.split(".")[0];
2635
2559
  if (reactVersion === "0") {
2636
2560
  throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
2637
2561
  }
@@ -2676,9 +2600,9 @@ var PlayerUI = ({
2676
2600
  overrideInternalClassName,
2677
2601
  noSuspense
2678
2602
  }, ref) => {
2679
- const config = Internals13.useUnsafeVideoConfig();
2680
- const video = Internals13.useVideo();
2681
- const container = useRef11(null);
2603
+ const config = Internals11.useUnsafeVideoConfig();
2604
+ const video = Internals11.useVideo();
2605
+ const container = useRef10(null);
2682
2606
  const canvasSize = useElementSize(container, {
2683
2607
  triggerOnWindowResize: false,
2684
2608
  shouldApplyCssTransforms: false
@@ -2688,15 +2612,15 @@ var PlayerUI = ({
2688
2612
  const [isFullscreen, setIsFullscreen] = useState10(() => false);
2689
2613
  const [seeking, setSeeking] = useState10(false);
2690
2614
  const [hasPlayed, setHasPlayed] = useState10(false);
2691
- const supportsFullScreen = useMemo13(() => {
2615
+ const supportsFullScreen = useMemo12(() => {
2692
2616
  if (typeof document === "undefined") {
2693
2617
  return false;
2694
2618
  }
2695
2619
  return Boolean(document.fullscreenEnabled || document.webkitFullscreenEnabled);
2696
2620
  }, []);
2697
2621
  const player = usePlayerMethods();
2698
- const [playing] = Internals13.Timeline.usePlayingState();
2699
- const frame = Internals13.Timeline.useTimelinePosition();
2622
+ const playing = Internals11.usePlaying();
2623
+ const frame = Internals11.Timeline.useTimelinePosition();
2700
2624
  const play = useCallback10((e) => {
2701
2625
  if (player.isPlaying()) {
2702
2626
  return;
@@ -2704,7 +2628,7 @@ var PlayerUI = ({
2704
2628
  setHasPlayed(true);
2705
2629
  player.play(e);
2706
2630
  }, [player]);
2707
- const { playerMuted, mediaVolume } = useContext5(Internals13.MediaVolumeContext);
2631
+ const { playerMuted, mediaVolume } = useContext4(Internals11.MediaVolumeContext);
2708
2632
  useEffect12(() => {
2709
2633
  player.emitter.dispatchVolumeChange(mediaVolume);
2710
2634
  }, [player.emitter, mediaVolume]);
@@ -2801,7 +2725,7 @@ var PlayerUI = ({
2801
2725
  };
2802
2726
  }, [player.emitter]);
2803
2727
  const durationInFrames = config?.durationInFrames ?? 1;
2804
- const layout = useMemo13(() => {
2728
+ const layout = useMemo12(() => {
2805
2729
  if (!config || !canvasSize) {
2806
2730
  return null;
2807
2731
  }
@@ -2813,7 +2737,7 @@ var PlayerUI = ({
2813
2737
  });
2814
2738
  }, [canvasSize, config]);
2815
2739
  const scale = layout?.scale ?? 1;
2816
- const initialScaleIgnored = useRef11(false);
2740
+ const initialScaleIgnored = useRef10(false);
2817
2741
  useEffect12(() => {
2818
2742
  if (!initialScaleIgnored.current) {
2819
2743
  initialScaleIgnored.current = true;
@@ -2821,7 +2745,7 @@ var PlayerUI = ({
2821
2745
  }
2822
2746
  player.emitter.dispatchScaleChange(scale);
2823
2747
  }, [player.emitter, scale]);
2824
- const { setMediaVolume, setPlayerMuted } = useContext5(Internals13.SetMediaVolumeContext);
2748
+ const { setMediaVolume, setPlayerMuted } = useContext4(Internals11.SetMediaVolumeContext);
2825
2749
  const [showBufferIndicator, setShowBufferState] = useState10(false);
2826
2750
  useEffect12(() => {
2827
2751
  let timeout = null;
@@ -2941,7 +2865,7 @@ var PlayerUI = ({
2941
2865
  scale
2942
2866
  ]);
2943
2867
  const VideoComponent = video ? video.component : null;
2944
- const outerStyle = useMemo13(() => {
2868
+ const outerStyle = useMemo12(() => {
2945
2869
  return calculateOuterStyle({
2946
2870
  canvasSize,
2947
2871
  config,
@@ -2950,10 +2874,10 @@ var PlayerUI = ({
2950
2874
  layout
2951
2875
  });
2952
2876
  }, [canvasSize, config, layout, overflowVisible, style2]);
2953
- const outer = useMemo13(() => {
2877
+ const outer = useMemo12(() => {
2954
2878
  return calculateOuter({ config, layout, scale, overflowVisible });
2955
2879
  }, [config, layout, overflowVisible, scale]);
2956
- const containerStyle3 = useMemo13(() => {
2880
+ const containerStyle3 = useMemo12(() => {
2957
2881
  return calculateContainerStyle({
2958
2882
  config,
2959
2883
  layout,
@@ -3002,14 +2926,14 @@ var PlayerUI = ({
3002
2926
  setShouldAutoPlay(false);
3003
2927
  }
3004
2928
  }, [play, shouldAutoplay]);
3005
- const loadingMarkup = useMemo13(() => {
2929
+ const loadingMarkup = useMemo12(() => {
3006
2930
  return renderLoading ? renderLoading({
3007
2931
  height: outerStyle.height,
3008
2932
  width: outerStyle.width,
3009
2933
  isBuffering: showBufferIndicator
3010
2934
  }) : null;
3011
2935
  }, [outerStyle.height, outerStyle.width, renderLoading, showBufferIndicator]);
3012
- const currentScale = useMemo13(() => {
2936
+ const currentScale = useMemo12(() => {
3013
2937
  return {
3014
2938
  type: "scale",
3015
2939
  scale
@@ -3027,11 +2951,11 @@ var PlayerUI = ({
3027
2951
  throw new TypeError("renderPoster() must return a React element, but undefined was returned");
3028
2952
  }
3029
2953
  const shouldShowPoster = poster && [
3030
- showPosterWhenPaused && !player.isPlaying() && !seeking,
3031
- showPosterWhenEnded && frame === durationInFrames - 1 && !player.isPlaying(),
3032
- showPosterWhenUnplayed && !hasPlayed && !player.isPlaying(),
3033
- showPosterWhenBuffering && showBufferIndicator && player.isPlaying(),
3034
- showPosterWhenBufferingAndPaused && showBufferIndicator && !player.isPlaying()
2954
+ showPosterWhenPaused && !playing && !seeking,
2955
+ showPosterWhenEnded && frame === durationInFrames - 1 && !playing,
2956
+ showPosterWhenUnplayed && !hasPlayed && !playing,
2957
+ showPosterWhenBuffering && showBufferIndicator && playing,
2958
+ showPosterWhenBufferingAndPaused && showBufferIndicator && !playing
3035
2959
  ].some(Boolean);
3036
2960
  const { left, top, width, height, ...outerWithoutScale } = outer;
3037
2961
  const content = /* @__PURE__ */ jsxs9(Fragment3, {
@@ -3045,18 +2969,18 @@ var PlayerUI = ({
3045
2969
  style: containerStyle3,
3046
2970
  className: playerCssClassname(overrideInternalClassName),
3047
2971
  children: [
3048
- VideoComponent ? /* @__PURE__ */ jsx13(ErrorBoundary, {
2972
+ VideoComponent ? /* @__PURE__ */ jsx12(ErrorBoundary, {
3049
2973
  onError,
3050
2974
  errorFallback,
3051
- children: /* @__PURE__ */ jsx13(Internals13.CurrentScaleContext.Provider, {
2975
+ children: /* @__PURE__ */ jsx12(Internals11.CurrentScaleContext.Provider, {
3052
2976
  value: currentScale,
3053
- children: /* @__PURE__ */ jsx13(VideoComponent, {
2977
+ children: /* @__PURE__ */ jsx12(VideoComponent, {
3054
2978
  ...video?.props ?? {},
3055
2979
  ...inputProps ?? {}
3056
2980
  })
3057
2981
  })
3058
2982
  }) : null,
3059
- shouldShowPoster && posterFillMode === "composition-size" ? /* @__PURE__ */ jsx13("div", {
2983
+ shouldShowPoster && posterFillMode === "composition-size" ? /* @__PURE__ */ jsx12("div", {
3060
2984
  style: {
3061
2985
  ...outerWithoutScale,
3062
2986
  width: config.width,
@@ -3068,16 +2992,16 @@ var PlayerUI = ({
3068
2992
  }) : null
3069
2993
  ]
3070
2994
  }),
3071
- /* @__PURE__ */ jsx13(RenderWarningIfBlacklist, {})
2995
+ /* @__PURE__ */ jsx12(RenderWarningIfBlacklist, {})
3072
2996
  ]
3073
2997
  }),
3074
- shouldShowPoster && posterFillMode === "player-size" ? /* @__PURE__ */ jsx13("div", {
2998
+ shouldShowPoster && posterFillMode === "player-size" ? /* @__PURE__ */ jsx12("div", {
3075
2999
  style: outer,
3076
3000
  onPointerDown: clickToPlay ? handlePointerDown : undefined,
3077
3001
  onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined,
3078
3002
  children: poster
3079
3003
  }) : null,
3080
- controls ? /* @__PURE__ */ jsx13(Controls, {
3004
+ controls ? /* @__PURE__ */ jsx12(Controls, {
3081
3005
  fps: config.fps,
3082
3006
  playing,
3083
3007
  toggle,
@@ -3110,18 +3034,18 @@ var PlayerUI = ({
3110
3034
  ]
3111
3035
  });
3112
3036
  if (noSuspense || IS_NODE && !doesReactVersionSupportSuspense) {
3113
- return /* @__PURE__ */ jsx13("div", {
3037
+ return /* @__PURE__ */ jsx12("div", {
3114
3038
  ref: container,
3115
3039
  style: outerStyle,
3116
3040
  className: className2,
3117
3041
  children: content
3118
3042
  });
3119
3043
  }
3120
- return /* @__PURE__ */ jsx13("div", {
3044
+ return /* @__PURE__ */ jsx12("div", {
3121
3045
  ref: container,
3122
3046
  style: outerStyle,
3123
3047
  className: className2,
3124
- children: /* @__PURE__ */ jsx13(Suspense, {
3048
+ children: /* @__PURE__ */ jsx12(Suspense, {
3125
3049
  fallback: loadingMarkup,
3126
3050
  children: content
3127
3051
  })
@@ -3130,11 +3054,11 @@ var PlayerUI = ({
3130
3054
  var PlayerUI_default = forwardRef(PlayerUI);
3131
3055
 
3132
3056
  // src/SharedPlayerContext.tsx
3133
- import { useCallback as useCallback11, useMemo as useMemo14, useRef as useRef12, useState as useState11 } from "react";
3134
- import { Internals as Internals15 } from "remotion";
3057
+ import { useCallback as useCallback11, useMemo as useMemo13, useRef as useRef11, useState as useState11 } from "react";
3058
+ import { Internals as Internals13 } from "remotion";
3135
3059
 
3136
3060
  // src/volume-persistence.ts
3137
- import { Internals as Internals14 } from "remotion";
3061
+ import { Internals as Internals12 } from "remotion";
3138
3062
  var DEFAULT_VOLUME_PERSISTENCE_KEY = "remotion.volumePreference";
3139
3063
  var persistVolume = (volume, logLevel, volumePersistenceKey) => {
3140
3064
  if (typeof window === "undefined") {
@@ -3143,7 +3067,7 @@ var persistVolume = (volume, logLevel, volumePersistenceKey) => {
3143
3067
  try {
3144
3068
  window.localStorage.setItem(volumePersistenceKey ?? DEFAULT_VOLUME_PERSISTENCE_KEY, String(volume));
3145
3069
  } catch (e) {
3146
- Internals14.Log.error({ logLevel, tag: null }, "Could not persist volume", e);
3070
+ Internals12.Log.error({ logLevel, tag: null }, "Could not persist volume", e);
3147
3071
  }
3148
3072
  };
3149
3073
  var getPreferredVolume = (volumePersistenceKey) => {
@@ -3159,7 +3083,7 @@ var getPreferredVolume = (volumePersistenceKey) => {
3159
3083
  };
3160
3084
 
3161
3085
  // src/SharedPlayerContext.tsx
3162
- import { jsx as jsx14 } from "react/jsx-runtime";
3086
+ import { jsx as jsx13 } from "react/jsx-runtime";
3163
3087
  var PLAYER_COMP_ID = "player-comp";
3164
3088
  var SharedPlayerContexts = ({
3165
3089
  children,
@@ -3182,7 +3106,7 @@ var SharedPlayerContexts = ({
3182
3106
  _experimentalKeepAudioContextAlive
3183
3107
  }) => {
3184
3108
  const persistVolumeToStorage = initialVolume === undefined;
3185
- const compositionManagerContext = useMemo14(() => {
3109
+ const compositionManagerContext = useMemo13(() => {
3186
3110
  const context = {
3187
3111
  compositions: [
3188
3112
  {
@@ -3192,7 +3116,7 @@ var SharedPlayerContexts = ({
3192
3116
  width: compositionWidth,
3193
3117
  fps,
3194
3118
  id: PLAYER_COMP_ID,
3195
- nonce: [[0, 777]],
3119
+ order: null,
3196
3120
  folderName: null,
3197
3121
  parentFolderName: null,
3198
3122
  schema: null,
@@ -3228,13 +3152,13 @@ var SharedPlayerContexts = ({
3228
3152
  ]);
3229
3153
  const [playerMuted, setPlayerMuted] = useState11(() => initiallyMuted);
3230
3154
  const [mediaVolume, setMediaVolume] = useState11(() => persistVolumeToStorage ? getPreferredVolume(volumePersistenceKey ?? null) : initialVolume);
3231
- const mediaVolumeContextValue = useMemo14(() => {
3155
+ const mediaVolumeContextValue = useMemo13(() => {
3232
3156
  return {
3233
3157
  playerMuted,
3234
3158
  mediaVolume
3235
3159
  };
3236
3160
  }, [playerMuted, mediaVolume]);
3237
- const audioContextWasCreated = useRef12(false);
3161
+ const audioContextWasCreated = useRef11(false);
3238
3162
  const shouldCreateAudioContext = audioContextWasCreated.current || audioEnabled && !playerMuted && mediaVolume > 0;
3239
3163
  audioContextWasCreated.current = shouldCreateAudioContext;
3240
3164
  const setMediaVolumeAndPersist = useCallback11((vol) => {
@@ -3243,19 +3167,19 @@ var SharedPlayerContexts = ({
3243
3167
  persistVolume(vol, logLevel, volumePersistenceKey ?? null);
3244
3168
  }
3245
3169
  }, [persistVolumeToStorage, logLevel, volumePersistenceKey]);
3246
- const setMediaVolumeContextValue = useMemo14(() => {
3170
+ const setMediaVolumeContextValue = useMemo13(() => {
3247
3171
  return {
3248
3172
  setPlayerMuted,
3249
3173
  setMediaVolume: setMediaVolumeAndPersist
3250
3174
  };
3251
3175
  }, [setMediaVolumeAndPersist]);
3252
- const logLevelContext = useMemo14(() => {
3176
+ const logLevelContext = useMemo13(() => {
3253
3177
  return {
3254
3178
  logLevel,
3255
3179
  mountTime: Date.now()
3256
3180
  };
3257
3181
  }, [logLevel]);
3258
- const env = useMemo14(() => {
3182
+ const env = useMemo13(() => {
3259
3183
  return {
3260
3184
  isPlayer: true,
3261
3185
  isRendering: false,
@@ -3264,46 +3188,34 @@ var SharedPlayerContexts = ({
3264
3188
  isReadOnlyStudio: false
3265
3189
  };
3266
3190
  }, []);
3267
- const frameRef = useRef12(timelineContext.frame);
3268
- frameRef.current = timelineContext.frame;
3269
- const timelineImperativeContextValue = useMemo14(() => {
3270
- return {
3271
- frameRef,
3272
- imperativePlaying: timelineContext.imperativePlaying,
3273
- audioAndVideoTags: timelineContext.audioAndVideoTags
3274
- };
3275
- }, [timelineContext.audioAndVideoTags, timelineContext.imperativePlaying]);
3276
- return /* @__PURE__ */ jsx14(Internals15.RemotionEnvironmentContext.Provider, {
3191
+ return /* @__PURE__ */ jsx13(Internals13.RemotionEnvironmentContext.Provider, {
3277
3192
  value: env,
3278
- children: /* @__PURE__ */ jsx14(Internals15.LogLevelContext.Provider, {
3193
+ children: /* @__PURE__ */ jsx13(Internals13.LogLevelContext.Provider, {
3279
3194
  value: logLevelContext,
3280
- children: /* @__PURE__ */ jsx14(Internals15.CanUseRemotionHooksProvider, {
3281
- children: /* @__PURE__ */ jsx14(Internals15.AbsoluteTimeContext.Provider, {
3195
+ children: /* @__PURE__ */ jsx13(Internals13.CanUseRemotionHooksProvider, {
3196
+ children: /* @__PURE__ */ jsx13(Internals13.AbsoluteTimeContext.Provider, {
3282
3197
  value: timelineContext,
3283
- children: /* @__PURE__ */ jsx14(Internals15.PlaybackRateContext.Provider, {
3198
+ children: /* @__PURE__ */ jsx13(Internals13.PlaybackRateContext.Provider, {
3284
3199
  value: playbackRateContext,
3285
- children: /* @__PURE__ */ jsx14(CoreTimelineImperativeContextProvider, {
3286
- value: timelineImperativeContextValue,
3287
- children: /* @__PURE__ */ jsx14(Internals15.TimelineContext.Provider, {
3288
- value: timelineContext,
3289
- children: /* @__PURE__ */ jsx14(Internals15.CompositionManager.Provider, {
3290
- value: compositionManagerContext,
3291
- children: /* @__PURE__ */ jsx14(Internals15.PrefetchProvider, {
3292
- children: /* @__PURE__ */ jsx14(Internals15.DurationsContextProvider, {
3293
- children: /* @__PURE__ */ jsx14(Internals15.MediaVolumeContext.Provider, {
3294
- value: mediaVolumeContextValue,
3295
- children: /* @__PURE__ */ jsx14(Internals15.SetMediaVolumeContext.Provider, {
3296
- value: setMediaVolumeContextValue,
3297
- children: /* @__PURE__ */ jsx14(Internals15.BufferingProvider, {
3298
- children: /* @__PURE__ */ jsx14(Internals15.SharedAudioContextProvider, {
3299
- audioLatencyHint,
3300
- audioEnabled: shouldCreateAudioContext,
3301
- previewSampleRate: sampleRate,
3302
- _experimentalKeepAudioContextAlive,
3303
- children: /* @__PURE__ */ jsx14(Internals15.SharedAudioTagsContextProvider, {
3304
- numberOfAudioTags: numberOfSharedAudioTags,
3305
- children
3306
- })
3200
+ children: /* @__PURE__ */ jsx13(Internals13.TimelineContext.Provider, {
3201
+ value: timelineContext,
3202
+ children: /* @__PURE__ */ jsx13(Internals13.CompositionManager.Provider, {
3203
+ value: compositionManagerContext,
3204
+ children: /* @__PURE__ */ jsx13(Internals13.PrefetchProvider, {
3205
+ children: /* @__PURE__ */ jsx13(Internals13.DurationsContextProvider, {
3206
+ children: /* @__PURE__ */ jsx13(Internals13.MediaVolumeContext.Provider, {
3207
+ value: mediaVolumeContextValue,
3208
+ children: /* @__PURE__ */ jsx13(Internals13.SetMediaVolumeContext.Provider, {
3209
+ value: setMediaVolumeContextValue,
3210
+ children: /* @__PURE__ */ jsx13(Internals13.BufferingProvider, {
3211
+ children: /* @__PURE__ */ jsx13(Internals13.SharedAudioContextProvider, {
3212
+ audioLatencyHint,
3213
+ audioEnabled: shouldCreateAudioContext,
3214
+ previewSampleRate: sampleRate,
3215
+ _experimentalKeepAudioContextAlive,
3216
+ children: /* @__PURE__ */ jsx13(Internals13.SharedAudioTagsContextProvider, {
3217
+ numberOfAudioTags: numberOfSharedAudioTags,
3218
+ children
3307
3219
  })
3308
3220
  })
3309
3221
  })
@@ -3321,7 +3233,7 @@ var SharedPlayerContexts = ({
3321
3233
  };
3322
3234
 
3323
3235
  // src/use-remotion-license-acknowledge.ts
3324
- import { Internals as Internals16 } from "remotion";
3236
+ import { Internals as Internals14 } from "remotion";
3325
3237
  var warningShown = false;
3326
3238
  var acknowledgeRemotionLicenseMessage = (acknowledge, logLevel) => {
3327
3239
  if (acknowledge) {
@@ -3331,7 +3243,7 @@ var acknowledgeRemotionLicenseMessage = (acknowledge, logLevel) => {
3331
3243
  return;
3332
3244
  }
3333
3245
  warningShown = true;
3334
- Internals16.Log.warn({ logLevel, tag: null }, "Note: Some companies are required to obtain a license to use Remotion. See: https://remotion.dev/license\nPass the `acknowledgeRemotionLicense` prop to `<Player />` function to make this message disappear.");
3246
+ Internals14.Log.warn({ logLevel, tag: null }, "Note: Some companies are required to obtain a license to use Remotion. See: https://remotion.dev/license\nPass the `acknowledgeRemotionLicense` prop to `<Player />` function to make this message disappear.");
3335
3247
  };
3336
3248
 
3337
3249
  // src/utils/validate-in-out-frame.ts
@@ -3432,7 +3344,7 @@ var validateDurationInFrames = NoReactInternals.validateDurationInFrames;
3432
3344
  var validateDefaultAndInputProps = NoReactInternals.validateDefaultAndInputProps;
3433
3345
 
3434
3346
  // src/Player.tsx
3435
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
3347
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
3436
3348
  var componentOrNullIfLazy = (props) => {
3437
3349
  if ("component" in props) {
3438
3350
  return props.component;
@@ -3440,7 +3352,7 @@ var componentOrNullIfLazy = (props) => {
3440
3352
  return null;
3441
3353
  };
3442
3354
  var TimelineSequenceObserverComponent = ({ onTimelineSequenceChange }) => {
3443
- const { sequences } = React14.useContext(Internals17.SequenceManager);
3355
+ const { sequences } = React13.useContext(Internals15.SequenceManager);
3444
3356
  useEffect13(() => {
3445
3357
  onTimelineSequenceChange(sequences);
3446
3358
  }, [onTimelineSequenceChange, sequences]);
@@ -3504,7 +3416,7 @@ var PlayerFn = ({
3504
3416
  if (typeof window !== "undefined") {
3505
3417
  window.remotion_isPlayer = true;
3506
3418
  }
3507
- const onTimelineSequenceChange = React14.useContext(TimelineSequenceObserverContext);
3419
+ const onTimelineSequenceChange = React13.useContext(TimelineSequenceObserverContext);
3508
3420
  if (componentProps.defaultProps !== undefined) {
3509
3421
  throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");
3510
3422
  }
@@ -3516,7 +3428,7 @@ var PlayerFn = ({
3516
3428
  throw new TypeError(`'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.`);
3517
3429
  }
3518
3430
  useState12(() => acknowledgeRemotionLicenseMessage(Boolean(acknowledgeRemotionLicense), logLevel));
3519
- const component = Internals17.useLazyComponent({
3431
+ const component = Internals15.useLazyComponent({
3520
3432
  compProps: componentProps,
3521
3433
  componentName: "Player",
3522
3434
  noSuspense: Boolean(noSuspense)
@@ -3525,10 +3437,14 @@ var PlayerFn = ({
3525
3437
  const [frame, setFrame] = useState12(() => ({
3526
3438
  [PLAYER_COMP_ID]: initialFrame ?? 0
3527
3439
  }));
3528
- const [playing, setPlaying] = useState12(false);
3529
- const rootRef = useRef13(null);
3530
- const audioAndVideoTags = useRef13([]);
3531
- const imperativePlaying = useRef13(false);
3440
+ const frameRef = useRef12(frame);
3441
+ frameRef.current = frame;
3442
+ const rootRef = useRef12(null);
3443
+ const audioAndVideoTags = useRef12([]);
3444
+ const playingStore = useMemo14(() => Internals15.createRuntimeValueStore({ playing: false }), []);
3445
+ const bufferingStore = useMemo14(() => Internals15.createRuntimeValueStore({ buffering: false }), []);
3446
+ const readIsPlaying = useCallback12(() => playingStore.store.getSnapshot().playing, [playingStore]);
3447
+ const readIsBuffering = useCallback12(() => bufferingStore.store.getSnapshot().buffering, [bufferingStore]);
3532
3448
  const [currentPlaybackRate, setCurrentPlaybackRate] = useState12(playbackRate);
3533
3449
  if (typeof compositionHeight !== "number") {
3534
3450
  throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
@@ -3591,68 +3507,91 @@ var PlayerFn = ({
3591
3507
  }, [playbackRate]);
3592
3508
  useImperativeHandle2(ref, () => rootRef.current, []);
3593
3509
  useState12(() => {
3594
- Internals17.playbackLogging({
3510
+ Internals15.playbackLogging({
3595
3511
  logLevel,
3596
3512
  message: `[player] Mounting <Player>. User agent = ${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
3597
3513
  tag: "player",
3598
3514
  mountTime: Date.now()
3599
3515
  });
3600
3516
  });
3601
- const timelineContextValue = useMemo15(() => {
3517
+ const timelineContextValue = useMemo14(() => {
3602
3518
  return {
3603
3519
  frame,
3604
- playing,
3605
- imperativePlaying,
3520
+ isPlaying: readIsPlaying,
3606
3521
  audioAndVideoTags
3607
3522
  };
3608
- }, [frame, playing]);
3609
- const playbackRateContextValue = useMemo15(() => {
3523
+ }, [frame, readIsPlaying]);
3524
+ const playbackRateContextValue = useMemo14(() => {
3610
3525
  return {
3611
3526
  playbackRate: currentPlaybackRate,
3612
3527
  setPlaybackRate: setCurrentPlaybackRate
3613
3528
  };
3614
3529
  }, [currentPlaybackRate]);
3615
- const setTimelineContextValue = useMemo15(() => {
3530
+ const setTimelineContextValue = useMemo14(() => {
3616
3531
  return {
3617
3532
  setFrame,
3618
- setPlaying
3533
+ setPlaying: (updater) => {
3534
+ const current = playingStore.store.getSnapshot().playing;
3535
+ const next = typeof updater === "function" ? updater(current) : updater;
3536
+ if (current !== next) {
3537
+ playingStore.setSnapshot({ playing: next });
3538
+ }
3539
+ },
3540
+ setBuffering: (buffering) => {
3541
+ if (readIsBuffering() !== buffering) {
3542
+ bufferingStore.setSnapshot({ buffering });
3543
+ }
3544
+ },
3545
+ subscribePlaying: playingStore.store.subscribe,
3546
+ subscribeBuffering: bufferingStore.store.subscribe,
3547
+ isPlaying: readIsPlaying,
3548
+ isBuffering: readIsBuffering,
3549
+ frameRef,
3550
+ audioAndVideoTags
3619
3551
  };
3620
- }, [setFrame]);
3552
+ }, [
3553
+ bufferingStore,
3554
+ setFrame,
3555
+ frameRef,
3556
+ playingStore,
3557
+ readIsBuffering,
3558
+ readIsPlaying
3559
+ ]);
3621
3560
  if (typeof window !== "undefined") {
3622
3561
  useLayoutEffect3(() => {
3623
- Internals17.CSSUtils.injectCSS(Internals17.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
3562
+ Internals15.CSSUtils.injectCSS(Internals15.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
3624
3563
  }, [overrideInternalClassName]);
3625
3564
  }
3626
- const actualInputProps = useMemo15(() => inputProps ?? {}, [inputProps]);
3627
- const browserMediaControlsBehavior = useMemo15(() => {
3565
+ const actualInputProps = useMemo14(() => inputProps ?? {}, [inputProps]);
3566
+ const browserMediaControlsBehavior = useMemo14(() => {
3628
3567
  return passedBrowserMediaControlsBehavior ?? {
3629
3568
  mode: "prevent-media-session"
3630
3569
  };
3631
3570
  }, [passedBrowserMediaControlsBehavior]);
3632
- const player = /* @__PURE__ */ jsx15(Internals17.IsPlayerContextProvider, {
3633
- children: /* @__PURE__ */ jsx15(SharedPlayerContexts, {
3634
- timelineContext: timelineContextValue,
3635
- playbackRateContext: playbackRateContextValue,
3636
- component,
3637
- compositionHeight,
3638
- compositionWidth,
3639
- durationInFrames,
3640
- fps,
3641
- numberOfSharedAudioTags,
3642
- initiallyMuted,
3643
- logLevel,
3644
- audioLatencyHint,
3645
- sampleRate,
3646
- _experimentalKeepAudioContextAlive,
3647
- volumePersistenceKey,
3648
- initialVolume,
3649
- inputProps: actualInputProps,
3650
- audioEnabled: true,
3651
- children: /* @__PURE__ */ jsx15(Internals17.SetTimelineContext.Provider, {
3652
- value: setTimelineContextValue,
3653
- children: /* @__PURE__ */ jsx15(PlayerEmitterProvider, {
3571
+ const player = /* @__PURE__ */ jsx14(Internals15.IsPlayerContextProvider, {
3572
+ children: /* @__PURE__ */ jsx14(Internals15.SetTimelineContext.Provider, {
3573
+ value: setTimelineContextValue,
3574
+ children: /* @__PURE__ */ jsx14(SharedPlayerContexts, {
3575
+ timelineContext: timelineContextValue,
3576
+ playbackRateContext: playbackRateContextValue,
3577
+ component,
3578
+ compositionHeight,
3579
+ compositionWidth,
3580
+ durationInFrames,
3581
+ fps,
3582
+ numberOfSharedAudioTags,
3583
+ initiallyMuted,
3584
+ logLevel,
3585
+ audioLatencyHint,
3586
+ sampleRate,
3587
+ _experimentalKeepAudioContextAlive,
3588
+ volumePersistenceKey,
3589
+ initialVolume,
3590
+ inputProps: actualInputProps,
3591
+ audioEnabled: true,
3592
+ children: /* @__PURE__ */ jsx14(PlayerEmitterProvider, {
3654
3593
  currentPlaybackRate,
3655
- children: /* @__PURE__ */ jsx15(PlayerUI_default, {
3594
+ children: /* @__PURE__ */ jsx14(PlayerUI_default, {
3656
3595
  ref: rootRef,
3657
3596
  posterFillMode,
3658
3597
  renderLoading,
@@ -3700,11 +3639,11 @@ var PlayerFn = ({
3700
3639
  if (!onTimelineSequenceChange) {
3701
3640
  return player;
3702
3641
  }
3703
- return /* @__PURE__ */ jsx15(Internals17.SequenceRegistrationContext.Provider, {
3642
+ return /* @__PURE__ */ jsx14(Internals15.SequenceRegistrationContext.Provider, {
3704
3643
  value: true,
3705
- children: /* @__PURE__ */ jsxs10(Internals17.SequenceManagerProvider, {
3644
+ children: /* @__PURE__ */ jsxs10(Internals15.SequenceManagerProvider, {
3706
3645
  children: [
3707
- /* @__PURE__ */ jsx15(TimelineSequenceObserverComponent, {
3646
+ /* @__PURE__ */ jsx14(TimelineSequenceObserverComponent, {
3708
3647
  onTimelineSequenceChange
3709
3648
  }),
3710
3649
  player
@@ -3719,31 +3658,31 @@ import {
3719
3658
  forwardRef as forwardRef4,
3720
3659
  useImperativeHandle as useImperativeHandle4,
3721
3660
  useLayoutEffect as useLayoutEffect4,
3722
- useMemo as useMemo18,
3723
- useRef as useRef15,
3661
+ useMemo as useMemo17,
3662
+ useRef as useRef14,
3724
3663
  useState as useState13
3725
3664
  } from "react";
3726
- import { Internals as Internals19 } from "remotion";
3665
+ import { Internals as Internals17 } from "remotion";
3727
3666
 
3728
3667
  // src/ThumbnailUI.tsx
3729
- import React15, {
3668
+ import React14, {
3730
3669
  forwardRef as forwardRef3,
3731
3670
  Suspense as Suspense2,
3732
- useCallback as useCallback12,
3671
+ useCallback as useCallback13,
3733
3672
  useImperativeHandle as useImperativeHandle3,
3734
- useMemo as useMemo17,
3735
- useRef as useRef14
3673
+ useMemo as useMemo16,
3674
+ useRef as useRef13
3736
3675
  } from "react";
3737
- import { Internals as Internals18 } from "remotion";
3676
+ import { Internals as Internals16 } from "remotion";
3738
3677
 
3739
3678
  // src/use-thumbnail.ts
3740
- import { useContext as useContext6, useMemo as useMemo16 } from "react";
3679
+ import { useContext as useContext5, useMemo as useMemo15 } from "react";
3741
3680
  var useThumbnail = () => {
3742
- const emitter = useContext6(ThumbnailEmitterContext);
3681
+ const emitter = useContext5(ThumbnailEmitterContext);
3743
3682
  if (!emitter) {
3744
3683
  throw new TypeError("Expected Player event emitter context");
3745
3684
  }
3746
- const returnValue = useMemo16(() => {
3685
+ const returnValue = useMemo15(() => {
3747
3686
  return {
3748
3687
  emitter
3749
3688
  };
@@ -3752,8 +3691,8 @@ var useThumbnail = () => {
3752
3691
  };
3753
3692
 
3754
3693
  // src/ThumbnailUI.tsx
3755
- import { jsx as jsx16 } from "react/jsx-runtime";
3756
- var reactVersion2 = React15.version.split(".")[0];
3694
+ import { jsx as jsx15 } from "react/jsx-runtime";
3695
+ var reactVersion2 = React14.version.split(".")[0];
3757
3696
  if (reactVersion2 === "0") {
3758
3697
  throw new Error(`Version ${reactVersion2} of "react" is not supported by Remotion`);
3759
3698
  }
@@ -3768,14 +3707,14 @@ var ThumbnailUI = ({
3768
3707
  noSuspense,
3769
3708
  overrideInternalClassName
3770
3709
  }, ref) => {
3771
- const config = Internals18.useUnsafeVideoConfig();
3772
- const video = Internals18.useVideo();
3773
- const container = useRef14(null);
3710
+ const config = Internals16.useUnsafeVideoConfig();
3711
+ const video = Internals16.useVideo();
3712
+ const container = useRef13(null);
3774
3713
  const canvasSize = useElementSize(container, {
3775
3714
  triggerOnWindowResize: false,
3776
3715
  shouldApplyCssTransforms: false
3777
3716
  });
3778
- const layout = useMemo17(() => {
3717
+ const layout = useMemo16(() => {
3779
3718
  if (!config || !canvasSize) {
3780
3719
  return null;
3781
3720
  }
@@ -3797,7 +3736,7 @@ var ThumbnailUI = ({
3797
3736
  return Object.assign(thumbnail.emitter, methods);
3798
3737
  }, [scale, thumbnail.emitter]);
3799
3738
  const VideoComponent = video ? video.component : null;
3800
- const outerStyle = useMemo17(() => {
3739
+ const outerStyle = useMemo16(() => {
3801
3740
  return calculateOuterStyle({
3802
3741
  config,
3803
3742
  style: style2,
@@ -3806,10 +3745,10 @@ var ThumbnailUI = ({
3806
3745
  layout
3807
3746
  });
3808
3747
  }, [canvasSize, config, layout, overflowVisible, style2]);
3809
- const outer = useMemo17(() => {
3748
+ const outer = useMemo16(() => {
3810
3749
  return calculateOuter({ config, layout, scale, overflowVisible });
3811
3750
  }, [config, layout, overflowVisible, scale]);
3812
- const containerStyle3 = useMemo17(() => {
3751
+ const containerStyle3 = useMemo16(() => {
3813
3752
  return calculateContainerStyle({
3814
3753
  config,
3815
3754
  layout,
@@ -3817,17 +3756,17 @@ var ThumbnailUI = ({
3817
3756
  overflowVisible
3818
3757
  });
3819
3758
  }, [config, layout, overflowVisible, scale]);
3820
- const onError = useCallback12((error) => {
3759
+ const onError = useCallback13((error) => {
3821
3760
  thumbnail.emitter.dispatchError(error);
3822
3761
  }, [thumbnail.emitter]);
3823
- const loadingMarkup = useMemo17(() => {
3762
+ const loadingMarkup = useMemo16(() => {
3824
3763
  return renderLoading ? renderLoading({
3825
3764
  height: outerStyle.height,
3826
3765
  width: outerStyle.width,
3827
3766
  isBuffering: false
3828
3767
  }) : null;
3829
3768
  }, [outerStyle.height, outerStyle.width, renderLoading]);
3830
- const currentScaleContext = useMemo17(() => {
3769
+ const currentScaleContext = useMemo16(() => {
3831
3770
  return {
3832
3771
  type: "scale",
3833
3772
  scale
@@ -3836,17 +3775,17 @@ var ThumbnailUI = ({
3836
3775
  if (!config) {
3837
3776
  return null;
3838
3777
  }
3839
- const content = /* @__PURE__ */ jsx16("div", {
3778
+ const content = /* @__PURE__ */ jsx15("div", {
3840
3779
  style: outer,
3841
- children: /* @__PURE__ */ jsx16("div", {
3780
+ children: /* @__PURE__ */ jsx15("div", {
3842
3781
  style: containerStyle3,
3843
3782
  className: playerCssClassname(overrideInternalClassName),
3844
- children: VideoComponent ? /* @__PURE__ */ jsx16(ErrorBoundary, {
3783
+ children: VideoComponent ? /* @__PURE__ */ jsx15(ErrorBoundary, {
3845
3784
  onError,
3846
3785
  errorFallback,
3847
- children: /* @__PURE__ */ jsx16(Internals18.CurrentScaleContext.Provider, {
3786
+ children: /* @__PURE__ */ jsx15(Internals16.CurrentScaleContext.Provider, {
3848
3787
  value: currentScaleContext,
3849
- children: /* @__PURE__ */ jsx16(VideoComponent, {
3788
+ children: /* @__PURE__ */ jsx15(VideoComponent, {
3850
3789
  ...video?.props ?? {},
3851
3790
  ...inputProps ?? {}
3852
3791
  })
@@ -3855,18 +3794,18 @@ var ThumbnailUI = ({
3855
3794
  })
3856
3795
  });
3857
3796
  if (noSuspense || IS_NODE && !doesReactVersionSupportSuspense2) {
3858
- return /* @__PURE__ */ jsx16("div", {
3797
+ return /* @__PURE__ */ jsx15("div", {
3859
3798
  ref: container,
3860
3799
  style: outerStyle,
3861
3800
  className: className2,
3862
3801
  children: content
3863
3802
  });
3864
3803
  }
3865
- return /* @__PURE__ */ jsx16("div", {
3804
+ return /* @__PURE__ */ jsx15("div", {
3866
3805
  ref: container,
3867
3806
  style: outerStyle,
3868
3807
  className: className2,
3869
- children: /* @__PURE__ */ jsx16(Suspense2, {
3808
+ children: /* @__PURE__ */ jsx15(Suspense2, {
3870
3809
  fallback: loadingMarkup,
3871
3810
  children: content
3872
3811
  })
@@ -3875,7 +3814,7 @@ var ThumbnailUI = ({
3875
3814
  var ThumbnailUI_default = forwardRef3(ThumbnailUI);
3876
3815
 
3877
3816
  // src/Thumbnail.tsx
3878
- import { jsx as jsx17 } from "react/jsx-runtime";
3817
+ import { jsx as jsx16 } from "react/jsx-runtime";
3879
3818
  var ThumbnailFn = ({
3880
3819
  frameToDisplay,
3881
3820
  style: style2,
@@ -3898,21 +3837,20 @@ var ThumbnailFn = ({
3898
3837
  window.remotion_isPlayer = true;
3899
3838
  }, []);
3900
3839
  }
3901
- const rootRef = useRef15(null);
3902
- const imperativePlaying = useRef15(false);
3903
- const audioAndVideoTags = useRef15([]);
3904
- const timelineState = useMemo18(() => {
3840
+ const rootRef = useRef14(null);
3841
+ const audioAndVideoTags = useRef14([]);
3842
+ const bufferingStore = useMemo17(() => Internals17.createRuntimeValueStore({ buffering: false }), []);
3843
+ const timelineState = useMemo17(() => {
3905
3844
  const value = {
3906
- playing: false,
3845
+ isPlaying: () => false,
3907
3846
  frame: {
3908
3847
  [PLAYER_COMP_ID]: frameToDisplay
3909
3848
  },
3910
- imperativePlaying,
3911
3849
  audioAndVideoTags
3912
3850
  };
3913
3851
  return value;
3914
3852
  }, [frameToDisplay]);
3915
- const playbackRateContext = useMemo18(() => {
3853
+ const playbackRateContext = useMemo17(() => {
3916
3854
  return {
3917
3855
  playbackRate: 1,
3918
3856
  setPlaybackRate: () => {
@@ -3920,45 +3858,73 @@ var ThumbnailFn = ({
3920
3858
  }
3921
3859
  };
3922
3860
  }, []);
3861
+ const frameRef = useRef14(timelineState.frame);
3862
+ frameRef.current = timelineState.frame;
3863
+ const setTimelineContext = useMemo17(() => {
3864
+ return {
3865
+ setFrame: () => {
3866
+ return;
3867
+ },
3868
+ setPlaying: () => {
3869
+ return;
3870
+ },
3871
+ setBuffering: (buffering) => {
3872
+ if (bufferingStore.store.getSnapshot().buffering !== buffering) {
3873
+ bufferingStore.setSnapshot({ buffering });
3874
+ }
3875
+ },
3876
+ subscribePlaying: () => () => {
3877
+ return;
3878
+ },
3879
+ subscribeBuffering: bufferingStore.store.subscribe,
3880
+ isPlaying: () => false,
3881
+ isBuffering: () => bufferingStore.store.getSnapshot().buffering,
3882
+ frameRef,
3883
+ audioAndVideoTags
3884
+ };
3885
+ }, [bufferingStore]);
3923
3886
  useImperativeHandle4(ref, () => rootRef.current, []);
3924
- const Component = Internals19.useLazyComponent({
3887
+ const Component = Internals17.useLazyComponent({
3925
3888
  compProps: componentProps,
3926
3889
  componentName: "Thumbnail",
3927
3890
  noSuspense: Boolean(noSuspense)
3928
3891
  });
3929
3892
  const [emitter] = useState13(() => new ThumbnailEmitter);
3930
- const passedInputProps = useMemo18(() => {
3893
+ const passedInputProps = useMemo17(() => {
3931
3894
  return inputProps ?? {};
3932
3895
  }, [inputProps]);
3933
- return /* @__PURE__ */ jsx17(Internals19.IsPlayerContextProvider, {
3934
- children: /* @__PURE__ */ jsx17(SharedPlayerContexts, {
3935
- timelineContext: timelineState,
3936
- playbackRateContext,
3937
- component: Component,
3938
- compositionHeight,
3939
- compositionWidth,
3940
- durationInFrames,
3941
- fps,
3942
- numberOfSharedAudioTags: 0,
3943
- initiallyMuted: true,
3944
- logLevel,
3945
- audioLatencyHint: "playback",
3946
- sampleRate: 48000,
3947
- inputProps: passedInputProps,
3948
- audioEnabled: false,
3949
- _experimentalKeepAudioContextAlive: false,
3950
- children: /* @__PURE__ */ jsx17(ThumbnailEmitterContext.Provider, {
3951
- value: emitter,
3952
- children: /* @__PURE__ */ jsx17(ThumbnailUI_default, {
3953
- ref: rootRef,
3954
- className: className2,
3955
- errorFallback,
3956
- inputProps: passedInputProps,
3957
- renderLoading,
3958
- style: style2,
3959
- overflowVisible,
3960
- overrideInternalClassName,
3961
- noSuspense: Boolean(noSuspense)
3896
+ return /* @__PURE__ */ jsx16(Internals17.IsPlayerContextProvider, {
3897
+ children: /* @__PURE__ */ jsx16(Internals17.SetTimelineContext.Provider, {
3898
+ value: setTimelineContext,
3899
+ children: /* @__PURE__ */ jsx16(SharedPlayerContexts, {
3900
+ timelineContext: timelineState,
3901
+ playbackRateContext,
3902
+ component: Component,
3903
+ compositionHeight,
3904
+ compositionWidth,
3905
+ durationInFrames,
3906
+ fps,
3907
+ numberOfSharedAudioTags: 0,
3908
+ initiallyMuted: true,
3909
+ logLevel,
3910
+ audioLatencyHint: "playback",
3911
+ sampleRate: 48000,
3912
+ inputProps: passedInputProps,
3913
+ audioEnabled: false,
3914
+ _experimentalKeepAudioContextAlive: false,
3915
+ children: /* @__PURE__ */ jsx16(ThumbnailEmitterContext.Provider, {
3916
+ value: emitter,
3917
+ children: /* @__PURE__ */ jsx16(ThumbnailUI_default, {
3918
+ ref: rootRef,
3919
+ className: className2,
3920
+ errorFallback,
3921
+ inputProps: passedInputProps,
3922
+ renderLoading,
3923
+ style: style2,
3924
+ overflowVisible,
3925
+ overrideInternalClassName,
3926
+ noSuspense: Boolean(noSuspense)
3927
+ })
3962
3928
  })
3963
3929
  })
3964
3930
  })