react-native-intent-exoplayer

0.0.1 • Public • Published

React Native: react-native-intent-exoplayer

GitHub package version github home platforms github home npm

github issues github closed issues Issue Stats github license

📖 Getting started

$ npm install react-native-intent-exoplayer --save

$ react-native link react-native-intent-exoplayer

Android

Add react-native-intent-exoplayer to your ./android/settings.gradle file as follows:

...
include ':app'
+ include ':react-native-intent-exoplayer'
+ project(':react-native-intent-exoplayer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intent-exoplayer/android/app')

Include it as dependency in ./android/app/build.gradle file:

dependencies {
    ...
    compile "com.facebook.react:react-native:+"  // From node_modules
+   compile project(':react-native-intent-exoplayer')
}

Finally, you need to add the package within the ReactInstanceManager of your MainActivity (./android/app/src/main/java/your/bundle/MainActivity.java):

import com.zappi.ui.exoplayer.PlayerPackage;  // <---- import this one 
...
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new PlayerPackage()  // <---- add this line 
    );
}

After that, you will need to recompile your project with react-native run-android.

💻 Usage

import React, { Component } from 'react';
import Player from 'react-native-intent-exoplayer';
 
type Props = {};
export default class App extends Component<Props> {
 
  constructor(props) {
    super(props);
    this.state = {
      title: 'Big Buck Bunny',
      url: 'https://www.w3schools.com/html/mov_bbb.mp4',
      sub: 'https://pastebin.com/raw/A0fDHxgK',
      subShow: true
    };
  }
 
  componentDidMount() {
    Player.play(this.state.title,this.state.url,this.state.sub,this.state.subShow)
      .then(a => {
        console.log(a);
      })
      .catch(e => console.log(e));
  }
 
  render() {
    return null;
  }
}

📜 License

This library is provided under the Apache License.

Package Sidebar

Install

npm i react-native-intent-exoplayer

Weekly Downloads

0

Version

0.0.1

License

Apache License 2.0

Unpacked Size

58.5 kB

Total Files

24

Last publish

Collaborators

  • zappi