UNPKG

2.62 kBMarkdownView Raw
1# expo-camera
2
3A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to the app's cache. Morever, the component is also capable of detecting faces and bar codes appearing on the preview.
4
5# API documentation
6
7- [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/camera.md)
8- [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/camera/)
9
10# Installation in managed Expo projects
11
12For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/camera/).
13
14# Installation in bare React Native projects
15
16For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
17
18### Add the package to your npm dependencies
19
20```
21expo install expo-camera
22```
23
24### Configure for iOS
25
26Add `NSCameraUsageDescription` key to your `Info.plist`:
27
28```xml
29<key>NSCameraUsageDescription</key>
30<string>Allow $(PRODUCT_NAME) to use the camera</string>
31```
32
33Run `npx pod-install` after installing the npm package.
34
35### Configure for Android
36
37This package automatically adds the `CAMERA` permission to your app. If you want to record videos with audio, you have to include the `RECORD_AUDIO`.
38
39```xml
40<!-- Added permissions -->
41<uses-permission android:name="android.permission.CAMERA" />
42
43<!-- Optional permissions -->
44<uses-permission android:name="android.permission.RECORD_AUDIO" />
45```
46
47Adjust the `android/build.gradle` to add a new `maven` block after all other repositories as described below:
48
49```gradle
50allprojects {
51 repositories {
52
53 // * Your other repositories here *
54
55 // * Add a new maven block after other repositories / blocks *
56 maven {
57 // expo-camera bundles a custom com.google.android:cameraview
58 url "$rootDir/../node_modules/expo-camera/android/maven"
59 }
60 }
61}
62```
63
64The sourcecode for `cameraview` can be found at [`expo/cameraview`](https://github.com/expo/cameraview).
65
66# Contributing
67
68Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).