Skip to content

Commit

Permalink
正式发布1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fov42550564 committed Oct 11, 2016
1 parent 4cf1832 commit 99e6fa7
Show file tree
Hide file tree
Showing 21 changed files with 1,509 additions and 48 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -2,9 +2,11 @@
*.DS_Store
.DS_Store
*Thumbs.db
*.iml
.gradle
.idea
node_modules
npm-debug.log
/android/RCTDes/build
/android/build
/ios/**/*xcuserdata*
/ios/**/*xcshareddata*
12 changes: 12 additions & 0 deletions .npmignore
@@ -0,0 +1,12 @@
*.DS_Store
.DS_Store
*Thumbs.db
.gradle
.idea
*.iml
npm-debug.log
node_modules
/android/build
/ios/**/*xcuserdata*
/ios/**/*xcshareddata*

Empty file modified LICENSE 100644 → 100755
Empty file.
105 changes: 102 additions & 3 deletions README.md 100644 → 100755
@@ -1,7 +1,106 @@
# React Native media-capture (remobile)
A media-capture for react-native
# React Native Capture (remobile)
A cordova capture for react-native, support for ios and android

## Installation
```sh
npm install react-native-media-capture --save
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<ReactPackage> 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 (
<View style={styles.container}>
<Button onPress={this.taskVideo}>摄像</Button>
<Text>{filePath}</Text>
</View>
);
},
});


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
26 changes: 26 additions & 0 deletions android/build.gradle
@@ -0,0 +1,26 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+'
compile project(':react-native-cordova')
}
4 changes: 4 additions & 0 deletions android/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.remobile.capture">
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
</manifest>

0 comments on commit 99e6fa7

Please sign in to comment.