diff options
Diffstat (limited to 'src/state/queries/video/util.ts')
-rw-r--r-- | src/state/queries/video/util.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/state/queries/video/util.ts b/src/state/queries/video/util.ts index 7ea38d8dc..2c1298ab6 100644 --- a/src/state/queries/video/util.ts +++ b/src/state/queries/video/util.ts @@ -39,3 +39,18 @@ export function mimeToExt(mimeType: SupportedMimeTypes | (string & {})) { throw new Error(`Unsupported mime type: ${mimeType}`) } } + +export function extToMime(ext: string) { + switch (ext) { + case 'mp4': + return 'video/mp4' + case 'webm': + return 'video/webm' + case 'mpeg': + return 'video/mpeg' + case 'mov': + return 'video/quicktime' + default: + throw new Error(`Unsupported file extension: ${ext}`) + } +} |