@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
|
||||
import { CameraView } from "expo-camera";
|
||||
import { CameraView, type CameraType } from "expo-camera";
|
||||
import { SwitchCamera } from "lucide-react-native";
|
||||
import { logError } from "@/lib/errors";
|
||||
import {
|
||||
acquireRecordingAudioSession,
|
||||
@@ -23,6 +24,7 @@ export function VideoRecordingOverlay({
|
||||
const [cameraReady, setCameraReady] = useState(false);
|
||||
const [recording, setRecording] = useState(false);
|
||||
const [elapsedMs, setElapsedMs] = useState(0);
|
||||
const [facing, setFacing] = useState<CameraType>("front");
|
||||
const startedAtRef = useRef<number | null>(null);
|
||||
const cancelledRef = useRef(false);
|
||||
|
||||
@@ -105,7 +107,7 @@ export function VideoRecordingOverlay({
|
||||
<CameraView
|
||||
ref={cameraRef}
|
||||
style={StyleSheet.absoluteFill}
|
||||
facing="front"
|
||||
facing={facing}
|
||||
videoQuality="480p"
|
||||
videoBitrate={VIDEO_BITRATE_BPS}
|
||||
mode="video"
|
||||
@@ -113,6 +115,20 @@ export function VideoRecordingOverlay({
|
||||
onCameraReady={() => setCameraReady(true)}
|
||||
/>
|
||||
|
||||
{!recording && cameraReady ? (
|
||||
<View className="absolute top-0 right-0 pt-14 pr-5">
|
||||
<Pressable
|
||||
onPress={() =>
|
||||
setFacing((f) => (f === "front" ? "back" : "front"))
|
||||
}
|
||||
accessibilityLabel="Flip camera"
|
||||
className="h-11 w-11 items-center justify-center rounded-full bg-white/15"
|
||||
>
|
||||
<SwitchCamera color="white" size={22} strokeWidth={1.75} />
|
||||
</Pressable>
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
{recording ? (
|
||||
<View
|
||||
pointerEvents="none"
|
||||
|
||||
Reference in New Issue
Block a user