https://github.com/remobile/react-native-capture
https://github.com/remobile/react-native-capture
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/remobile/react-native-capture
- Owner: remobile
- License: mit
- Created: 2015-11-12T00:55:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-16T03:30:25.000Z (over 7 years ago)
- Last Synced: 2025-03-25T09:17:48.818Z (about 2 months ago)
- Language: Objective-C
- Size: 2.16 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-native - react-native-media-capture ★6 - A media-capture for react-native (Components / Media)
README
# React Native Capture (remobile)
A cordova capture for react-native, support for ios and android## Installation
```sh
npm install @remobile/react-native-capture --save
```
### Installation (iOS)
* Drag RCTCapture.xcodeproj to your project on Xcode.
* Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag libRCTCapture.a from the Products folder inside the RCTCapture.xcodeproj.
* Look for Header Search Paths and make sure it contains both $(SRCROOT)/../../../react-native/React as recursive.### Installation (Android)
```gradle
...
include ':react-native-capture'
project(':react-native-capture').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-capture/android')
```* In `android/app/build.gradle`
```gradle
...
dependencies {
...
compile project(':react-native-capture')
}
```* register module (in MainApplication.java)
```java
......
import com.remobile.capture.RCTCapturePackage; // <--- import......
@Override
protected List getPackages() {
......
new RCTCapturePackage(), // <------ add here
......
}```
## Usage
### Example
```js
var React = require('react');
var ReactNative = require('react-native');
var {
StyleSheet,
View,
Image
} = ReactNative;var Capture = require('@remobile/react-native-capture');
var Button = require('@remobile/react-native-simple-button');module.exports = React.createClass({
getInitialState () {
return {
filePath: '',
};
},
taskVideo() {
Capture.captureVideo((mediaFiles)=>{
let filePath = mediaFiles[0].fullPath;
this.setState({filePath});
}, ()=>{
Toast('录制失败');
}, {limit:1});
},
render() {
const {filePath} = this.state;
return (
摄像
{filePath}
);
},
});var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: 'transparent',
},
});
```### HELP
* look https://github.com/apache/cordova-plugin-media-capture### thanks
* this project come from https://github.com/apache/cordova-plugin-media-capture### see detail use
* https://github.com/remobile/react-native-template