|
- import * as YouTubeImpl from './video-types/youtube';
-
- const SUPPORTED_VIDEO_TYPES = [
- YouTubeImpl,
- ] as const;
-
- export type CreateClipperParams = (
- YouTubeImpl.CreateClipperParams
- );
-
- export type VideoType = typeof YouTubeImpl.VIDEO_TYPE;
- export * as YouTube from './video-types/youtube';
- export * from './common';
-
- export const createVideoClipper = (params: CreateClipperParams) => {
- const { type: videoType, ...etcParams } = params;
-
- const theVideoTypeModule = SUPPORTED_VIDEO_TYPES
- .find((videoTypeModule) => videoTypeModule.VIDEO_TYPE === videoType);
-
- if (!theVideoTypeModule) {
- const validVideoTypes = SUPPORTED_VIDEO_TYPES.map((videoTypeModule) => videoTypeModule.VIDEO_TYPE).join(', ');
- throw new TypeError(`Invalid video type: "${videoType}". Valid values are: ${validVideoTypes}`);
- }
-
- return theVideoTypeModule.createVideoClipper(etcParams);
- };
|