@remotion/player
Version:
React component for embedding a Remotion preview into your app
28 lines (27 loc) • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateInitialFrame = void 0;
const validateInitialFrame = ({ initialFrame, durationInFrames, }) => {
if (typeof durationInFrames !== 'number') {
throw new Error(`\`durationInFrames\` must be a number, but is ${JSON.stringify(durationInFrames)}`);
}
if (typeof initialFrame === 'undefined') {
return;
}
if (typeof initialFrame !== 'number') {
throw new Error(`\`initialFrame\` must be a number, but is ${JSON.stringify(initialFrame)}`);
}
if (Number.isNaN(initialFrame)) {
throw new Error(`\`initialFrame\` must be a number, but is NaN`);
}
if (!Number.isFinite(initialFrame)) {
throw new Error(`\`initialFrame\` must be a number, but is Infinity`);
}
if (initialFrame % 1 !== 0) {
throw new Error(`\`initialFrame\` must be an integer, but is ${JSON.stringify(initialFrame)}`);
}
if (initialFrame > durationInFrames - 1) {
throw new Error(`\`initialFrame\` must be less or equal than \`durationInFrames - 1\`, but is ${JSON.stringify(initialFrame)}`);
}
};
exports.validateInitialFrame = validateInitialFrame;