React native video player component, used for Android, iOS
npm install react-native-native-video-player --save
Use rnpm to automatically complete the installation:
rnpm link react-native-native-video-player
or link manually like so:
- Add RNVideoPlayer in ios folder to your ios project
// file: android/settings.gradle
...
include ':react-native-native-video-player'
project(':react-native-native-video-player').projectDir = new File(settingsDir, '../node_modules/react-native-native-video-player/android')
// file: android/app/build.gradle
...
dependencies {
...
compile project(':react-native-native-video-player')
}
// file: android/app/src/main/java/com/<...>/MainApplication.java
...
import com.wog.videoplayer.VideoPlayerPackage;; // <-- add this import
public class MainApplication extends Application implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VideoPlayerPackage() // <-- add this line
);
}
...
}
var VideoPlayer = require('react-native-native-video-player');
/**
* The method will launch native module
* @param {String} url Video link
*/
VideoPlayer.showVideoPlayer(url);