@remotion/player 4.0.518 → 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,18 @@ 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();
1132
+ if (!muted && !audioContextFailed && sharedAudioContext?._experimentalKeepAudioContextAlive) {
1133
+ sharedAudioContext.resume();
1134
+ }
1210
1135
  startedTime = performance.now();
1211
1136
  framesAdvanced = 0;
1212
1137
  queueNextFrame();
@@ -1248,10 +1173,11 @@ var usePlayback = ({
1248
1173
  moveToBeginningWhenEnded,
1249
1174
  isBackgroundedRef,
1250
1175
  getCurrentFrame,
1251
- context,
1176
+ isBuffering,
1252
1177
  isPlaying,
1253
1178
  sharedAudioContext,
1254
1179
  setPlayerMuted,
1180
+ subscribeBuffering,
1255
1181
  logLevel,
1256
1182
  muted
1257
1183
  ]);
@@ -1275,7 +1201,7 @@ var usePlayback = ({
1275
1201
  };
1276
1202
 
1277
1203
  // src/utils/use-element-size.ts
1278
- 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";
1279
1205
  var elementSizeHooks = [];
1280
1206
  var updateAllElementsSizes = () => {
1281
1207
  for (const listener of elementSizeHooks) {
@@ -1312,7 +1238,7 @@ var useElementSize = (source, options) => {
1312
1238
  }
1313
1239
  };
1314
1240
  });
1315
- const observer = useMemo3(() => {
1241
+ const observer = useMemo2(() => {
1316
1242
  if (typeof ResizeObserver === "undefined") {
1317
1243
  return null;
1318
1244
  }
@@ -1404,7 +1330,7 @@ var useElementSize = (source, options) => {
1404
1330
  elementSizeHooks = elementSizeHooks.filter((e) => e !== updateSize);
1405
1331
  };
1406
1332
  }, [updateSize]);
1407
- return useMemo3(() => {
1333
+ return useMemo2(() => {
1408
1334
  if (!size) {
1409
1335
  return null;
1410
1336
  }
@@ -1413,16 +1339,17 @@ var useElementSize = (source, options) => {
1413
1339
  };
1414
1340
 
1415
1341
  // src/Player.tsx
1416
- import React14, {
1342
+ import React13, {
1417
1343
  forwardRef as forwardRef2,
1344
+ useCallback as useCallback12,
1418
1345
  useEffect as useEffect13,
1419
1346
  useImperativeHandle as useImperativeHandle2,
1420
1347
  useLayoutEffect as useLayoutEffect3,
1421
- useMemo as useMemo15,
1422
- useRef as useRef13,
1348
+ useMemo as useMemo14,
1349
+ useRef as useRef12,
1423
1350
  useState as useState12
1424
1351
  } from "react";
1425
- import { Composition, Internals as Internals17 } from "remotion";
1352
+ import { Composition, Internals as Internals15 } from "remotion";
1426
1353
 
1427
1354
  // src/player-css-classname.ts
1428
1355
  var playerCssClassname = (override) => {
@@ -1430,22 +1357,22 @@ var playerCssClassname = (override) => {
1430
1357
  };
1431
1358
 
1432
1359
  // src/PlayerUI.tsx
1433
- import React12, {
1360
+ import React11, {
1434
1361
  Suspense,
1435
1362
  forwardRef,
1436
1363
  useCallback as useCallback10,
1437
- useContext as useContext5,
1364
+ useContext as useContext4,
1438
1365
  useEffect as useEffect12,
1439
1366
  useImperativeHandle,
1440
- useMemo as useMemo13,
1441
- useRef as useRef11,
1367
+ useMemo as useMemo12,
1368
+ useRef as useRef10,
1442
1369
  useState as useState10
1443
1370
  } from "react";
1444
- import { Internals as Internals13 } from "remotion";
1371
+ import { Internals as Internals11 } from "remotion";
1445
1372
 
1446
1373
  // src/error-boundary.tsx
1447
- import React5 from "react";
1448
- import { jsx as jsx5 } from "react/jsx-runtime";
1374
+ import React4 from "react";
1375
+ import { jsx as jsx4 } from "react/jsx-runtime";
1449
1376
  var errorStyle = {
1450
1377
  display: "flex",
1451
1378
  justifyContent: "center",
@@ -1455,7 +1382,7 @@ var errorStyle = {
1455
1382
  width: "100%"
1456
1383
  };
1457
1384
 
1458
- class ErrorBoundary extends React5.Component {
1385
+ class ErrorBoundary extends React4.Component {
1459
1386
  state = { hasError: null };
1460
1387
  static getDerivedStateFromError(error) {
1461
1388
  return { hasError: error };
@@ -1465,7 +1392,7 @@ class ErrorBoundary extends React5.Component {
1465
1392
  }
1466
1393
  render() {
1467
1394
  if (this.state.hasError) {
1468
- return /* @__PURE__ */ jsx5("div", {
1395
+ return /* @__PURE__ */ jsx4("div", {
1469
1396
  style: errorStyle,
1470
1397
  children: this.props.errorFallback({
1471
1398
  error: this.state.hasError
@@ -1477,8 +1404,8 @@ class ErrorBoundary extends React5.Component {
1477
1404
  }
1478
1405
 
1479
1406
  // src/license-blacklist.tsx
1480
- import React6, { useEffect as useEffect7 } from "react";
1481
- 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";
1482
1409
  var getHashOfDomain = async () => {
1483
1410
  if (typeof window === "undefined") {
1484
1411
  return null;
@@ -1512,7 +1439,7 @@ var DOMAIN_BLACKLIST = [
1512
1439
  ];
1513
1440
  var ran = false;
1514
1441
  var RenderWarningIfBlacklist = () => {
1515
- const [unlicensed, setUnlicensed] = React6.useState(false);
1442
+ const [unlicensed, setUnlicensed] = React5.useState(false);
1516
1443
  useEffect7(() => {
1517
1444
  if (ran) {
1518
1445
  return;
@@ -1554,10 +1481,10 @@ var RenderWarningIfBlacklist = () => {
1554
1481
  if (!unlicensed) {
1555
1482
  return null;
1556
1483
  }
1557
- return /* @__PURE__ */ jsx6("div", {
1484
+ return /* @__PURE__ */ jsx5("div", {
1558
1485
  style,
1559
1486
  className: "warning-banner",
1560
- children: /* @__PURE__ */ jsx6("a", {
1487
+ children: /* @__PURE__ */ jsx5("a", {
1561
1488
  style: { color: "white" },
1562
1489
  href: "https://github.com/remotion-dev/remotion/pull/4589",
1563
1490
  children: "Remotion Unlicensed – Contact hi@remotion.dev"
@@ -1566,30 +1493,30 @@ var RenderWarningIfBlacklist = () => {
1566
1493
  };
1567
1494
 
1568
1495
  // src/PlayerControls.tsx
1569
- 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";
1570
1497
 
1571
1498
  // src/DefaultPlayPauseButton.tsx
1572
- import { jsx as jsx7 } from "react/jsx-runtime";
1499
+ import { jsx as jsx6 } from "react/jsx-runtime";
1573
1500
  var DefaultPlayPauseButton = ({ playing, buffering }) => {
1574
1501
  if (playing && buffering) {
1575
- return /* @__PURE__ */ jsx7(BufferingIndicator, {
1502
+ return /* @__PURE__ */ jsx6(BufferingIndicator, {
1576
1503
  type: "player"
1577
1504
  });
1578
1505
  }
1579
1506
  if (playing) {
1580
- return /* @__PURE__ */ jsx7(PauseIcon, {});
1507
+ return /* @__PURE__ */ jsx6(PauseIcon, {});
1581
1508
  }
1582
- return /* @__PURE__ */ jsx7(PlayIcon, {});
1509
+ return /* @__PURE__ */ jsx6(PlayIcon, {});
1583
1510
  };
1584
1511
 
1585
1512
  // src/MediaVolumeSlider.tsx
1586
- import { useCallback as useCallback4, useMemo as useMemo5, useRef as useRef6, useState as useState5 } from "react";
1587
- 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";
1588
1515
 
1589
1516
  // src/render-volume-slider.tsx
1590
- 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";
1591
1518
  import { random } from "remotion";
1592
- import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1519
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1593
1520
  var KNOB_SIZE = 12;
1594
1521
  var BAR_HEIGHT = 5;
1595
1522
  var DefaultVolumeSlider = ({
@@ -1599,7 +1526,7 @@ var DefaultVolumeSlider = ({
1599
1526
  inputRef,
1600
1527
  setVolume
1601
1528
  }) => {
1602
- const sliderContainer = useMemo4(() => {
1529
+ const sliderContainer = useMemo3(() => {
1603
1530
  const paddingLeft = 5;
1604
1531
  const common = {
1605
1532
  paddingLeft,
@@ -1619,12 +1546,12 @@ var DefaultVolumeSlider = ({
1619
1546
  ...common
1620
1547
  };
1621
1548
  }, [isVertical]);
1622
- const randomId = typeof React7.useId === "undefined" ? "volume-slider" : React7.useId();
1549
+ const randomId = typeof React6.useId === "undefined" ? "volume-slider" : React6.useId();
1623
1550
  const [randomClass] = useState4(() => `__remotion-volume-slider-${random(randomId)}`.replace(".", ""));
1624
1551
  const onVolumeChange = useCallback3((e) => {
1625
1552
  setVolume(parseFloat(e.target.value));
1626
1553
  }, [setVolume]);
1627
- const inputStyle = useMemo4(() => {
1554
+ const inputStyle = useMemo3(() => {
1628
1555
  const commonStyle = {
1629
1556
  WebkitAppearance: "none",
1630
1557
  backgroundColor: "rgba(255, 255, 255, 0.5)",
@@ -1667,12 +1594,12 @@ var DefaultVolumeSlider = ({
1667
1594
  return /* @__PURE__ */ jsxs3("div", {
1668
1595
  style: sliderContainer,
1669
1596
  children: [
1670
- /* @__PURE__ */ jsx8("style", {
1597
+ /* @__PURE__ */ jsx7("style", {
1671
1598
  dangerouslySetInnerHTML: {
1672
1599
  __html: sliderStyle
1673
1600
  }
1674
1601
  }),
1675
- /* @__PURE__ */ jsx8("input", {
1602
+ /* @__PURE__ */ jsx7("input", {
1676
1603
  ref: inputRef,
1677
1604
  "aria-label": "Change volume",
1678
1605
  className: randomClass,
@@ -1689,20 +1616,20 @@ var DefaultVolumeSlider = ({
1689
1616
  });
1690
1617
  };
1691
1618
  var renderDefaultVolumeSlider = (props) => {
1692
- return /* @__PURE__ */ jsx8(DefaultVolumeSlider, {
1619
+ return /* @__PURE__ */ jsx7(DefaultVolumeSlider, {
1693
1620
  ...props
1694
1621
  });
1695
1622
  };
1696
1623
 
1697
1624
  // src/MediaVolumeSlider.tsx
1698
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1625
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1699
1626
  var VOLUME_SLIDER_WIDTH = 100;
1700
1627
  var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
1701
- const [playerMuted, setPlayerMuted] = Internals9.usePlayerMutedState();
1702
- const [mediaVolume, setMediaVolume] = Internals9.useMediaVolumeState();
1628
+ const [playerMuted, setPlayerMuted] = Internals7.usePlayerMutedState();
1629
+ const [mediaVolume, setMediaVolume] = Internals7.useMediaVolumeState();
1703
1630
  const [focused, setFocused] = useState5(false);
1704
- const parentDivRef = useRef6(null);
1705
- const inputRef = useRef6(null);
1631
+ const parentDivRef = useRef5(null);
1632
+ const inputRef = useRef5(null);
1706
1633
  const hover = useHoverState(parentDivRef, false);
1707
1634
  const onBlur = useCallback4(() => {
1708
1635
  setTimeout(() => {
@@ -1720,7 +1647,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1720
1647
  }
1721
1648
  setPlayerMuted((mute) => !mute);
1722
1649
  }, [isVolume0, setPlayerMuted, setMediaVolume]);
1723
- const parentDivStyle = useMemo5(() => {
1650
+ const parentDivStyle = useMemo4(() => {
1724
1651
  return {
1725
1652
  display: "inline-flex",
1726
1653
  background: "none",
@@ -1731,7 +1658,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1731
1658
  ...displayVerticalVolumeSlider && { position: "relative" }
1732
1659
  };
1733
1660
  }, [displayVerticalVolumeSlider]);
1734
- const volumeContainer = useMemo5(() => {
1661
+ const volumeContainer = useMemo4(() => {
1735
1662
  return {
1736
1663
  display: "inline",
1737
1664
  width: ICON_SIZE,
@@ -1745,7 +1672,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1745
1672
  }, []);
1746
1673
  const renderDefaultMuteButton = useCallback4(({ muted, volume }) => {
1747
1674
  const isMutedOrZero = muted || volume === 0;
1748
- return /* @__PURE__ */ jsx9("button", {
1675
+ return /* @__PURE__ */ jsx8("button", {
1749
1676
  "aria-label": isMutedOrZero ? "Unmute sound" : "Mute sound",
1750
1677
  title: isMutedOrZero ? "Unmute sound" : "Mute sound",
1751
1678
  onClick,
@@ -1753,14 +1680,14 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1753
1680
  onFocus: () => setFocused(true),
1754
1681
  style: volumeContainer,
1755
1682
  type: "button",
1756
- children: isMutedOrZero ? /* @__PURE__ */ jsx9(VolumeOffIcon, {}) : /* @__PURE__ */ jsx9(VolumeOnIcon, {})
1683
+ children: isMutedOrZero ? /* @__PURE__ */ jsx8(VolumeOffIcon, {}) : /* @__PURE__ */ jsx8(VolumeOnIcon, {})
1757
1684
  });
1758
1685
  }, [onBlur, onClick, volumeContainer]);
1759
- const muteButton = useMemo5(() => {
1686
+ const muteButton = useMemo4(() => {
1760
1687
  return renderMuteButton ? renderMuteButton({ muted: playerMuted, volume: mediaVolume }) : renderDefaultMuteButton({ muted: playerMuted, volume: mediaVolume });
1761
1688
  }, [playerMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
1762
- const volumeSlider = useMemo5(() => {
1763
- return (focused || hover) && !playerMuted && !Internals9.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
1689
+ const volumeSlider = useMemo4(() => {
1690
+ return (focused || hover) && !playerMuted && !Internals7.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
1764
1691
  isVertical: displayVerticalVolumeSlider,
1765
1692
  volume: mediaVolume,
1766
1693
  onBlur: () => setFocused(false),
@@ -1787,14 +1714,14 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
1787
1714
  };
1788
1715
 
1789
1716
  // src/PlaybackrateControl.tsx
1790
- import { useCallback as useCallback5, useEffect as useEffect9, useMemo as useMemo6, useState as useState7 } from "react";
1791
- 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";
1792
1719
 
1793
1720
  // src/utils/use-component-visible.ts
1794
- 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";
1795
1722
  function useComponentVisible(initialIsVisible) {
1796
1723
  const [isComponentVisible, setIsComponentVisible] = useState6(initialIsVisible);
1797
- const ref = useRef7(null);
1724
+ const ref = useRef6(null);
1798
1725
  useEffect8(() => {
1799
1726
  const handleClickOutside = (event) => {
1800
1727
  if (ref.current && !ref.current.contains(event.target)) {
@@ -1810,7 +1737,7 @@ function useComponentVisible(initialIsVisible) {
1810
1737
  }
1811
1738
 
1812
1739
  // src/PlaybackrateControl.tsx
1813
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1740
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1814
1741
  var BOTTOM = 35;
1815
1742
  var THRESHOLD = 70;
1816
1743
  var rateDiv = {
@@ -1831,10 +1758,10 @@ var checkmarkStyle = {
1831
1758
  height: 14,
1832
1759
  color: "black"
1833
1760
  };
1834
- var Checkmark = () => /* @__PURE__ */ jsx10("svg", {
1761
+ var Checkmark = () => /* @__PURE__ */ jsx9("svg", {
1835
1762
  viewBox: "0 0 512 512",
1836
1763
  style: checkmarkStyle,
1837
- children: /* @__PURE__ */ jsx10("path", {
1764
+ children: /* @__PURE__ */ jsx9("path", {
1838
1765
  fill: "currentColor",
1839
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"
1840
1767
  })
@@ -1857,7 +1784,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
1857
1784
  setHovered(false);
1858
1785
  }, []);
1859
1786
  const isFocused = keyboardSelectedRate === rate;
1860
- const actualStyle = useMemo6(() => {
1787
+ const actualStyle = useMemo5(() => {
1861
1788
  return {
1862
1789
  ...rateDiv,
1863
1790
  backgroundColor: hovered || isFocused ? "#eee" : "transparent"
@@ -1870,9 +1797,9 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
1870
1797
  style: actualStyle,
1871
1798
  onClick,
1872
1799
  children: [
1873
- /* @__PURE__ */ jsx10("div", {
1800
+ /* @__PURE__ */ jsx9("div", {
1874
1801
  style: checkmarkContainer,
1875
- children: rate === selectedRate ? /* @__PURE__ */ jsx10(Checkmark, {}) : null
1802
+ children: rate === selectedRate ? /* @__PURE__ */ jsx9(Checkmark, {}) : null
1876
1803
  }),
1877
1804
  formatPlaybackRate(rate),
1878
1805
  "x"
@@ -1880,7 +1807,7 @@ var PlaybackrateOption = ({ rate, onSelect, selectedRate, keyboardSelectedRate }
1880
1807
  }, rate);
1881
1808
  };
1882
1809
  var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1883
- const { setPlaybackRate, playbackRate } = Internals10.usePlaybackRate();
1810
+ const { setPlaybackRate, playbackRate } = Internals8.usePlaybackRate();
1884
1811
  const [keyboardSelectedRate, setKeyboardSelectedRate] = useState7(playbackRate);
1885
1812
  useEffect9(() => {
1886
1813
  const listener = (e) => {
@@ -1924,7 +1851,7 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1924
1851
  setPlaybackRate(rate);
1925
1852
  setIsComponentVisible(false);
1926
1853
  }, [setIsComponentVisible, setPlaybackRate]);
1927
- const playbackPopup = useMemo6(() => {
1854
+ const playbackPopup = useMemo5(() => {
1928
1855
  return {
1929
1856
  position: "absolute",
1930
1857
  right: 0,
@@ -1938,10 +1865,10 @@ var PlaybackPopup = ({ setIsComponentVisible, playbackRates, canvasSize }) => {
1938
1865
  textAlign: "left"
1939
1866
  };
1940
1867
  }, [canvasSize.height]);
1941
- return /* @__PURE__ */ jsx10("div", {
1868
+ return /* @__PURE__ */ jsx9("div", {
1942
1869
  style: playbackPopup,
1943
1870
  children: playbackRates.map((rate) => {
1944
- return /* @__PURE__ */ jsx10(PlaybackrateOption, {
1871
+ return /* @__PURE__ */ jsx9(PlaybackrateOption, {
1945
1872
  selectedRate: playbackRate,
1946
1873
  onSelect,
1947
1874
  rate,
@@ -1982,13 +1909,13 @@ var button = {
1982
1909
  };
1983
1910
  var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
1984
1911
  const { ref, isComponentVisible, setIsComponentVisible } = useComponentVisible(false);
1985
- const { playbackRate } = Internals10.usePlaybackRate();
1912
+ const { playbackRate } = Internals8.usePlaybackRate();
1986
1913
  const onClick = useCallback5((e) => {
1987
1914
  e.stopPropagation();
1988
1915
  e.preventDefault();
1989
1916
  setIsComponentVisible((prevIsComponentVisible) => !prevIsComponentVisible);
1990
1917
  }, [setIsComponentVisible]);
1991
- return /* @__PURE__ */ jsx10("div", {
1918
+ return /* @__PURE__ */ jsx9("div", {
1992
1919
  ref,
1993
1920
  children: /* @__PURE__ */ jsxs5("button", {
1994
1921
  type: "button",
@@ -2003,7 +1930,7 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
2003
1930
  "x"
2004
1931
  ]
2005
1932
  }),
2006
- isComponentVisible && /* @__PURE__ */ jsx10(PlaybackPopup, {
1933
+ isComponentVisible && /* @__PURE__ */ jsx9(PlaybackPopup, {
2007
1934
  canvasSize,
2008
1935
  playbackRates,
2009
1936
  setIsComponentVisible
@@ -2014,9 +1941,9 @@ var PlaybackrateControl = ({ playbackRates, canvasSize }) => {
2014
1941
  };
2015
1942
 
2016
1943
  // src/PlayerSeekBar.tsx
2017
- import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef8, useState as useState8 } from "react";
2018
- import { Internals as Internals11, interpolate } from "remotion";
2019
- 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";
2020
1947
  var getFrameFromX = (clientX, durationInFrames, width) => {
2021
1948
  const pos = clientX;
2022
1949
  const frame = Math.round(interpolate(pos, [0, width], [0, durationInFrames - 1], {
@@ -2052,14 +1979,14 @@ var findBodyInWhichDivIsLocated = (div) => {
2052
1979
  return current;
2053
1980
  };
2054
1981
  var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFrame }) => {
2055
- const containerRef = useRef8(null);
1982
+ const containerRef = useRef7(null);
2056
1983
  const barHovered = useHoverState(containerRef, false);
2057
1984
  const size = useElementSize(containerRef, {
2058
1985
  triggerOnWindowResize: true,
2059
1986
  shouldApplyCssTransforms: true
2060
1987
  });
2061
1988
  const { seek, play, pause, isPlaying } = usePlayerMethods();
2062
- const frame = Internals11.Timeline.useTimelinePosition();
1989
+ const frame = Internals9.Timeline.useTimelinePosition();
2063
1990
  const [dragging, setDragging] = useState8({
2064
1991
  dragging: false
2065
1992
  });
@@ -2116,7 +2043,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2116
2043
  body.removeEventListener("pointerup", onPointerUp);
2117
2044
  };
2118
2045
  }, [dragging.dragging, onPointerMove, onPointerUp]);
2119
- const knobStyle = useMemo7(() => {
2046
+ const knobStyle = useMemo6(() => {
2120
2047
  return {
2121
2048
  height: KNOB_SIZE2,
2122
2049
  width: KNOB_SIZE2,
@@ -2129,7 +2056,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2129
2056
  opacity: Number(barHovered || dragging.dragging)
2130
2057
  };
2131
2058
  }, [barHovered, dragging.dragging, durationInFrames, frame, width]);
2132
- const fillStyle = useMemo7(() => {
2059
+ const fillStyle = useMemo6(() => {
2133
2060
  return {
2134
2061
  height: BAR_HEIGHT2,
2135
2062
  backgroundColor: "rgba(255, 255, 255, 1)",
@@ -2138,7 +2065,7 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2138
2065
  borderRadius: BAR_HEIGHT2 / 2
2139
2066
  };
2140
2067
  }, [durationInFrames, frame, inFrame, width]);
2141
- const active = useMemo7(() => {
2068
+ const active = useMemo6(() => {
2142
2069
  return {
2143
2070
  height: BAR_HEIGHT2,
2144
2071
  backgroundColor: "rgba(255, 255, 255, 0.25)",
@@ -2156,15 +2083,15 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2156
2083
  /* @__PURE__ */ jsxs6("div", {
2157
2084
  style: barBackground,
2158
2085
  children: [
2159
- /* @__PURE__ */ jsx11("div", {
2086
+ /* @__PURE__ */ jsx10("div", {
2160
2087
  style: active
2161
2088
  }),
2162
- /* @__PURE__ */ jsx11("div", {
2089
+ /* @__PURE__ */ jsx10("div", {
2163
2090
  style: fillStyle
2164
2091
  })
2165
2092
  ]
2166
2093
  }),
2167
- /* @__PURE__ */ jsx11("div", {
2094
+ /* @__PURE__ */ jsx10("div", {
2168
2095
  style: knobStyle
2169
2096
  })
2170
2097
  ]
@@ -2172,8 +2099,8 @@ var PlayerSeekBar = ({ durationInFrames, onSeekEnd, onSeekStart, inFrame, outFra
2172
2099
  };
2173
2100
 
2174
2101
  // src/PlayerTimeLabel.tsx
2175
- import { useMemo as useMemo8 } from "react";
2176
- import { Internals as Internals12 } from "remotion";
2102
+ import { useMemo as useMemo7 } from "react";
2103
+ import { Internals as Internals10 } from "remotion";
2177
2104
 
2178
2105
  // src/format-time.ts
2179
2106
  var formatTime = (timeInSeconds) => {
@@ -2185,8 +2112,8 @@ var formatTime = (timeInSeconds) => {
2185
2112
  // src/PlayerTimeLabel.tsx
2186
2113
  import { jsxs as jsxs7 } from "react/jsx-runtime";
2187
2114
  var PlayerTimeLabel = ({ durationInFrames, maxTimeLabelWidth, fps }) => {
2188
- const frame = Internals12.Timeline.useTimelinePosition();
2189
- const timeLabel = useMemo8(() => {
2115
+ const frame = Internals10.Timeline.useTimelinePosition();
2116
+ const timeLabel = useMemo7(() => {
2190
2117
  return {
2191
2118
  color: "white",
2192
2119
  fontFamily: "sans-serif",
@@ -2209,14 +2136,14 @@ var PlayerTimeLabel = ({ durationInFrames, maxTimeLabelWidth, fps }) => {
2209
2136
  };
2210
2137
 
2211
2138
  // src/use-video-controls-resize.ts
2212
- import { useMemo as useMemo9 } from "react";
2139
+ import { useMemo as useMemo8 } from "react";
2213
2140
  var X_SPACER = 10;
2214
2141
  var X_PADDING = 12;
2215
2142
  var useVideoControlsResize = ({
2216
2143
  allowFullscreen: allowFullScreen,
2217
2144
  playerWidth
2218
2145
  }) => {
2219
- const resizeInfo = useMemo9(() => {
2146
+ const resizeInfo = useMemo8(() => {
2220
2147
  const playPauseIconSize = ICON_SIZE;
2221
2148
  const volumeIconSize = ICON_SIZE;
2222
2149
  const _fullscreenIconSize = allowFullScreen ? fullscreenIconSize : 0;
@@ -2236,7 +2163,7 @@ var useVideoControlsResize = ({
2236
2163
  };
2237
2164
 
2238
2165
  // src/PlayerControls.tsx
2239
- 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";
2240
2167
  var gradientSteps = [
2241
2168
  0,
2242
2169
  0.013,
@@ -2345,7 +2272,7 @@ var Controls = ({
2345
2272
  toggle,
2346
2273
  renderCustomControls
2347
2274
  }) => {
2348
- const playButtonRef = useRef9(null);
2275
+ const playButtonRef = useRef8(null);
2349
2276
  const [supportsFullscreen, setSupportsFullscreen] = useState9(false);
2350
2277
  const hovered = useHoverState(containerRef, hideControlsWhenPointerDoesntMove);
2351
2278
  const { maxTimeLabelWidth, displayVerticalVolumeSlider } = useVideoControlsResize({
@@ -2373,7 +2300,7 @@ var Controls = ({
2373
2300
  }
2374
2301
  throw new TypeError("initiallyShowControls must be a number or a boolean");
2375
2302
  });
2376
- const containerCss = useMemo10(() => {
2303
+ const containerCss = useMemo9(() => {
2377
2304
  const shouldShow = hovered || !playing || shouldShowInitially || alwaysShowControls;
2378
2305
  return {
2379
2306
  ...containerStyle2,
@@ -2402,7 +2329,7 @@ var Controls = ({
2402
2329
  clearInterval(timeout);
2403
2330
  };
2404
2331
  }, [shouldShowInitially]);
2405
- const playbackRates = useMemo10(() => {
2332
+ const playbackRates = useMemo9(() => {
2406
2333
  if (showPlaybackRateControl === true) {
2407
2334
  return [0.5, 0.8, 1, 1.2, 1.5, 1.8, 2, 2.5, 3];
2408
2335
  }
@@ -2420,8 +2347,8 @@ var Controls = ({
2420
2347
  return null;
2421
2348
  }, [showPlaybackRateControl]);
2422
2349
  const customControlsElement = renderCustomControls ? renderCustomControls() : null;
2423
- const ref = useRef9(null);
2424
- const flexRef = useRef9(null);
2350
+ const ref = useRef8(null);
2351
+ const flexRef = useRef8(null);
2425
2352
  const onPointerDownIfContainer = useCallback7((e) => {
2426
2353
  if (e.target === ref.current || e.target === flexRef.current) {
2427
2354
  onPointerDown?.(e);
@@ -2445,82 +2372,82 @@ var Controls = ({
2445
2372
  /* @__PURE__ */ jsxs8("div", {
2446
2373
  style: leftPartStyle,
2447
2374
  children: [
2448
- /* @__PURE__ */ jsx12("button", {
2375
+ /* @__PURE__ */ jsx11("button", {
2449
2376
  ref: playButtonRef,
2450
2377
  type: "button",
2451
2378
  style: playerButtonStyle,
2452
2379
  onClick: toggle,
2453
2380
  "aria-label": playing ? "Pause video" : "Play video",
2454
2381
  title: playing ? "Pause video" : "Play video",
2455
- children: renderPlayPauseButton === null ? /* @__PURE__ */ jsx12(DefaultPlayPauseButton, {
2382
+ children: renderPlayPauseButton === null ? /* @__PURE__ */ jsx11(DefaultPlayPauseButton, {
2456
2383
  buffering,
2457
2384
  playing
2458
2385
  }) : renderPlayPauseButton({
2459
2386
  playing,
2460
2387
  isBuffering: buffering
2461
- }) ?? /* @__PURE__ */ jsx12(DefaultPlayPauseButton, {
2388
+ }) ?? /* @__PURE__ */ jsx11(DefaultPlayPauseButton, {
2462
2389
  buffering,
2463
2390
  playing
2464
2391
  })
2465
2392
  }),
2466
2393
  showVolumeControls ? /* @__PURE__ */ jsxs8(Fragment2, {
2467
2394
  children: [
2468
- /* @__PURE__ */ jsx12("div", {
2395
+ /* @__PURE__ */ jsx11("div", {
2469
2396
  style: xSpacer
2470
2397
  }),
2471
- /* @__PURE__ */ jsx12(MediaVolumeSlider, {
2398
+ /* @__PURE__ */ jsx11(MediaVolumeSlider, {
2472
2399
  renderMuteButton,
2473
2400
  renderVolumeSlider,
2474
2401
  displayVerticalVolumeSlider
2475
2402
  })
2476
2403
  ]
2477
2404
  }) : null,
2478
- /* @__PURE__ */ jsx12("div", {
2405
+ /* @__PURE__ */ jsx11("div", {
2479
2406
  style: xSpacer
2480
2407
  }),
2481
- /* @__PURE__ */ jsx12(PlayerTimeLabel, {
2408
+ /* @__PURE__ */ jsx11(PlayerTimeLabel, {
2482
2409
  durationInFrames,
2483
2410
  fps,
2484
2411
  maxTimeLabelWidth
2485
2412
  }),
2486
- /* @__PURE__ */ jsx12("div", {
2413
+ /* @__PURE__ */ jsx11("div", {
2487
2414
  style: xSpacer
2488
2415
  })
2489
2416
  ]
2490
2417
  }),
2491
- /* @__PURE__ */ jsx12("div", {
2418
+ /* @__PURE__ */ jsx11("div", {
2492
2419
  style: flex1
2493
2420
  }),
2494
2421
  customControlsElement,
2495
- customControlsElement && playbackRates && canvasSize ? /* @__PURE__ */ jsx12("div", {
2422
+ customControlsElement && playbackRates && canvasSize ? /* @__PURE__ */ jsx11("div", {
2496
2423
  style: xSpacer
2497
2424
  }) : null,
2498
- playbackRates && canvasSize && /* @__PURE__ */ jsx12(PlaybackrateControl, {
2425
+ playbackRates && canvasSize && /* @__PURE__ */ jsx11(PlaybackrateControl, {
2499
2426
  canvasSize,
2500
2427
  playbackRates
2501
2428
  }),
2502
- playbackRates && supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx12("div", {
2429
+ playbackRates && supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx11("div", {
2503
2430
  style: xSpacer
2504
2431
  }) : null,
2505
- /* @__PURE__ */ jsx12("div", {
2432
+ /* @__PURE__ */ jsx11("div", {
2506
2433
  style: fullscreen,
2507
- children: supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx12("button", {
2434
+ children: supportsFullscreen && allowFullscreen ? /* @__PURE__ */ jsx11("button", {
2508
2435
  type: "button",
2509
2436
  "aria-label": isFullscreen ? "Exit fullscreen" : "Enter Fullscreen",
2510
2437
  title: isFullscreen ? "Exit fullscreen" : "Enter Fullscreen",
2511
2438
  style: playerButtonStyle,
2512
2439
  onClick: isFullscreen ? onExitFullscreenButtonClick : onFullscreenButtonClick,
2513
- children: renderFullscreenButton === null ? /* @__PURE__ */ jsx12(FullscreenIcon, {
2440
+ children: renderFullscreenButton === null ? /* @__PURE__ */ jsx11(FullscreenIcon, {
2514
2441
  isFullscreen
2515
2442
  }) : renderFullscreenButton({ isFullscreen })
2516
2443
  }) : null
2517
2444
  })
2518
2445
  ]
2519
2446
  }),
2520
- /* @__PURE__ */ jsx12("div", {
2447
+ /* @__PURE__ */ jsx11("div", {
2521
2448
  style: ySpacer
2522
2449
  }),
2523
- /* @__PURE__ */ jsx12(PlayerSeekBar, {
2450
+ /* @__PURE__ */ jsx11(PlayerSeekBar, {
2524
2451
  onSeekEnd,
2525
2452
  onSeekStart,
2526
2453
  durationInFrames,
@@ -2535,7 +2462,7 @@ var Controls = ({
2535
2462
  var IS_NODE = typeof document === "undefined";
2536
2463
 
2537
2464
  // src/utils/use-click-prevention-on-double-click.ts
2538
- import { useCallback as useCallback9, useMemo as useMemo12 } from "react";
2465
+ import { useCallback as useCallback9, useMemo as useMemo11 } from "react";
2539
2466
 
2540
2467
  // src/utils/cancellable-promise.ts
2541
2468
  var cancellablePromise = (promise) => {
@@ -2563,9 +2490,9 @@ var cancellablePromise = (promise) => {
2563
2490
  var delay = (n) => new Promise((resolve) => setTimeout(resolve, n));
2564
2491
 
2565
2492
  // src/utils/use-cancellable-promises.ts
2566
- 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";
2567
2494
  var useCancellablePromises = () => {
2568
- const pendingPromises = useRef10([]);
2495
+ const pendingPromises = useRef9([]);
2569
2496
  const appendPendingPromise = useCallback8((promise) => {
2570
2497
  pendingPromises.current = [...pendingPromises.current, promise];
2571
2498
  }, []);
@@ -2573,7 +2500,7 @@ var useCancellablePromises = () => {
2573
2500
  pendingPromises.current = pendingPromises.current.filter((p) => p !== promise);
2574
2501
  }, []);
2575
2502
  const clearPendingPromises = useCallback8(() => pendingPromises.current.map((p) => p.cancel()), []);
2576
- const api = useMemo11(() => ({
2503
+ const api = useMemo10(() => ({
2577
2504
  appendPendingPromise,
2578
2505
  removePendingPromise,
2579
2506
  clearPendingPromises
@@ -2615,7 +2542,7 @@ var useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFull
2615
2542
  api.clearPendingPromises();
2616
2543
  onDoubleClick();
2617
2544
  }, [api, onDoubleClick]);
2618
- const returnValue = useMemo12(() => {
2545
+ const returnValue = useMemo11(() => {
2619
2546
  if (!doubleClickToFullscreen) {
2620
2547
  return { handlePointerDown: onClick, handleDoubleClick: () => {
2621
2548
  return;
@@ -2627,8 +2554,8 @@ var useClickPreventionOnDoubleClick = (onClick, onDoubleClick, doubleClickToFull
2627
2554
  };
2628
2555
 
2629
2556
  // src/PlayerUI.tsx
2630
- import { jsx as jsx13, jsxs as jsxs9, Fragment as Fragment3 } from "react/jsx-runtime";
2631
- 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];
2632
2559
  if (reactVersion === "0") {
2633
2560
  throw new Error(`Version ${reactVersion} of "react" is not supported by Remotion`);
2634
2561
  }
@@ -2673,9 +2600,9 @@ var PlayerUI = ({
2673
2600
  overrideInternalClassName,
2674
2601
  noSuspense
2675
2602
  }, ref) => {
2676
- const config = Internals13.useUnsafeVideoConfig();
2677
- const video = Internals13.useVideo();
2678
- const container = useRef11(null);
2603
+ const config = Internals11.useUnsafeVideoConfig();
2604
+ const video = Internals11.useVideo();
2605
+ const container = useRef10(null);
2679
2606
  const canvasSize = useElementSize(container, {
2680
2607
  triggerOnWindowResize: false,
2681
2608
  shouldApplyCssTransforms: false
@@ -2685,15 +2612,15 @@ var PlayerUI = ({
2685
2612
  const [isFullscreen, setIsFullscreen] = useState10(() => false);
2686
2613
  const [seeking, setSeeking] = useState10(false);
2687
2614
  const [hasPlayed, setHasPlayed] = useState10(false);
2688
- const supportsFullScreen = useMemo13(() => {
2615
+ const supportsFullScreen = useMemo12(() => {
2689
2616
  if (typeof document === "undefined") {
2690
2617
  return false;
2691
2618
  }
2692
2619
  return Boolean(document.fullscreenEnabled || document.webkitFullscreenEnabled);
2693
2620
  }, []);
2694
2621
  const player = usePlayerMethods();
2695
- const [playing] = Internals13.Timeline.usePlayingState();
2696
- const frame = Internals13.Timeline.useTimelinePosition();
2622
+ const playing = Internals11.usePlaying();
2623
+ const frame = Internals11.Timeline.useTimelinePosition();
2697
2624
  const play = useCallback10((e) => {
2698
2625
  if (player.isPlaying()) {
2699
2626
  return;
@@ -2701,7 +2628,7 @@ var PlayerUI = ({
2701
2628
  setHasPlayed(true);
2702
2629
  player.play(e);
2703
2630
  }, [player]);
2704
- const { playerMuted, mediaVolume } = useContext5(Internals13.MediaVolumeContext);
2631
+ const { playerMuted, mediaVolume } = useContext4(Internals11.MediaVolumeContext);
2705
2632
  useEffect12(() => {
2706
2633
  player.emitter.dispatchVolumeChange(mediaVolume);
2707
2634
  }, [player.emitter, mediaVolume]);
@@ -2798,7 +2725,7 @@ var PlayerUI = ({
2798
2725
  };
2799
2726
  }, [player.emitter]);
2800
2727
  const durationInFrames = config?.durationInFrames ?? 1;
2801
- const layout = useMemo13(() => {
2728
+ const layout = useMemo12(() => {
2802
2729
  if (!config || !canvasSize) {
2803
2730
  return null;
2804
2731
  }
@@ -2810,7 +2737,7 @@ var PlayerUI = ({
2810
2737
  });
2811
2738
  }, [canvasSize, config]);
2812
2739
  const scale = layout?.scale ?? 1;
2813
- const initialScaleIgnored = useRef11(false);
2740
+ const initialScaleIgnored = useRef10(false);
2814
2741
  useEffect12(() => {
2815
2742
  if (!initialScaleIgnored.current) {
2816
2743
  initialScaleIgnored.current = true;
@@ -2818,7 +2745,7 @@ var PlayerUI = ({
2818
2745
  }
2819
2746
  player.emitter.dispatchScaleChange(scale);
2820
2747
  }, [player.emitter, scale]);
2821
- const { setMediaVolume, setPlayerMuted } = useContext5(Internals13.SetMediaVolumeContext);
2748
+ const { setMediaVolume, setPlayerMuted } = useContext4(Internals11.SetMediaVolumeContext);
2822
2749
  const [showBufferIndicator, setShowBufferState] = useState10(false);
2823
2750
  useEffect12(() => {
2824
2751
  let timeout = null;
@@ -2938,7 +2865,7 @@ var PlayerUI = ({
2938
2865
  scale
2939
2866
  ]);
2940
2867
  const VideoComponent = video ? video.component : null;
2941
- const outerStyle = useMemo13(() => {
2868
+ const outerStyle = useMemo12(() => {
2942
2869
  return calculateOuterStyle({
2943
2870
  canvasSize,
2944
2871
  config,
@@ -2947,10 +2874,10 @@ var PlayerUI = ({
2947
2874
  layout
2948
2875
  });
2949
2876
  }, [canvasSize, config, layout, overflowVisible, style2]);
2950
- const outer = useMemo13(() => {
2877
+ const outer = useMemo12(() => {
2951
2878
  return calculateOuter({ config, layout, scale, overflowVisible });
2952
2879
  }, [config, layout, overflowVisible, scale]);
2953
- const containerStyle3 = useMemo13(() => {
2880
+ const containerStyle3 = useMemo12(() => {
2954
2881
  return calculateContainerStyle({
2955
2882
  config,
2956
2883
  layout,
@@ -2999,14 +2926,14 @@ var PlayerUI = ({
2999
2926
  setShouldAutoPlay(false);
3000
2927
  }
3001
2928
  }, [play, shouldAutoplay]);
3002
- const loadingMarkup = useMemo13(() => {
2929
+ const loadingMarkup = useMemo12(() => {
3003
2930
  return renderLoading ? renderLoading({
3004
2931
  height: outerStyle.height,
3005
2932
  width: outerStyle.width,
3006
2933
  isBuffering: showBufferIndicator
3007
2934
  }) : null;
3008
2935
  }, [outerStyle.height, outerStyle.width, renderLoading, showBufferIndicator]);
3009
- const currentScale = useMemo13(() => {
2936
+ const currentScale = useMemo12(() => {
3010
2937
  return {
3011
2938
  type: "scale",
3012
2939
  scale
@@ -3024,11 +2951,11 @@ var PlayerUI = ({
3024
2951
  throw new TypeError("renderPoster() must return a React element, but undefined was returned");
3025
2952
  }
3026
2953
  const shouldShowPoster = poster && [
3027
- showPosterWhenPaused && !player.isPlaying() && !seeking,
3028
- showPosterWhenEnded && frame === durationInFrames - 1 && !player.isPlaying(),
3029
- showPosterWhenUnplayed && !hasPlayed && !player.isPlaying(),
3030
- showPosterWhenBuffering && showBufferIndicator && player.isPlaying(),
3031
- 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
3032
2959
  ].some(Boolean);
3033
2960
  const { left, top, width, height, ...outerWithoutScale } = outer;
3034
2961
  const content = /* @__PURE__ */ jsxs9(Fragment3, {
@@ -3042,18 +2969,18 @@ var PlayerUI = ({
3042
2969
  style: containerStyle3,
3043
2970
  className: playerCssClassname(overrideInternalClassName),
3044
2971
  children: [
3045
- VideoComponent ? /* @__PURE__ */ jsx13(ErrorBoundary, {
2972
+ VideoComponent ? /* @__PURE__ */ jsx12(ErrorBoundary, {
3046
2973
  onError,
3047
2974
  errorFallback,
3048
- children: /* @__PURE__ */ jsx13(Internals13.CurrentScaleContext.Provider, {
2975
+ children: /* @__PURE__ */ jsx12(Internals11.CurrentScaleContext.Provider, {
3049
2976
  value: currentScale,
3050
- children: /* @__PURE__ */ jsx13(VideoComponent, {
2977
+ children: /* @__PURE__ */ jsx12(VideoComponent, {
3051
2978
  ...video?.props ?? {},
3052
2979
  ...inputProps ?? {}
3053
2980
  })
3054
2981
  })
3055
2982
  }) : null,
3056
- shouldShowPoster && posterFillMode === "composition-size" ? /* @__PURE__ */ jsx13("div", {
2983
+ shouldShowPoster && posterFillMode === "composition-size" ? /* @__PURE__ */ jsx12("div", {
3057
2984
  style: {
3058
2985
  ...outerWithoutScale,
3059
2986
  width: config.width,
@@ -3065,16 +2992,16 @@ var PlayerUI = ({
3065
2992
  }) : null
3066
2993
  ]
3067
2994
  }),
3068
- /* @__PURE__ */ jsx13(RenderWarningIfBlacklist, {})
2995
+ /* @__PURE__ */ jsx12(RenderWarningIfBlacklist, {})
3069
2996
  ]
3070
2997
  }),
3071
- shouldShowPoster && posterFillMode === "player-size" ? /* @__PURE__ */ jsx13("div", {
2998
+ shouldShowPoster && posterFillMode === "player-size" ? /* @__PURE__ */ jsx12("div", {
3072
2999
  style: outer,
3073
3000
  onPointerDown: clickToPlay ? handlePointerDown : undefined,
3074
3001
  onDoubleClick: doubleClickToFullscreen ? handleDoubleClick : undefined,
3075
3002
  children: poster
3076
3003
  }) : null,
3077
- controls ? /* @__PURE__ */ jsx13(Controls, {
3004
+ controls ? /* @__PURE__ */ jsx12(Controls, {
3078
3005
  fps: config.fps,
3079
3006
  playing,
3080
3007
  toggle,
@@ -3107,18 +3034,18 @@ var PlayerUI = ({
3107
3034
  ]
3108
3035
  });
3109
3036
  if (noSuspense || IS_NODE && !doesReactVersionSupportSuspense) {
3110
- return /* @__PURE__ */ jsx13("div", {
3037
+ return /* @__PURE__ */ jsx12("div", {
3111
3038
  ref: container,
3112
3039
  style: outerStyle,
3113
3040
  className: className2,
3114
3041
  children: content
3115
3042
  });
3116
3043
  }
3117
- return /* @__PURE__ */ jsx13("div", {
3044
+ return /* @__PURE__ */ jsx12("div", {
3118
3045
  ref: container,
3119
3046
  style: outerStyle,
3120
3047
  className: className2,
3121
- children: /* @__PURE__ */ jsx13(Suspense, {
3048
+ children: /* @__PURE__ */ jsx12(Suspense, {
3122
3049
  fallback: loadingMarkup,
3123
3050
  children: content
3124
3051
  })
@@ -3127,11 +3054,11 @@ var PlayerUI = ({
3127
3054
  var PlayerUI_default = forwardRef(PlayerUI);
3128
3055
 
3129
3056
  // src/SharedPlayerContext.tsx
3130
- import { useCallback as useCallback11, useMemo as useMemo14, useRef as useRef12, useState as useState11 } from "react";
3131
- 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";
3132
3059
 
3133
3060
  // src/volume-persistence.ts
3134
- import { Internals as Internals14 } from "remotion";
3061
+ import { Internals as Internals12 } from "remotion";
3135
3062
  var DEFAULT_VOLUME_PERSISTENCE_KEY = "remotion.volumePreference";
3136
3063
  var persistVolume = (volume, logLevel, volumePersistenceKey) => {
3137
3064
  if (typeof window === "undefined") {
@@ -3140,7 +3067,7 @@ var persistVolume = (volume, logLevel, volumePersistenceKey) => {
3140
3067
  try {
3141
3068
  window.localStorage.setItem(volumePersistenceKey ?? DEFAULT_VOLUME_PERSISTENCE_KEY, String(volume));
3142
3069
  } catch (e) {
3143
- Internals14.Log.error({ logLevel, tag: null }, "Could not persist volume", e);
3070
+ Internals12.Log.error({ logLevel, tag: null }, "Could not persist volume", e);
3144
3071
  }
3145
3072
  };
3146
3073
  var getPreferredVolume = (volumePersistenceKey) => {
@@ -3156,7 +3083,7 @@ var getPreferredVolume = (volumePersistenceKey) => {
3156
3083
  };
3157
3084
 
3158
3085
  // src/SharedPlayerContext.tsx
3159
- import { jsx as jsx14 } from "react/jsx-runtime";
3086
+ import { jsx as jsx13 } from "react/jsx-runtime";
3160
3087
  var PLAYER_COMP_ID = "player-comp";
3161
3088
  var SharedPlayerContexts = ({
3162
3089
  children,
@@ -3179,7 +3106,7 @@ var SharedPlayerContexts = ({
3179
3106
  _experimentalKeepAudioContextAlive
3180
3107
  }) => {
3181
3108
  const persistVolumeToStorage = initialVolume === undefined;
3182
- const compositionManagerContext = useMemo14(() => {
3109
+ const compositionManagerContext = useMemo13(() => {
3183
3110
  const context = {
3184
3111
  compositions: [
3185
3112
  {
@@ -3189,7 +3116,7 @@ var SharedPlayerContexts = ({
3189
3116
  width: compositionWidth,
3190
3117
  fps,
3191
3118
  id: PLAYER_COMP_ID,
3192
- nonce: [[0, 777]],
3119
+ order: null,
3193
3120
  folderName: null,
3194
3121
  parentFolderName: null,
3195
3122
  schema: null,
@@ -3225,13 +3152,13 @@ var SharedPlayerContexts = ({
3225
3152
  ]);
3226
3153
  const [playerMuted, setPlayerMuted] = useState11(() => initiallyMuted);
3227
3154
  const [mediaVolume, setMediaVolume] = useState11(() => persistVolumeToStorage ? getPreferredVolume(volumePersistenceKey ?? null) : initialVolume);
3228
- const mediaVolumeContextValue = useMemo14(() => {
3155
+ const mediaVolumeContextValue = useMemo13(() => {
3229
3156
  return {
3230
3157
  playerMuted,
3231
3158
  mediaVolume
3232
3159
  };
3233
3160
  }, [playerMuted, mediaVolume]);
3234
- const audioContextWasCreated = useRef12(false);
3161
+ const audioContextWasCreated = useRef11(false);
3235
3162
  const shouldCreateAudioContext = audioContextWasCreated.current || audioEnabled && !playerMuted && mediaVolume > 0;
3236
3163
  audioContextWasCreated.current = shouldCreateAudioContext;
3237
3164
  const setMediaVolumeAndPersist = useCallback11((vol) => {
@@ -3240,19 +3167,19 @@ var SharedPlayerContexts = ({
3240
3167
  persistVolume(vol, logLevel, volumePersistenceKey ?? null);
3241
3168
  }
3242
3169
  }, [persistVolumeToStorage, logLevel, volumePersistenceKey]);
3243
- const setMediaVolumeContextValue = useMemo14(() => {
3170
+ const setMediaVolumeContextValue = useMemo13(() => {
3244
3171
  return {
3245
3172
  setPlayerMuted,
3246
3173
  setMediaVolume: setMediaVolumeAndPersist
3247
3174
  };
3248
3175
  }, [setMediaVolumeAndPersist]);
3249
- const logLevelContext = useMemo14(() => {
3176
+ const logLevelContext = useMemo13(() => {
3250
3177
  return {
3251
3178
  logLevel,
3252
3179
  mountTime: Date.now()
3253
3180
  };
3254
3181
  }, [logLevel]);
3255
- const env = useMemo14(() => {
3182
+ const env = useMemo13(() => {
3256
3183
  return {
3257
3184
  isPlayer: true,
3258
3185
  isRendering: false,
@@ -3261,46 +3188,34 @@ var SharedPlayerContexts = ({
3261
3188
  isReadOnlyStudio: false
3262
3189
  };
3263
3190
  }, []);
3264
- const frameRef = useRef12(timelineContext.frame);
3265
- frameRef.current = timelineContext.frame;
3266
- const timelineImperativeContextValue = useMemo14(() => {
3267
- return {
3268
- frameRef,
3269
- imperativePlaying: timelineContext.imperativePlaying,
3270
- audioAndVideoTags: timelineContext.audioAndVideoTags
3271
- };
3272
- }, [timelineContext.audioAndVideoTags, timelineContext.imperativePlaying]);
3273
- return /* @__PURE__ */ jsx14(Internals15.RemotionEnvironmentContext.Provider, {
3191
+ return /* @__PURE__ */ jsx13(Internals13.RemotionEnvironmentContext.Provider, {
3274
3192
  value: env,
3275
- children: /* @__PURE__ */ jsx14(Internals15.LogLevelContext.Provider, {
3193
+ children: /* @__PURE__ */ jsx13(Internals13.LogLevelContext.Provider, {
3276
3194
  value: logLevelContext,
3277
- children: /* @__PURE__ */ jsx14(Internals15.CanUseRemotionHooksProvider, {
3278
- children: /* @__PURE__ */ jsx14(Internals15.AbsoluteTimeContext.Provider, {
3195
+ children: /* @__PURE__ */ jsx13(Internals13.CanUseRemotionHooksProvider, {
3196
+ children: /* @__PURE__ */ jsx13(Internals13.AbsoluteTimeContext.Provider, {
3279
3197
  value: timelineContext,
3280
- children: /* @__PURE__ */ jsx14(Internals15.PlaybackRateContext.Provider, {
3198
+ children: /* @__PURE__ */ jsx13(Internals13.PlaybackRateContext.Provider, {
3281
3199
  value: playbackRateContext,
3282
- children: /* @__PURE__ */ jsx14(CoreTimelineImperativeContextProvider, {
3283
- value: timelineImperativeContextValue,
3284
- children: /* @__PURE__ */ jsx14(Internals15.TimelineContext.Provider, {
3285
- value: timelineContext,
3286
- children: /* @__PURE__ */ jsx14(Internals15.CompositionManager.Provider, {
3287
- value: compositionManagerContext,
3288
- children: /* @__PURE__ */ jsx14(Internals15.PrefetchProvider, {
3289
- children: /* @__PURE__ */ jsx14(Internals15.DurationsContextProvider, {
3290
- children: /* @__PURE__ */ jsx14(Internals15.MediaVolumeContext.Provider, {
3291
- value: mediaVolumeContextValue,
3292
- children: /* @__PURE__ */ jsx14(Internals15.SetMediaVolumeContext.Provider, {
3293
- value: setMediaVolumeContextValue,
3294
- children: /* @__PURE__ */ jsx14(Internals15.BufferingProvider, {
3295
- children: /* @__PURE__ */ jsx14(Internals15.SharedAudioContextProvider, {
3296
- audioLatencyHint,
3297
- audioEnabled: shouldCreateAudioContext,
3298
- previewSampleRate: sampleRate,
3299
- _experimentalKeepAudioContextAlive,
3300
- children: /* @__PURE__ */ jsx14(Internals15.SharedAudioTagsContextProvider, {
3301
- numberOfAudioTags: numberOfSharedAudioTags,
3302
- children
3303
- })
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
3304
3219
  })
3305
3220
  })
3306
3221
  })
@@ -3318,7 +3233,7 @@ var SharedPlayerContexts = ({
3318
3233
  };
3319
3234
 
3320
3235
  // src/use-remotion-license-acknowledge.ts
3321
- import { Internals as Internals16 } from "remotion";
3236
+ import { Internals as Internals14 } from "remotion";
3322
3237
  var warningShown = false;
3323
3238
  var acknowledgeRemotionLicenseMessage = (acknowledge, logLevel) => {
3324
3239
  if (acknowledge) {
@@ -3328,7 +3243,7 @@ var acknowledgeRemotionLicenseMessage = (acknowledge, logLevel) => {
3328
3243
  return;
3329
3244
  }
3330
3245
  warningShown = true;
3331
- 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.");
3332
3247
  };
3333
3248
 
3334
3249
  // src/utils/validate-in-out-frame.ts
@@ -3429,7 +3344,7 @@ var validateDurationInFrames = NoReactInternals.validateDurationInFrames;
3429
3344
  var validateDefaultAndInputProps = NoReactInternals.validateDefaultAndInputProps;
3430
3345
 
3431
3346
  // src/Player.tsx
3432
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
3347
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
3433
3348
  var componentOrNullIfLazy = (props) => {
3434
3349
  if ("component" in props) {
3435
3350
  return props.component;
@@ -3437,7 +3352,7 @@ var componentOrNullIfLazy = (props) => {
3437
3352
  return null;
3438
3353
  };
3439
3354
  var TimelineSequenceObserverComponent = ({ onTimelineSequenceChange }) => {
3440
- const { sequences } = React14.useContext(Internals17.SequenceManager);
3355
+ const { sequences } = React13.useContext(Internals15.SequenceManager);
3441
3356
  useEffect13(() => {
3442
3357
  onTimelineSequenceChange(sequences);
3443
3358
  }, [onTimelineSequenceChange, sequences]);
@@ -3501,7 +3416,7 @@ var PlayerFn = ({
3501
3416
  if (typeof window !== "undefined") {
3502
3417
  window.remotion_isPlayer = true;
3503
3418
  }
3504
- const onTimelineSequenceChange = React14.useContext(TimelineSequenceObserverContext);
3419
+ const onTimelineSequenceChange = React13.useContext(TimelineSequenceObserverContext);
3505
3420
  if (componentProps.defaultProps !== undefined) {
3506
3421
  throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");
3507
3422
  }
@@ -3513,7 +3428,7 @@ var PlayerFn = ({
3513
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.`);
3514
3429
  }
3515
3430
  useState12(() => acknowledgeRemotionLicenseMessage(Boolean(acknowledgeRemotionLicense), logLevel));
3516
- const component = Internals17.useLazyComponent({
3431
+ const component = Internals15.useLazyComponent({
3517
3432
  compProps: componentProps,
3518
3433
  componentName: "Player",
3519
3434
  noSuspense: Boolean(noSuspense)
@@ -3522,10 +3437,14 @@ var PlayerFn = ({
3522
3437
  const [frame, setFrame] = useState12(() => ({
3523
3438
  [PLAYER_COMP_ID]: initialFrame ?? 0
3524
3439
  }));
3525
- const [playing, setPlaying] = useState12(false);
3526
- const rootRef = useRef13(null);
3527
- const audioAndVideoTags = useRef13([]);
3528
- 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]);
3529
3448
  const [currentPlaybackRate, setCurrentPlaybackRate] = useState12(playbackRate);
3530
3449
  if (typeof compositionHeight !== "number") {
3531
3450
  throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
@@ -3588,68 +3507,91 @@ var PlayerFn = ({
3588
3507
  }, [playbackRate]);
3589
3508
  useImperativeHandle2(ref, () => rootRef.current, []);
3590
3509
  useState12(() => {
3591
- Internals17.playbackLogging({
3510
+ Internals15.playbackLogging({
3592
3511
  logLevel,
3593
3512
  message: `[player] Mounting <Player>. User agent = ${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
3594
3513
  tag: "player",
3595
3514
  mountTime: Date.now()
3596
3515
  });
3597
3516
  });
3598
- const timelineContextValue = useMemo15(() => {
3517
+ const timelineContextValue = useMemo14(() => {
3599
3518
  return {
3600
3519
  frame,
3601
- playing,
3602
- imperativePlaying,
3520
+ isPlaying: readIsPlaying,
3603
3521
  audioAndVideoTags
3604
3522
  };
3605
- }, [frame, playing]);
3606
- const playbackRateContextValue = useMemo15(() => {
3523
+ }, [frame, readIsPlaying]);
3524
+ const playbackRateContextValue = useMemo14(() => {
3607
3525
  return {
3608
3526
  playbackRate: currentPlaybackRate,
3609
3527
  setPlaybackRate: setCurrentPlaybackRate
3610
3528
  };
3611
3529
  }, [currentPlaybackRate]);
3612
- const setTimelineContextValue = useMemo15(() => {
3530
+ const setTimelineContextValue = useMemo14(() => {
3613
3531
  return {
3614
3532
  setFrame,
3615
- 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
3616
3551
  };
3617
- }, [setFrame]);
3552
+ }, [
3553
+ bufferingStore,
3554
+ setFrame,
3555
+ frameRef,
3556
+ playingStore,
3557
+ readIsBuffering,
3558
+ readIsPlaying
3559
+ ]);
3618
3560
  if (typeof window !== "undefined") {
3619
3561
  useLayoutEffect3(() => {
3620
- Internals17.CSSUtils.injectCSS(Internals17.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
3562
+ Internals15.CSSUtils.injectCSS(Internals15.CSSUtils.makeDefaultPreviewCSS(`.${playerCssClassname(overrideInternalClassName)}`, "#fff"));
3621
3563
  }, [overrideInternalClassName]);
3622
3564
  }
3623
- const actualInputProps = useMemo15(() => inputProps ?? {}, [inputProps]);
3624
- const browserMediaControlsBehavior = useMemo15(() => {
3565
+ const actualInputProps = useMemo14(() => inputProps ?? {}, [inputProps]);
3566
+ const browserMediaControlsBehavior = useMemo14(() => {
3625
3567
  return passedBrowserMediaControlsBehavior ?? {
3626
3568
  mode: "prevent-media-session"
3627
3569
  };
3628
3570
  }, [passedBrowserMediaControlsBehavior]);
3629
- const player = /* @__PURE__ */ jsx15(Internals17.IsPlayerContextProvider, {
3630
- children: /* @__PURE__ */ jsx15(SharedPlayerContexts, {
3631
- timelineContext: timelineContextValue,
3632
- playbackRateContext: playbackRateContextValue,
3633
- component,
3634
- compositionHeight,
3635
- compositionWidth,
3636
- durationInFrames,
3637
- fps,
3638
- numberOfSharedAudioTags,
3639
- initiallyMuted,
3640
- logLevel,
3641
- audioLatencyHint,
3642
- sampleRate,
3643
- _experimentalKeepAudioContextAlive,
3644
- volumePersistenceKey,
3645
- initialVolume,
3646
- inputProps: actualInputProps,
3647
- audioEnabled: true,
3648
- children: /* @__PURE__ */ jsx15(Internals17.SetTimelineContext.Provider, {
3649
- value: setTimelineContextValue,
3650
- 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, {
3651
3593
  currentPlaybackRate,
3652
- children: /* @__PURE__ */ jsx15(PlayerUI_default, {
3594
+ children: /* @__PURE__ */ jsx14(PlayerUI_default, {
3653
3595
  ref: rootRef,
3654
3596
  posterFillMode,
3655
3597
  renderLoading,
@@ -3697,11 +3639,11 @@ var PlayerFn = ({
3697
3639
  if (!onTimelineSequenceChange) {
3698
3640
  return player;
3699
3641
  }
3700
- return /* @__PURE__ */ jsx15(Internals17.SequenceRegistrationContext.Provider, {
3642
+ return /* @__PURE__ */ jsx14(Internals15.SequenceRegistrationContext.Provider, {
3701
3643
  value: true,
3702
- children: /* @__PURE__ */ jsxs10(Internals17.SequenceManagerProvider, {
3644
+ children: /* @__PURE__ */ jsxs10(Internals15.SequenceManagerProvider, {
3703
3645
  children: [
3704
- /* @__PURE__ */ jsx15(TimelineSequenceObserverComponent, {
3646
+ /* @__PURE__ */ jsx14(TimelineSequenceObserverComponent, {
3705
3647
  onTimelineSequenceChange
3706
3648
  }),
3707
3649
  player
@@ -3716,31 +3658,31 @@ import {
3716
3658
  forwardRef as forwardRef4,
3717
3659
  useImperativeHandle as useImperativeHandle4,
3718
3660
  useLayoutEffect as useLayoutEffect4,
3719
- useMemo as useMemo18,
3720
- useRef as useRef15,
3661
+ useMemo as useMemo17,
3662
+ useRef as useRef14,
3721
3663
  useState as useState13
3722
3664
  } from "react";
3723
- import { Internals as Internals19 } from "remotion";
3665
+ import { Internals as Internals17 } from "remotion";
3724
3666
 
3725
3667
  // src/ThumbnailUI.tsx
3726
- import React15, {
3668
+ import React14, {
3727
3669
  forwardRef as forwardRef3,
3728
3670
  Suspense as Suspense2,
3729
- useCallback as useCallback12,
3671
+ useCallback as useCallback13,
3730
3672
  useImperativeHandle as useImperativeHandle3,
3731
- useMemo as useMemo17,
3732
- useRef as useRef14
3673
+ useMemo as useMemo16,
3674
+ useRef as useRef13
3733
3675
  } from "react";
3734
- import { Internals as Internals18 } from "remotion";
3676
+ import { Internals as Internals16 } from "remotion";
3735
3677
 
3736
3678
  // src/use-thumbnail.ts
3737
- import { useContext as useContext6, useMemo as useMemo16 } from "react";
3679
+ import { useContext as useContext5, useMemo as useMemo15 } from "react";
3738
3680
  var useThumbnail = () => {
3739
- const emitter = useContext6(ThumbnailEmitterContext);
3681
+ const emitter = useContext5(ThumbnailEmitterContext);
3740
3682
  if (!emitter) {
3741
3683
  throw new TypeError("Expected Player event emitter context");
3742
3684
  }
3743
- const returnValue = useMemo16(() => {
3685
+ const returnValue = useMemo15(() => {
3744
3686
  return {
3745
3687
  emitter
3746
3688
  };
@@ -3749,8 +3691,8 @@ var useThumbnail = () => {
3749
3691
  };
3750
3692
 
3751
3693
  // src/ThumbnailUI.tsx
3752
- import { jsx as jsx16 } from "react/jsx-runtime";
3753
- var reactVersion2 = React15.version.split(".")[0];
3694
+ import { jsx as jsx15 } from "react/jsx-runtime";
3695
+ var reactVersion2 = React14.version.split(".")[0];
3754
3696
  if (reactVersion2 === "0") {
3755
3697
  throw new Error(`Version ${reactVersion2} of "react" is not supported by Remotion`);
3756
3698
  }
@@ -3765,14 +3707,14 @@ var ThumbnailUI = ({
3765
3707
  noSuspense,
3766
3708
  overrideInternalClassName
3767
3709
  }, ref) => {
3768
- const config = Internals18.useUnsafeVideoConfig();
3769
- const video = Internals18.useVideo();
3770
- const container = useRef14(null);
3710
+ const config = Internals16.useUnsafeVideoConfig();
3711
+ const video = Internals16.useVideo();
3712
+ const container = useRef13(null);
3771
3713
  const canvasSize = useElementSize(container, {
3772
3714
  triggerOnWindowResize: false,
3773
3715
  shouldApplyCssTransforms: false
3774
3716
  });
3775
- const layout = useMemo17(() => {
3717
+ const layout = useMemo16(() => {
3776
3718
  if (!config || !canvasSize) {
3777
3719
  return null;
3778
3720
  }
@@ -3794,7 +3736,7 @@ var ThumbnailUI = ({
3794
3736
  return Object.assign(thumbnail.emitter, methods);
3795
3737
  }, [scale, thumbnail.emitter]);
3796
3738
  const VideoComponent = video ? video.component : null;
3797
- const outerStyle = useMemo17(() => {
3739
+ const outerStyle = useMemo16(() => {
3798
3740
  return calculateOuterStyle({
3799
3741
  config,
3800
3742
  style: style2,
@@ -3803,10 +3745,10 @@ var ThumbnailUI = ({
3803
3745
  layout
3804
3746
  });
3805
3747
  }, [canvasSize, config, layout, overflowVisible, style2]);
3806
- const outer = useMemo17(() => {
3748
+ const outer = useMemo16(() => {
3807
3749
  return calculateOuter({ config, layout, scale, overflowVisible });
3808
3750
  }, [config, layout, overflowVisible, scale]);
3809
- const containerStyle3 = useMemo17(() => {
3751
+ const containerStyle3 = useMemo16(() => {
3810
3752
  return calculateContainerStyle({
3811
3753
  config,
3812
3754
  layout,
@@ -3814,17 +3756,17 @@ var ThumbnailUI = ({
3814
3756
  overflowVisible
3815
3757
  });
3816
3758
  }, [config, layout, overflowVisible, scale]);
3817
- const onError = useCallback12((error) => {
3759
+ const onError = useCallback13((error) => {
3818
3760
  thumbnail.emitter.dispatchError(error);
3819
3761
  }, [thumbnail.emitter]);
3820
- const loadingMarkup = useMemo17(() => {
3762
+ const loadingMarkup = useMemo16(() => {
3821
3763
  return renderLoading ? renderLoading({
3822
3764
  height: outerStyle.height,
3823
3765
  width: outerStyle.width,
3824
3766
  isBuffering: false
3825
3767
  }) : null;
3826
3768
  }, [outerStyle.height, outerStyle.width, renderLoading]);
3827
- const currentScaleContext = useMemo17(() => {
3769
+ const currentScaleContext = useMemo16(() => {
3828
3770
  return {
3829
3771
  type: "scale",
3830
3772
  scale
@@ -3833,17 +3775,17 @@ var ThumbnailUI = ({
3833
3775
  if (!config) {
3834
3776
  return null;
3835
3777
  }
3836
- const content = /* @__PURE__ */ jsx16("div", {
3778
+ const content = /* @__PURE__ */ jsx15("div", {
3837
3779
  style: outer,
3838
- children: /* @__PURE__ */ jsx16("div", {
3780
+ children: /* @__PURE__ */ jsx15("div", {
3839
3781
  style: containerStyle3,
3840
3782
  className: playerCssClassname(overrideInternalClassName),
3841
- children: VideoComponent ? /* @__PURE__ */ jsx16(ErrorBoundary, {
3783
+ children: VideoComponent ? /* @__PURE__ */ jsx15(ErrorBoundary, {
3842
3784
  onError,
3843
3785
  errorFallback,
3844
- children: /* @__PURE__ */ jsx16(Internals18.CurrentScaleContext.Provider, {
3786
+ children: /* @__PURE__ */ jsx15(Internals16.CurrentScaleContext.Provider, {
3845
3787
  value: currentScaleContext,
3846
- children: /* @__PURE__ */ jsx16(VideoComponent, {
3788
+ children: /* @__PURE__ */ jsx15(VideoComponent, {
3847
3789
  ...video?.props ?? {},
3848
3790
  ...inputProps ?? {}
3849
3791
  })
@@ -3852,18 +3794,18 @@ var ThumbnailUI = ({
3852
3794
  })
3853
3795
  });
3854
3796
  if (noSuspense || IS_NODE && !doesReactVersionSupportSuspense2) {
3855
- return /* @__PURE__ */ jsx16("div", {
3797
+ return /* @__PURE__ */ jsx15("div", {
3856
3798
  ref: container,
3857
3799
  style: outerStyle,
3858
3800
  className: className2,
3859
3801
  children: content
3860
3802
  });
3861
3803
  }
3862
- return /* @__PURE__ */ jsx16("div", {
3804
+ return /* @__PURE__ */ jsx15("div", {
3863
3805
  ref: container,
3864
3806
  style: outerStyle,
3865
3807
  className: className2,
3866
- children: /* @__PURE__ */ jsx16(Suspense2, {
3808
+ children: /* @__PURE__ */ jsx15(Suspense2, {
3867
3809
  fallback: loadingMarkup,
3868
3810
  children: content
3869
3811
  })
@@ -3872,7 +3814,7 @@ var ThumbnailUI = ({
3872
3814
  var ThumbnailUI_default = forwardRef3(ThumbnailUI);
3873
3815
 
3874
3816
  // src/Thumbnail.tsx
3875
- import { jsx as jsx17 } from "react/jsx-runtime";
3817
+ import { jsx as jsx16 } from "react/jsx-runtime";
3876
3818
  var ThumbnailFn = ({
3877
3819
  frameToDisplay,
3878
3820
  style: style2,
@@ -3895,21 +3837,20 @@ var ThumbnailFn = ({
3895
3837
  window.remotion_isPlayer = true;
3896
3838
  }, []);
3897
3839
  }
3898
- const rootRef = useRef15(null);
3899
- const imperativePlaying = useRef15(false);
3900
- const audioAndVideoTags = useRef15([]);
3901
- const timelineState = useMemo18(() => {
3840
+ const rootRef = useRef14(null);
3841
+ const audioAndVideoTags = useRef14([]);
3842
+ const bufferingStore = useMemo17(() => Internals17.createRuntimeValueStore({ buffering: false }), []);
3843
+ const timelineState = useMemo17(() => {
3902
3844
  const value = {
3903
- playing: false,
3845
+ isPlaying: () => false,
3904
3846
  frame: {
3905
3847
  [PLAYER_COMP_ID]: frameToDisplay
3906
3848
  },
3907
- imperativePlaying,
3908
3849
  audioAndVideoTags
3909
3850
  };
3910
3851
  return value;
3911
3852
  }, [frameToDisplay]);
3912
- const playbackRateContext = useMemo18(() => {
3853
+ const playbackRateContext = useMemo17(() => {
3913
3854
  return {
3914
3855
  playbackRate: 1,
3915
3856
  setPlaybackRate: () => {
@@ -3917,45 +3858,73 @@ var ThumbnailFn = ({
3917
3858
  }
3918
3859
  };
3919
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]);
3920
3886
  useImperativeHandle4(ref, () => rootRef.current, []);
3921
- const Component = Internals19.useLazyComponent({
3887
+ const Component = Internals17.useLazyComponent({
3922
3888
  compProps: componentProps,
3923
3889
  componentName: "Thumbnail",
3924
3890
  noSuspense: Boolean(noSuspense)
3925
3891
  });
3926
3892
  const [emitter] = useState13(() => new ThumbnailEmitter);
3927
- const passedInputProps = useMemo18(() => {
3893
+ const passedInputProps = useMemo17(() => {
3928
3894
  return inputProps ?? {};
3929
3895
  }, [inputProps]);
3930
- return /* @__PURE__ */ jsx17(Internals19.IsPlayerContextProvider, {
3931
- children: /* @__PURE__ */ jsx17(SharedPlayerContexts, {
3932
- timelineContext: timelineState,
3933
- playbackRateContext,
3934
- component: Component,
3935
- compositionHeight,
3936
- compositionWidth,
3937
- durationInFrames,
3938
- fps,
3939
- numberOfSharedAudioTags: 0,
3940
- initiallyMuted: true,
3941
- logLevel,
3942
- audioLatencyHint: "playback",
3943
- sampleRate: 48000,
3944
- inputProps: passedInputProps,
3945
- audioEnabled: false,
3946
- _experimentalKeepAudioContextAlive: false,
3947
- children: /* @__PURE__ */ jsx17(ThumbnailEmitterContext.Provider, {
3948
- value: emitter,
3949
- children: /* @__PURE__ */ jsx17(ThumbnailUI_default, {
3950
- ref: rootRef,
3951
- className: className2,
3952
- errorFallback,
3953
- inputProps: passedInputProps,
3954
- renderLoading,
3955
- style: style2,
3956
- overflowVisible,
3957
- overrideInternalClassName,
3958
- 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
+ })
3959
3928
  })
3960
3929
  })
3961
3930
  })