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

0.1.5 • Public • Published

react-native-videoplayer-fabric

video player for react native

Installation

npm install react-native-videoplayer-fabric

Usage

import * as React from 'react';

import { Button, StyleSheet, View } from 'react-native';
import { VideoPlayerComponent, VideoplayerView } from 'react-native-videoplayer-fabric';

export default function App() {
  const videoPlayerComponentRef =
    React.useRef<VideoPlayerComponent>(null);
  return (
    <View style={styles.container}>
      <VideoPlayerComponent
        ref={videoPlayerComponentRef}
        onErrorEvent={()=>{
          console.log("error")
        }}
        videoUrl="https://ia800208.us.archive.org/4/items/Popeye_forPresident/Popeye_forPresident_512kb.mp42"
        style={styles.box}
      />

      <Button title='Play' onPress={()=>{
          videoPlayerComponentRef.current?.play()
      }}/>
      <View style={{height:20}}/>
      <Button title='Pause' onPress={()=>{
             videoPlayerComponentRef.current?.pause()
      }}/>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: 'red',
  },
  box: {
    width: 300,
    height: 200,
    marginVertical: 20,
  },
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Package Sidebar

Install

npm i react-native-videoplayer-fabric

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

57.4 kB

Total Files

38

Last publish

Collaborators

  • thaitd0396
  • petervu