Add onVideoChunkReady
This commit is contained in:
@@ -13,12 +13,13 @@ import {
|
||||
} from "react-native-vision-camera";
|
||||
import { RecordingButton } from "./capture-button";
|
||||
import { useIsForeground } from "./is-foreground";
|
||||
import { useIsFocused } from '@react-navigation/native'
|
||||
import { useIsFocused } from "@react-navigation/native";
|
||||
|
||||
export default function CameraScreen(): React.ReactElement {
|
||||
const camera = useRef<Camera>(null);
|
||||
const { hasPermission, requestPermission } = useCameraPermission();
|
||||
const [isCameraInitialized, setIsCameraInitialized] = useState<boolean>(false);
|
||||
const [isCameraInitialized, setIsCameraInitialized] =
|
||||
useState<boolean>(false);
|
||||
|
||||
const isForeground = useIsForeground();
|
||||
const isFocused = useIsFocused();
|
||||
@@ -37,6 +38,10 @@ export default function CameraScreen(): React.ReactElement {
|
||||
console.log(`Media captured! ${JSON.stringify(media)}`);
|
||||
}, []);
|
||||
|
||||
const onVideoChunkReady = useCallback((event) => {
|
||||
console.log(`Chunk ready in react-native`, event.nativeEvent);
|
||||
}, []);
|
||||
|
||||
if (!hasPermission) {
|
||||
requestPermission();
|
||||
// Error handling in case they refuse to give permission
|
||||
@@ -59,7 +64,7 @@ export default function CameraScreen(): React.ReactElement {
|
||||
};
|
||||
|
||||
if (device === null) {
|
||||
console.log(device)
|
||||
console.log(device);
|
||||
return (
|
||||
<Text>
|
||||
Camera not available. Does user have permissions: {hasPermission}
|
||||
@@ -76,6 +81,7 @@ export default function CameraScreen(): React.ReactElement {
|
||||
format={format}
|
||||
onInitialized={onInitialized}
|
||||
onError={onError}
|
||||
onVideoChunkReady={onVideoChunkReady}
|
||||
video={true}
|
||||
orientation={orientation} // TODO: #60
|
||||
isActive={isActive}
|
||||
|
Reference in New Issue
Block a user