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