UNPKG

@remotion/player

Version:

React component for embedding a Remotion preview into your app

24 lines (23 loc) 1.05 kB
export 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)}`); } };