Giter Site home page Giter Site logo

shuo-mr / react-native-uvc-camera Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flyskywhy/react-native-uvc-camera

0.0 0.0 0.0 13.49 MB

A React Native component to access to UVC web camera on non-rooted Android device

Java 8.72% Makefile 3.88% C++ 9.60% C 45.56% CMake 0.53% M4 0.38% Shell 4.68% Roff 0.40% HTML 7.62% CSS 0.47% JavaScript 0.53% Assembly 14.49% Objective-C 0.01% PHP 3.03% Batchfile 0.09%

react-native-uvc-camera's Introduction

React Native UVC Camera

A React Native component to access to UVC web camera on non-rooted Android device, a combination of React Native Camera and UVCCamera .

UvcCameraManager is an example.

Installation (Android)

  • Add android/local.properties , android-ndk need just r14b in NDK Archives, e.g.
sdk.dir=D\:\\proj\\tools\\android-sdk
ndk.dir=D\:\\proj\\tools\\android-ndk-r14b
  • In android/settings.gradle
...
include ':react-native-uvc-camera'
project(':react-native-uvc-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-uvc-camera/android')
include ':usbCameraCommon'
project(':usbCameraCommon').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-uvc-camera/usbCameraCommon')
include ':libuvccamera'
project(':libuvccamera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-uvc-camera/libuvccamera')
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
  • In android/app/build.gradle
...
android {
    ...
    defaultConfig {
        ...
        minSdkVersion 18
        ...
    }
    ...
}
...
repositories {
    maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
}

dependencies {
    compile project(':react-native-uvc-camera')
    compile ('com.facebook.react:react-native:0.51.0') { force = true }
    ...
}
  • In android/app/src/main/AndroidManifest.xml
...
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-sdk
        android:minSdkVersion="18"

To enable video recording feature you have to add the following code:

    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  • In android/build.gradle
...
ext {
    compileSdkVersion           = 26
    targetSdkVersion            = 26
    buildToolsVersion           = "26.0.2"
    googlePlayServicesVersion   = "12.0.1"
    supportLibVersion           = "27.1.0"
    versionBuildTool            = "26.0.2"
    versionCompiler             = 26
    versionTarget               = 26
    commonLibVersion            = "1.5.20"
    javaSourceCompatibility     = JavaVersion.VERSION_1_7
    javaTargetCompatibility     = JavaVersion.VERSION_1_7
}

Usage

Take a look into this RNCamera doc.

UvcCamera Properties additional to RNCamera:

rotation

Values: 0, 90, 180, or 270.

Most USB cameras have different rotation by default. It adjusts your camera rotation by your own.

Customization

As said in android/src/main/java/org/reactnative/cameraview/CameraUvc.java :

    public void onStartPreview(){
        // some USB camera will not return onPictureTaken and onVideoRecorded by uncomment some of bellow, test them by your own
        // updateAutoFocus();
        // updateFlash();
        // updateFocusDepth();
        // updateWhiteBalance();
        // updateZoom();
    }

react-native-uvc-camera's People

Contributors

alexey-pelykh avatar bryant1410 avatar flyskywhy avatar rehlma avatar saki4510t avatar w-shackleton avatar wf9a5m75 avatar zoltanpillio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.