@lalalic/markcut 3.2.51 → 3.2.52

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { Sequence, OffthreadVideo, useVideoConfig, staticFile } from "remotion";
2
+ import { Sequence, OffthreadVideo, Video as Html5Video, useRemotionEnvironment, useVideoConfig, staticFile } from "remotion";
3
3
 
4
4
  function resolveVideoSrc(src: string): string {
5
5
  if (/^(https?:|data:|blob:|file:|\/)/.test(src)) return src;
@@ -12,6 +12,9 @@ import { FrameSyncStyle } from "./FrameSyncStyle";
12
12
 
13
13
  export function VideoLeaf({ stream }: { stream: Video }) {
14
14
  const { fps } = useVideoConfig();
15
+ const { isPlayer } = useRemotionEnvironment();
16
+ // The player uses HTML5 media; offline rendering retains OffthreadVideo.
17
+ const Media = isPlayer ? Html5Video : OffthreadVideo;
15
18
  const audio = React.useContext(AudioContext);
16
19
  const start = stream.start ?? 0;
17
20
  const end = stream.end ?? start + (stream.duration ?? 1);
@@ -35,25 +38,27 @@ export function VideoLeaf({ stream }: { stream: Video }) {
35
38
  >
36
39
  {hasAnimation ? (
37
40
  <FrameSyncStyle style={streamStyle}>
38
- <OffthreadVideo
41
+ <Media
39
42
  src={resolvedSrc}
40
43
  startFrom={Math.floor(startFrom * fps)}
41
44
  endAt={Math.floor(startFrom * fps) + Math.floor(((endAt - startFrom) * fps) / playbackRate)}
42
45
  muted={volume === 0 || !!audio?.foreground}
43
46
  volume={volume}
44
47
  playbackRate={playbackRate}
48
+ pauseWhenBuffering={isPlayer}
45
49
  showInTimeline={false}
46
50
  style={{ width: "100%", height: "100%" }}
47
51
  />
48
52
  </FrameSyncStyle>
49
53
  ) : (
50
- <OffthreadVideo
54
+ <Media
51
55
  src={resolvedSrc}
52
56
  startFrom={Math.floor(startFrom * fps)}
53
57
  endAt={Math.floor(startFrom * fps) + Math.floor(((endAt - startFrom) * fps) / playbackRate)}
54
58
  muted={volume === 0 || !!audio?.foreground}
55
59
  volume={volume}
56
60
  playbackRate={playbackRate}
61
+ pauseWhenBuffering={isPlayer}
57
62
  showInTimeline={false}
58
63
  style={{ width: "100%", height: "100%", ...streamStyle }}
59
64
  />