diff --git a/component/video/camera.tsx b/component/video/camera.tsx index a954d97..e0b619d 100644 --- a/component/video/camera.tsx +++ b/component/video/camera.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useRef, useState } from 'react' -import { StyleSheet, Text, View } from 'react-native' -import { Camera, useCameraPermission, useCameraDevice, useCameraFormat, PhotoFile, VideoFile, CameraRuntimeError } from 'react-native-vision-camera' +import { Button, StyleSheet, Text, View } from 'react-native' +import { Camera, useCameraPermission, useCameraDevice, useCameraFormat, PhotoFile, VideoFile, CameraRuntimeError, Orientation } from 'react-native-vision-camera' import { RecordingButton } from './capture-button' import { useIsForeground } from './is-foreground' @@ -39,10 +39,19 @@ export default function CameraScreen(): React.ReactElement { { fps: 60 } ]) + //Orientation detection + const [orientation, setOrientation] = useState('portrait'); + + const toggleOrientation = () => { + setOrientation(currentOrientation => + currentOrientation === 'landscape-left' ? 'portrait' : 'landscape-left' // Can adjust this and the type to match what we want + ); + }; + if (device === null) { return Camera not available. Does user have permissions: {hasPermission} } - + return ( hasPermission && ( @@ -54,18 +63,24 @@ export default function CameraScreen(): React.ReactElement { onInitialized={onInitialized} onError={onError} video={true} - photo={false} - orientation='portrait' // TODO: #60 + orientation={orientation} // TODO: #60 isActive={isActive} /> + +