remotion 4.0.127 → 4.0.129

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 +1 @@
1
- export declare const getInputProps: () => Record<string, unknown>;
1
+ export declare const getInputProps: <T extends Record<string, unknown> = Record<string, unknown>>() => T;
@@ -12,4 +12,4 @@ export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
12
12
  indent: number | undefined;
13
13
  staticBase: string | null;
14
14
  }) => SerializedJSONWithCustomFields;
15
- export declare const deserializeJSONWithCustomFields: (data: string) => Record<string, unknown>;
15
+ export declare const deserializeJSONWithCustomFields: <T = Record<string, unknown>>(data: string) => T;
@@ -1,4 +1,4 @@
1
- export type ExtrapolateType = 'extend' | 'identity' | 'clamp';
1
+ export type ExtrapolateType = 'extend' | 'identity' | 'clamp' | 'wrap';
2
2
  /**
3
3
  * @description This function allows you to map a range of values to another with a conside syntax
4
4
  * @see [Documentation](https://www.remotion.dev/docs/interpolate)
@@ -14,8 +14,12 @@ function interpolateFunction(input, inputRange, outputRange, options) {
14
14
  if (extrapolateLeft === 'clamp') {
15
15
  result = inputMin;
16
16
  }
17
+ else if (extrapolateLeft === 'wrap') {
18
+ const range = inputMax - inputMin;
19
+ result = ((((result - inputMin) % range) + range) % range) + inputMin;
20
+ }
17
21
  else if (extrapolateLeft === 'extend') {
18
- // noop
22
+ // Noop
19
23
  }
20
24
  }
21
25
  if (result > inputMax) {
@@ -25,8 +29,12 @@ function interpolateFunction(input, inputRange, outputRange, options) {
25
29
  if (extrapolateRight === 'clamp') {
26
30
  result = inputMax;
27
31
  }
32
+ else if (extrapolateRight === 'wrap') {
33
+ const range = inputMax - inputMin;
34
+ result = ((((result - inputMin) % range) + range) % range) + inputMin;
35
+ }
28
36
  else if (extrapolateRight === 'extend') {
29
- // noop
37
+ // Noop
30
38
  }
31
39
  }
32
40
  if (outputMin === outputMax) {
@@ -27,7 +27,7 @@ export declare const NoReactInternals: {
27
27
  }) => import("./input-props-serialization").SerializedJSONWithCustomFields;
28
28
  bundleName: string;
29
29
  bundleMapName: string;
30
- deserializeJSONWithCustomFields: (data: string) => Record<string, unknown>;
30
+ deserializeJSONWithCustomFields: <T = Record<string, unknown>>(data: string) => T;
31
31
  DELAY_RENDER_CALLSTACK_TOKEN: string;
32
32
  getOffthreadVideoSource: ({ src, transparent, currentTime, toneMapped, }: {
33
33
  src: string;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.127";
1
+ export declare const VERSION = "4.0.129";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.127';
5
+ exports.VERSION = '4.0.129';
@@ -6,10 +6,12 @@ const toSeconds = (time, fps) => {
6
6
  return Math.round((time / fps) * 100) / 100;
7
7
  };
8
8
  const isIosSafari = () => {
9
- return typeof window === 'undefined'
10
- ? false
11
- : /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
12
- Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
9
+ if (typeof window === 'undefined') {
10
+ return false;
11
+ }
12
+ const isIpadIPodIPhone = /iP(ad|od|hone)/i.test(window.navigator.userAgent);
13
+ const isAppleWebKit = /AppleWebKit/.test(window.navigator.userAgent);
14
+ return isIpadIPodIPhone && isAppleWebKit;
13
15
  };
14
16
  exports.isIosSafari = isIosSafari;
15
17
  // https://github.com/remotion-dev/remotion/issues/1655
@@ -105,7 +105,7 @@ function truthy(value) {
105
105
  }
106
106
 
107
107
  // Automatically generated on publish
108
- const VERSION = '4.0.127';
108
+ const VERSION = '4.0.129';
109
109
 
110
110
  const checkMultipleRemotionVersions = () => {
111
111
  if (typeof globalThis === 'undefined') {
@@ -1816,6 +1816,11 @@ function interpolateFunction(input, inputRange, outputRange, options) {
1816
1816
  if (extrapolateLeft === 'clamp') {
1817
1817
  result = inputMin;
1818
1818
  }
1819
+ else if (extrapolateLeft === 'wrap') {
1820
+ const range = inputMax - inputMin;
1821
+ result = ((((result - inputMin) % range) + range) % range) + inputMin;
1822
+ }
1823
+ else ;
1819
1824
  }
1820
1825
  if (result > inputMax) {
1821
1826
  if (extrapolateRight === 'identity') {
@@ -1824,6 +1829,11 @@ function interpolateFunction(input, inputRange, outputRange, options) {
1824
1829
  if (extrapolateRight === 'clamp') {
1825
1830
  result = inputMax;
1826
1831
  }
1832
+ else if (extrapolateRight === 'wrap') {
1833
+ const range = inputMax - inputMin;
1834
+ result = ((((result - inputMin) % range) + range) % range) + inputMin;
1835
+ }
1836
+ else ;
1827
1837
  }
1828
1838
  if (outputMin === outputMax) {
1829
1839
  return outputMin;
@@ -1935,10 +1945,12 @@ const toSeconds = (time, fps) => {
1935
1945
  return Math.round((time / fps) * 100) / 100;
1936
1946
  };
1937
1947
  const isIosSafari = () => {
1938
- return typeof window === 'undefined'
1939
- ? false
1940
- : /iP(ad|od|hone)/i.test(window.navigator.userAgent) &&
1941
- Boolean(navigator.userAgent.match(/Version\/[\d.]+.*Safari/));
1948
+ if (typeof window === 'undefined') {
1949
+ return false;
1950
+ }
1951
+ const isIpadIPodIPhone = /iP(ad|od|hone)/i.test(window.navigator.userAgent);
1952
+ const isAppleWebKit = /AppleWebKit/.test(window.navigator.userAgent);
1953
+ return isIpadIPodIPhone && isAppleWebKit;
1942
1954
  };
1943
1955
  // https://github.com/remotion-dev/remotion/issues/1655
1944
1956
  const isIOSSafariAndBlob = (actualSrc) => {
@@ -11,6 +11,11 @@ function interpolateFunction(input, inputRange, outputRange, options) {
11
11
  if (extrapolateLeft === 'clamp') {
12
12
  result = inputMin;
13
13
  }
14
+ else if (extrapolateLeft === 'wrap') {
15
+ const range = inputMax - inputMin;
16
+ result = ((((result - inputMin) % range) + range) % range) + inputMin;
17
+ }
18
+ else ;
14
19
  }
15
20
  if (result > inputMax) {
16
21
  if (extrapolateRight === 'identity') {
@@ -19,6 +24,11 @@ function interpolateFunction(input, inputRange, outputRange, options) {
19
24
  if (extrapolateRight === 'clamp') {
20
25
  result = inputMax;
21
26
  }
27
+ else if (extrapolateRight === 'wrap') {
28
+ const range = inputMax - inputMin;
29
+ result = ((((result - inputMin) % range) + range) % range) + inputMin;
30
+ }
31
+ else ;
22
32
  }
23
33
  if (outputMin === outputMax) {
24
34
  return outputMin;
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.127';
2
+ const VERSION = '4.0.129';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.127",
3
+ "version": "4.0.129",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -1,17 +0,0 @@
1
- import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
- import React from 'react';
3
- export declare const AudioForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "nonce" | "onEnded" | "onResize" | "onResizeCapture" | "autoPlay" | "controls"> & {
4
- name?: string | undefined;
5
- volume?: import("../volume-prop.js").VolumeProp | undefined;
6
- playbackRate?: number | undefined;
7
- acceptableTimeShiftInSeconds?: number | undefined;
8
- allowAmplificationDuringRender?: boolean | undefined;
9
- _remotionInternalNeedsDurationCalculation?: boolean | undefined;
10
- _remotionInternalNativeLoopPassed?: boolean | undefined;
11
- toneFrequency?: number | undefined;
12
- } & {
13
- shouldPreMountAudioTags: boolean;
14
- onDuration: (src: string, durationInSeconds: number) => void;
15
- _remotionInternalNativeLoopPassed: boolean;
16
- _remotionInternalStack: string | null;
17
- } & RefAttributes<HTMLAudioElement>>;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AudioForDevelopment = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const prefetch_js_1 = require("../prefetch.js");
7
- const random_js_1 = require("../random.js");
8
- const SequenceContext_js_1 = require("../SequenceContext.js");
9
- const SequenceManager_js_1 = require("../SequenceManager.js");
10
- const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
11
- const use_media_playback_js_1 = require("../use-media-playback.js");
12
- const use_media_tag_volume_js_1 = require("../use-media-tag-volume.js");
13
- const use_sync_volume_with_media_tag_js_1 = require("../use-sync-volume-with-media-tag.js");
14
- const volume_position_state_js_1 = require("../volume-position-state.js");
15
- const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
16
- const use_audio_frame_js_1 = require("./use-audio-frame.js");
17
- const AudioForDevelopmentForwardRefFunction = (props, ref) => {
18
- var _a;
19
- const [initialShouldPreMountAudioElements] = (0, react_1.useState)(props.shouldPreMountAudioTags);
20
- if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
21
- throw new Error('Cannot change the behavior for pre-mounting audio tags dynamically.');
22
- }
23
- const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
24
- const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
25
- const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
26
- const { volume, muted, playbackRate, shouldPreMountAudioTags, src, onDuration, acceptableTimeShiftInSeconds, _remotionInternalNeedsDurationCalculation, _remotionInternalNativeLoopPassed, _remotionInternalStack, allowAmplificationDuringRender, name, ...nativeProps } = props;
27
- const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
28
- if (!src) {
29
- throw new TypeError("No 'src' was passed to <Audio>.");
30
- }
31
- const preloadedSrc = (0, prefetch_js_1.usePreload)(src);
32
- const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
33
- const [timelineId] = (0, react_1.useState)(() => String(Math.random()));
34
- const isSequenceHidden = (_a = hidden[timelineId]) !== null && _a !== void 0 ? _a : false;
35
- const propsToPass = (0, react_1.useMemo)(() => {
36
- return {
37
- muted: muted || mediaMuted || isSequenceHidden,
38
- src: preloadedSrc,
39
- loop: _remotionInternalNativeLoopPassed,
40
- ...nativeProps,
41
- };
42
- }, [
43
- _remotionInternalNativeLoopPassed,
44
- isSequenceHidden,
45
- mediaMuted,
46
- muted,
47
- nativeProps,
48
- preloadedSrc,
49
- ]);
50
- // Generate a string that's as unique as possible for this asset
51
- // but at the same time deterministic. We use it to combat strict mode issues.
52
- const id = (0, react_1.useMemo)(() => `audio-${(0, random_js_1.random)(src !== null && src !== void 0 ? src : '')}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom}-${sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
53
- src,
54
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom,
55
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.cumulatedFrom,
56
- sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.durationInFrames,
57
- props.muted,
58
- props.loop,
59
- ]);
60
- const audioRef = (0, shared_audio_tags_js_1.useSharedAudio)(propsToPass, id).el;
61
- const actualVolume = (0, use_media_tag_volume_js_1.useMediaTagVolume)(audioRef);
62
- (0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
63
- volumePropFrame,
64
- actualVolume,
65
- volume,
66
- mediaVolume,
67
- mediaRef: audioRef,
68
- });
69
- (0, use_media_in_timeline_js_1.useMediaInTimeline)({
70
- volume,
71
- mediaVolume,
72
- mediaRef: audioRef,
73
- src,
74
- mediaType: 'audio',
75
- playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
76
- displayName: name !== null && name !== void 0 ? name : null,
77
- id: timelineId,
78
- stack: props._remotionInternalStack,
79
- });
80
- (0, use_media_playback_js_1.useMediaPlayback)({
81
- mediaRef: audioRef,
82
- src,
83
- mediaType: 'audio',
84
- playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
85
- onlyWarnForMediaSeekingError: false,
86
- acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_js_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
87
- });
88
- (0, react_1.useImperativeHandle)(ref, () => {
89
- return audioRef.current;
90
- }, [audioRef]);
91
- const currentOnDurationCallback = (0, react_1.useRef)();
92
- currentOnDurationCallback.current = onDuration;
93
- (0, react_1.useEffect)(() => {
94
- var _a;
95
- const { current } = audioRef;
96
- if (!current) {
97
- return;
98
- }
99
- if (current.duration) {
100
- (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, current.src, current.duration);
101
- return;
102
- }
103
- const onLoadedMetadata = () => {
104
- var _a;
105
- (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, current.src, current.duration);
106
- };
107
- current.addEventListener('loadedmetadata', onLoadedMetadata);
108
- return () => {
109
- current.removeEventListener('loadedmetadata', onLoadedMetadata);
110
- };
111
- }, [audioRef, src]);
112
- if (initialShouldPreMountAudioElements) {
113
- return null;
114
- }
115
- return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, preload: "metadata", ...propsToPass });
116
- };
117
- exports.AudioForDevelopment = (0, react_1.forwardRef)(AudioForDevelopmentForwardRefFunction);
@@ -1 +0,0 @@
1
- export declare const getTimelineClipName: (children: React.ReactNode) => string;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimelineClipName = void 0;
4
- const react_1 = require("react");
5
- const HIDDEN_NAMES = ['__WEBPACK_DEFAULT_EXPORT__'];
6
- const getTimelineClipName = (children) => {
7
- var _a;
8
- const tree = (_a = react_1.Children.map(children, (ch) => {
9
- if (!(0, react_1.isValidElement)(ch)) {
10
- return null;
11
- }
12
- // Must be name, not ID
13
- const name = typeof ch.type !== 'string' && ch.type.name;
14
- if (name && !HIDDEN_NAMES.includes(name)) {
15
- return name;
16
- }
17
- if (ch.props.children) {
18
- const chName = (0, exports.getTimelineClipName)(ch.props.children);
19
- return chName;
20
- }
21
- return null;
22
- })) === null || _a === void 0 ? void 0 : _a.filter(Boolean);
23
- return (tree === null || tree === void 0 ? void 0 : tree.length) ? tree[0] : '';
24
- };
25
- exports.getTimelineClipName = getTimelineClipName;
@@ -1,15 +0,0 @@
1
- import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
- import React from 'react';
3
- export declare const VideoForDevelopment: ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "nonce" | "onEnded" | "autoPlay" | "controls"> & {
4
- name?: string | undefined;
5
- volume?: import("../volume-prop.js").VolumeProp | undefined;
6
- playbackRate?: number | undefined;
7
- acceptableTimeShiftInSeconds?: number | undefined;
8
- allowAmplificationDuringRender?: boolean | undefined;
9
- toneFrequency?: number | undefined;
10
- } & {
11
- onlyWarnForMediaSeekingError: boolean;
12
- onDuration: (src: string, durationInSeconds: number) => void;
13
- _remotionInternalNativeLoopPassed: boolean;
14
- _remotionInternalStack: string | null;
15
- } & RefAttributes<HTMLVideoElement>>;
@@ -1,149 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VideoForDevelopment = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
7
- const prefetch_js_1 = require("../prefetch.js");
8
- const SequenceContext_js_1 = require("../SequenceContext.js");
9
- const SequenceManager_js_1 = require("../SequenceManager.js");
10
- const use_media_in_timeline_js_1 = require("../use-media-in-timeline.js");
11
- const use_media_playback_js_1 = require("../use-media-playback.js");
12
- const use_media_tag_volume_js_1 = require("../use-media-tag-volume.js");
13
- const use_sync_volume_with_media_tag_js_1 = require("../use-sync-volume-with-media-tag.js");
14
- const use_video_config_js_1 = require("../use-video-config.js");
15
- const volume_position_state_js_1 = require("../volume-position-state.js");
16
- const video_fragment_js_1 = require("./video-fragment.js");
17
- const VideoForDevelopmentRefForwardingFunction = (props, ref) => {
18
- var _a, _b, _c;
19
- const videoRef = (0, react_1.useRef)(null);
20
- const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)();
21
- const { fps, durationInFrames } = (0, use_video_config_js_1.useVideoConfig)();
22
- const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
23
- const { hidden } = (0, react_1.useContext)(SequenceManager_js_1.SequenceVisibilityToggleContext);
24
- const [timelineId] = (0, react_1.useState)(() => String(Math.random()));
25
- const isSequenceHidden = (_a = hidden[timelineId]) !== null && _a !== void 0 ? _a : false;
26
- const { volume, muted, playbackRate, onlyWarnForMediaSeekingError, src, onDuration,
27
- // @ts-expect-error
28
- acceptableTimeShift, acceptableTimeShiftInSeconds, toneFrequency, name, _remotionInternalNativeLoopPassed, _remotionInternalStack, style, ...nativeProps } = props;
29
- if (typeof acceptableTimeShift !== 'undefined') {
30
- throw new Error('acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.');
31
- }
32
- const actualVolume = (0, use_media_tag_volume_js_1.useMediaTagVolume)(videoRef);
33
- const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
34
- const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
35
- (0, use_media_in_timeline_js_1.useMediaInTimeline)({
36
- mediaRef: videoRef,
37
- volume,
38
- mediaVolume,
39
- mediaType: 'video',
40
- src,
41
- playbackRate: (_b = props.playbackRate) !== null && _b !== void 0 ? _b : 1,
42
- displayName: name !== null && name !== void 0 ? name : null,
43
- id: timelineId,
44
- stack: props._remotionInternalStack,
45
- });
46
- (0, use_sync_volume_with_media_tag_js_1.useSyncVolumeWithMediaTag)({
47
- volumePropFrame,
48
- actualVolume,
49
- volume,
50
- mediaVolume,
51
- mediaRef: videoRef,
52
- });
53
- (0, use_media_playback_js_1.useMediaPlayback)({
54
- mediaRef: videoRef,
55
- src,
56
- mediaType: 'video',
57
- playbackRate: (_c = props.playbackRate) !== null && _c !== void 0 ? _c : 1,
58
- onlyWarnForMediaSeekingError,
59
- acceptableTimeshift: acceptableTimeShiftInSeconds !== null && acceptableTimeShiftInSeconds !== void 0 ? acceptableTimeShiftInSeconds : use_media_playback_js_1.DEFAULT_ACCEPTABLE_TIMESHIFT,
60
- });
61
- const actualFrom = parentSequence
62
- ? parentSequence.relativeFrom + parentSequence.cumulatedFrom
63
- : 0;
64
- const duration = parentSequence
65
- ? Math.min(parentSequence.durationInFrames, durationInFrames)
66
- : durationInFrames;
67
- const actualSrc = (0, video_fragment_js_1.useAppendVideoFragment)({
68
- actualSrc: (0, prefetch_js_1.usePreload)(src),
69
- actualFrom,
70
- duration,
71
- fps,
72
- });
73
- (0, react_1.useImperativeHandle)(ref, () => {
74
- return videoRef.current;
75
- }, []);
76
- (0, react_1.useEffect)(() => {
77
- const { current } = videoRef;
78
- if (!current) {
79
- return;
80
- }
81
- const errorHandler = () => {
82
- var _a;
83
- if (current === null || current === void 0 ? void 0 : current.error) {
84
- // eslint-disable-next-line no-console
85
- console.error('Error occurred in video', current === null || current === void 0 ? void 0 : current.error);
86
- // If user is handling the error, we don't cause an unhandled exception
87
- if (props.onError) {
88
- return;
89
- }
90
- throw new Error(`The browser threw an error while playing the video ${src}: Code ${current.error.code} - ${(_a = current === null || current === void 0 ? void 0 : current.error) === null || _a === void 0 ? void 0 : _a.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`);
91
- }
92
- else {
93
- throw new Error('The browser threw an error');
94
- }
95
- };
96
- current.addEventListener('error', errorHandler, { once: true });
97
- return () => {
98
- current.removeEventListener('error', errorHandler);
99
- };
100
- }, [props.onError, src]);
101
- const currentOnDurationCallback = (0, react_1.useRef)();
102
- currentOnDurationCallback.current = onDuration;
103
- (0, react_1.useEffect)(() => {
104
- var _a;
105
- const { current } = videoRef;
106
- if (!current) {
107
- return;
108
- }
109
- if (current.duration) {
110
- (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
111
- return;
112
- }
113
- const onLoadedMetadata = () => {
114
- var _a;
115
- (_a = currentOnDurationCallback.current) === null || _a === void 0 ? void 0 : _a.call(currentOnDurationCallback, src, current.duration);
116
- };
117
- current.addEventListener('loadedmetadata', onLoadedMetadata);
118
- return () => {
119
- current.removeEventListener('loadedmetadata', onLoadedMetadata);
120
- };
121
- }, [src]);
122
- (0, react_1.useEffect)(() => {
123
- const { current } = videoRef;
124
- if (!current) {
125
- return;
126
- }
127
- // Without this, on iOS Safari, the video cannot be seeked.
128
- // if a seek is triggered before `loadedmetadata` is fired,
129
- // the video will not seek, even if `loadedmetadata` is fired afterwards.
130
- // Also, this needs to happen in a useEffect, because otherwise
131
- // the SSR props will be applied.
132
- if ((0, video_fragment_js_1.isIosSafari)()) {
133
- current.preload = 'metadata';
134
- }
135
- else {
136
- current.preload = 'auto';
137
- }
138
- }, []);
139
- const actualStyle = (0, react_1.useMemo)(() => {
140
- var _a;
141
- return {
142
- ...style,
143
- opacity: isSequenceHidden ? 0 : (_a = style === null || style === void 0 ? void 0 : style.opacity) !== null && _a !== void 0 ? _a : 1,
144
- };
145
- }, [isSequenceHidden, style]);
146
- return ((0, jsx_runtime_1.jsx)("video", { ref: videoRef, muted: muted || mediaMuted, playsInline: true, src: actualSrc, loop: _remotionInternalNativeLoopPassed, style: actualStyle, ...nativeProps }));
147
- };
148
- // Copy types from forwardRef but not necessary to remove ref
149
- exports.VideoForDevelopment = (0, react_1.forwardRef)(VideoForDevelopmentRefForwardingFunction);