Skip to content

Commit

Permalink
- Switch camera
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Svirsky committed Aug 15, 2024
1 parent 5299d74 commit 0fc5ccd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ function App() {
setView(view === 'camera' ? '3d' : 'camera');
}

const onSwitch = () => {
webcamRef.current.switchCamera();
}

const webcamRef = useRef<any>(null);
const cameraCanvasRef = useRef<any>(null);
const overlayCanvasRef = useRef<any>(null);
Expand Down Expand Up @@ -62,7 +66,8 @@ function App() {
switchCamera: "switchCamera",
canvas: "canvas",
}}/>
<button style={{position: 'fixed', bottom: '10px', zIndex: '1'}}
<button style={{position: 'fixed', zIndex: 3, left: '5px', top: '5px'}} onClick={onSwitch}>Switch camera</button>
<button style={{position: 'fixed', bottom: '5px', left: '5px', zIndex: '1'}}
onClick={handleTakePhoto}>Take photo
</button>
{
Expand Down

0 comments on commit 0fc5ccd

Please sign in to comment.