react-native-android-hikvideo-matt
v1.0.9
Published
A ReactNative Hikvision Component for android
Downloads
24
Maintainers
Readme
react-native-android-hikvideo-matt
Getting started
$ npm install react-native-android-hikvideo-matt --save
Mostly automatic installation
$ react-native link react-native-android-hikvideo-matt
Manual installation
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.matt.rn.android.hikvideo.HkplayerViewPackage;
to the imports at the top of the file - Add
new HkplayerViewPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-android-hikvideo-matt' project(':react-native-android-hikvideo-matt').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-hikvideo-matt/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-android-hikvideo-matt')
Modify android build.gradle as follow
splits {
abi {
enable true
reset()
include "armeabi-v7a"
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
Usage
import PreviewPlayer,{PlayBackPlayer} from 'react-native-android-hikvideo-matt';
render() {
return (
<View>
<PreviewPlayer uri={this.state.uri} />
// or
// <PlayBackPlayer uri={this.state.uri} segments={this.state.segments}/>
// for play back
</View>
);
}