react-native-vlc-player
Getting started
$ npm install react-native-vlc-player --save
Dependencies
$ npm install react-native-vector-icons --save
Manual installation
Copy Ionicons.ttf from node_modules/react-native-vector-icons/Fonts
to android/app/src/main/assets/fonts
Android
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:
...allprojects { ... dependencies { ...+ maven {+ url("https://jitpack.io")+ } }}
Usage
;;// Import library; vlcplayer = React; { console } { return <View style= stylescontainer > <VlcPlayer ref=thisvlcplayer style= width: 300 height: 200 paused=false autoplay=true source= uri: 'file:///storage/emulated/0/Download/example.mp4' autoplay: true initOptions: '--codec=avcodec' /> </View> ; } const styles = StyleSheet;
Props
<VLCPlayer ref='vlcplayer' paused=thisstatepaused style=stylesvlcplayer source=uri: thispropsuri initOptions: '--codec=avcodec' onVLCProgress=thisonProgress onVLCEnded=thisonEnded onVLCStopped=thisonEnded onVLCPlaying=thisonPlaying onVLCBuffering=thisonBuffering onVLCPaused=thisonPaused/>
Static Methods
seek(seconds)
this.refs['vlcplayer'].seek(0.333);
snapshot(path)
this.refs['vlcplayer'].snapshot(path);