UNPKG

1.91 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.Video = void 0;
4const jsx_runtime_1 = require("react/jsx-runtime");
5const react_1 = require("react");
6const get_environment_1 = require("../get-environment");
7const sequencing_1 = require("../sequencing");
8const validate_media_props_1 = require("../validate-media-props");
9const validate_start_from_props_1 = require("../validate-start-from-props");
10const VideoForDevelopment_1 = require("./VideoForDevelopment");
11const VideoForRendering_1 = require("./VideoForRendering");
12const VideoForwardingFunction = (props, ref) => {
13 const { startFrom, endAt, ...otherProps } = props;
14 if (typeof ref === 'string') {
15 throw new Error('string refs are not supported');
16 }
17 if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
18 (0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
19 const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
20 const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
21 return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, Object.assign({ layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo }, { children: (0, jsx_runtime_1.jsx)(exports.Video, Object.assign({}, otherProps, { ref: ref }), void 0) }), void 0));
22 }
23 (0, validate_media_props_1.validateMediaProps)(props, 'Video');
24 if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
25 return (0, jsx_runtime_1.jsx)(VideoForRendering_1.VideoForRendering, Object.assign({}, otherProps, { ref: ref }), void 0);
26 }
27 return (0, jsx_runtime_1.jsx)(VideoForDevelopment_1.VideoForDevelopment, Object.assign({}, otherProps, { ref: ref }), void 0);
28};
29exports.Video = (0, react_1.forwardRef)(VideoForwardingFunction);
30//# sourceMappingURL=Video.js.map
\No newline at end of file