1.0.1 • Published 4 years ago
react-native-vrplayer v1.0.1
react-native-vrplayer
Table of Contents
Installation
Using npm:
npm install react-native-vrplayer -save
link:
1、Android:
Run react-native link react-native-vrplayer
to link the react-native-vrplayer library.
Or if you have trouble, make the following additions to the given files manually:
android/settings.gradle
include ':react-native-vrplayer'
project(':react-native-vrplayer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vrplayer/android')
android/app/build.gradle
dependencies {
...
implementation project(':react-native-vrplayer')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
}
MainApplication.java
On top, where imports are:
import com.zjiaxin.vrvideo.RNVRVideoPackage;
Add the RNVRVideoPackage
class to your list of exported packages.
@Override
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new RNVRVideoPackage()
);
}
2、iOS:
...
Platform
- Android (support)
- iOS (nonsupport now)
Usage
import { VRVideoPlayer } from 'react-native-vrplayer';
class VRVideoPage extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<View style={{ flex: 1 }}>
<VRVideoPlayer
url={'xxx.mp4'}
paused={false}
style={{ flex: 1 }}
/>
</View>
);
}
}
export default VRVideoPage;