1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.validateMediaProps = void 0;
|
4 | const validateMediaProps = (props, component) => {
|
5 | if (typeof props.volume !== 'number' &&
|
6 | typeof props.volume !== 'function' &&
|
7 | typeof props.volume !== 'undefined') {
|
8 | throw new TypeError(`You have passed a volume of type ${typeof props.volume} to your <${component} /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined.`);
|
9 | }
|
10 | if (typeof props.volume === 'number' && props.volume < 0) {
|
11 | throw new TypeError(`You have passed a volume below 0 to your <${component} /> component. Volume must be between 0 and 1`);
|
12 | }
|
13 | if (typeof props.playbackRate !== 'number' &&
|
14 | typeof props.playbackRate !== 'undefined') {
|
15 | throw new TypeError(`You have passed a playbackRate of type ${typeof props.playbackRate} to your <${component} /> component. Playback rate must a real number or undefined.`);
|
16 | }
|
17 | if (typeof props.playbackRate === 'number' &&
|
18 | (isNaN(props.playbackRate) ||
|
19 | !Number.isFinite(props.playbackRate) ||
|
20 | props.playbackRate <= 0)) {
|
21 | throw new TypeError(`You have passed a playbackRate of ${props.playbackRate} to your <${component} /> component. Playback rate must be a real number above 0.`);
|
22 | }
|
23 | };
|
24 | exports.validateMediaProps = validateMediaProps;
|
25 |
|
\ | No newline at end of file |