ai-tube / src /app /api /utils /parseVideoOrientation.ts
jbilcke-hf's picture
jbilcke-hf HF staff
working on some new features
3d4392e
raw
history blame
No virus
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
}