ai-tube / src /app /api /parsers /parseSupportedExportFormat.ts
jbilcke-hf's picture
jbilcke-hf HF staff
eh, not bad for a side project
8919651
raw
history blame contribute delete
510 Bytes
import { defaultExportFormat, SupportedExportFormat } from "@aitube/client"
export function parseSupportedExportFormat(
input?: any,
defaultFormat: SupportedExportFormat = defaultExportFormat
): SupportedExportFormat {
let format: SupportedExportFormat = defaultFormat
try {
format = decodeURIComponent(`${input || ""}` || defaultFormat).trim() as SupportedExportFormat
if (format !== "mp4" && format !== "webm") {
format = defaultFormat
}
} catch (err) {}
return format
}