useFacingMode
function useFacingMode(trackReference): FacingMode | undefined;Defined in: packages/react/src/hooks/device/useFacingMode.ts:46
Note. This feature is experimental and may change or be removed based on developer feedback and real-world usage. Try to determine the facingMode of a local participant video track.
Parameters
| Parameter | Type |
|---|---|
trackReference | unknown |
Returns
FacingMode | undefined
Example
// Basic — read the camera facing mode for a local video track.
const facingMode = useFacingMode(trackReference);
// Advanced — label local camera tracks by physical direction.
function CameraFacingLabel({ trackRef }: { trackRef: TrackReferenceOrPlaceholder }) {
const facingMode = useFacingMode(trackRef);
const isMuted = useIsMuted(trackRef);
return (
<span>
{isMuted ? "Camera muted" : facingMode ?? "Camera direction unknown"}
</span>
);
}