ai-tube / src /app /api /parsers /parseVideoOrientation.ts
jbilcke-hf's picture
jbilcke-hf HF staff
upgraded to @aitube/client 0.0.12
f24ad59
raw
history blame
787 Bytes
import { defaultVideoOrientation } from "@/app/config"
import { VideoOrientation } from "@/types/general"
export function parseVideoOrientation(text: any, defaultToUse?: VideoOrientation): VideoOrientation {
const rawOrientationString = `${text || ""}`.trim().toLowerCase()
let orientation: VideoOrientation = defaultToUse || (defaultVideoOrientation || "landscape")
if (
rawOrientationString === "landscape" ||
rawOrientationString === "horizontal"
) {
orientation = "landscape"
}
if (
rawOrientationString === "portrait" ||
rawOrientationString === "vertical" ||
rawOrientationString === "mobile"
) {
orientation = "portrait"
}
if (
rawOrientationString === "square"
) {
orientation = "square"
}
return orientation
}