ai-stories-factory / src /lib /hooks /useOrientation.ts
jbilcke-hf's picture
jbilcke-hf HF staff
experimental support for images
82d1e90
raw
history blame
895 Bytes
import { useStore } from "@/app/store"
import { ClapMediaOrientation } from "@aitube/clap"
export function useOrientation() {
const orientation = useStore(s => s.orientation)
const setOrientation = useStore(s => s.setOrientation)
const currentVideoOrientation = useStore(s => s.currentVideoOrientation)
const toggleOrientation = useStore(s => s.toggleOrientation)
// note: we are interested in the *current* video orientation,
// not the requested video orientation requested for the next video
const isLandscape = currentVideoOrientation === ClapMediaOrientation.LANDSCAPE
const isPortrait = currentVideoOrientation === ClapMediaOrientation.PORTRAIT
const isSquare = currentVideoOrientation === ClapMediaOrientation.SQUARE
return {
orientation,
setOrientation,
currentVideoOrientation,
toggleOrientation,
isLandscape,
isPortrait,
isSquare
}
}