with vision camera

 import React, { useEffect, useState } from 'react';

import { View, StyleSheet } from 'react-native';

import { Camera, useCameraDevices } from 'react-native-vision-camera';


const styles = StyleSheet.create({

  container: {

    flex: 1,

    backgroundColor: '#000',

  },

});


function VideoScreen() {

  const { cameraDevices, getCameraPermissions, requestCameraPermission } = useCameraDevices();

  const [cameraActive, setCameraActive] = useState(false);


  // Check camera permission and request if not granted

  useEffect(() => {

    getCameraPermissions().then((permissions) => {

      if (!permissions.cameraPermission) {

        requestCameraPermission();

      }

    });

  }, []);


  return (

    <View style={styles.container}>

      {cameraDevices.map((device) => (

        <Camera

          key={device.id}

          device={device}

          style={{ flex: 1 }}

          isActive={cameraActive && device.isActive}

          enableFrameRate={true}

          frameRate={30}

          audio={false}

          video={{

            preset: '1280x720',

            uri: 'http://192.168.1.16',

            contentType: 'application/octet-stream',

          }}

        />

      ))}

    </View>

  );

}


export default VideoScreen;


Comments

Popular posts from this blog

WR3D wwe 2k19 MOD apk direct download link for Android

Download wwe2k17 wr3d

How to make resizeable window in pygame and make content adjustable according to window size