File size: 895 Bytes
82d1e90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
  }
}