VLC Player for react-native
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
android [ UPDATE ] Oct 6, 2017
.gitignore [ RELEASE ] v0.0.1 Mar 25, 2016
.npmignore [ RELEASE ] v0.0.1 Mar 25, 2016
LICENSE Initial commit Mar 25, 2016
README.md [ ADD ] button scale Oct 14, 2016
index.js [ FIX ] VLCPlayer export Mar 26, 2016
package.json [ UPDATE ] release Oct 6, 2017

README.md

React-Native-VLC-Player

VLC Player for react-native

Only Android support now.

Integrate

Android
Install via npm

npm i react-native-vlc-player --save

Add dependency to android/settings.gradle
...
include ':libvlc'
project(':libvlc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vlc-player/android/libvlc')

include ':react-native-vlc-player'
project(':react-native-vlc-player').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vlc-player/android/vlc')
Add android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-vlc-player')
}
Register module in MainApplication.java
import com.ghondar.vlcplayer.*;  // <--- import

@Override
 protected List<ReactPackage> getPackages() {
   return Arrays.<ReactPackage>asList(
      new VLCPlayerPackage(),  // <------- here
      new MainReactPackage()
   );
 }

Usage

import React, { AppRegistry, StyleSheet, Component, View, Text, TouchableHighlight } from 'react-native'

import { play } from 'react-native-vlc-player'

class Example extends Component {
  constructor(props, context) {
    super(props, context)
  }

  render() {

    return (
      <View style={styles.container}>

        <TouchableHighlight
          onPress={() => { play('file:///storage/emulated/0/example.avi') }}>
            <Text >Play Video!</Text>
        </TouchableHighlight>

      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  }
});

AppRegistry.registerComponent('example', () => Example);

LICENSE

MIT