React SDKAPI ReferenceFunctions
useDeviceOrientation()
function useDeviceOrientation(onOrientationChange?): number;Tracks the device's physical orientation angle (0, 90, 180, 270).
Listens to screen.orientation, the legacy orientationchange event,
and resize as a fallback. Returns the current angle and optionally
fires a callback (e.g., capture.setOrientation) on every change.
Parameters
| Parameter | Type | Description |
|---|---|---|
onOrientationChange? | (angle) => void | Optional callback invoked with the new angle |
Returns
number
Current orientation in degrees (0 | 90 | 180 | 270)
Example
const capture = useCapture({ mode: "image", apiKey: "..." });
const orientation = useDeviceOrientation(capture.setOrientation);