react-native-giraffeplayer2
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

react-native-giraffeplayer2

Video Player based on GiraffePlayer2 for react-native

Only Android support now.

Getting started

$ npm install react-native-giraffeplayer2 --save

Screen

Usage

import React from 'react';
import {StyleSheet, View, Text, TouchableOpacity} from 'react-native';
 
import GiraffePlayer2 from 'react-native-giraffeplayer2';
 
export default function App() {
  React.useEffect(() => {
    GiraffePlayer2.setShowTopBar(true);
    GiraffePlayer2.setFullScreenOnly(true);
  }, []);
 
  const _handleClickPlay = () => {
    GiraffePlayer2.setTitle('Demo');
    GiraffePlayer2.play('http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4');
  };
 
  return (
    <View style={styles.body}>
      <Text style={styles.title}>GiraffePlayer2</Text>
      <TouchableOpacity style={styles.button} onPress={_handleClickPlay}>
        <Text>Play</Text>
      </TouchableOpacity>
    </View>
  );
}
 
const styles = StyleSheet.create({
  button: {
    backgroundColor: '#c4c4c4',
    borderRadius: 4,
    paddingVertical: 12,
    paddingHorizontal: 32,
  },
  body: {
    justifyContent: 'center',
    alignItems: 'center',
    flex: 1,
  },
  title: {
    fontSize: 20,
    marginBottom: 12,
  },
});

API

Config

  • setTitle(title) - set title => title: String
  • setFullScreenOnly(val) - set fullscreen => val: Boolean
  • setAspectRatio(val) - set aspect ratio => AspectRatio: String
  • setShowTopBar(SCALE_TYPE) - set show top bar type => val: Boolean

Initialize

  • play(url) - play video => url: String

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i react-native-giraffeplayer2

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

8.06 MB

Total Files

16

Last publish

Collaborators

  • grovertb