remotion
Version:
Render videos in React
29 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Video = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const sequencing_1 = require("../sequencing");
const validate_media_props_1 = require("../validate-media-props");
const validate_start_from_props_1 = require("../validate-start-from-props");
const VideoForDevelopment_1 = require("./VideoForDevelopment");
const VideoForRendering_1 = require("./VideoForRendering");
const VideoForwardingFunction = (props, ref) => {
const { startFrom, endAt, ...otherProps } = props;
if (typeof ref === 'string') {
throw new Error('string refs are not supported');
}
if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
validate_start_from_props_1.validateStartFromProps(startFrom, endAt);
const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
return (jsx_runtime_1.jsx(sequencing_1.Sequence, Object.assign({ layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo }, { children: jsx_runtime_1.jsx(exports.Video, Object.assign({}, otherProps, { ref: ref }), void 0) }), void 0));
}
validate_media_props_1.validateMediaProps(props, 'Video');
if (process.env.NODE_ENV === 'development') {
return jsx_runtime_1.jsx(VideoForDevelopment_1.VideoForDevelopment, Object.assign({}, otherProps, { ref: ref }), void 0);
}
return jsx_runtime_1.jsx(VideoForRendering_1.VideoForRendering, Object.assign({}, otherProps, { ref: ref }), void 0);
};
exports.Video = react_1.forwardRef(VideoForwardingFunction);
//# sourceMappingURL=Video.js.map