react-native-video-controls
Controls for the React Native <Video>
component at react-native-video.
Features
This package contains a simple set of GUI controls that work with the react-native-video <Video>
component. This includes a back button, volume bar, fullscreen toggle, play/pause toggle, seekbar, title and timer toggle that can switch between time remaining and current time when tapped.
By default the <VideoPlayer>
accepts a navigator property from React's built-in <Navigator>
which pops the current scene off the stack when tapped. Alternatively you can provide your own goBack prop to the component to override this functionality.
You should also provide your own onEnd prop to the component so it knows what to do when a video ends playback.
Installation
Run npm install --save react-native-video-controls
Then run react-native link react-native-video
Usage
The <VideoPlayer>
component follows the API of the <Video>
component at react-native-video. It also takes a number of additional props which are outlined in the API section.
For basic operation the <VideoPlayer>
component requires a video source and a navigator property. The default back button functionality in the component pops the navigator. This can be overridden if desired, see the API for more details.
import VideoPlayer from 'react-native-video-controls';
<VideoPlayer
source={{ uri: 'https://vjs.zencdn.net/v/oceans.mp4' }}
navigator={ this.props.navigator }
/>
API
The <VideoPlayer>
component can take a number of inputs to customize it as needed. They are outlined below:
<VideoPlayer
playWhenInactive={ false }
playInBackground={ false }
resizeMode={ 'contain' }
paused={ false }
repeat={ false }
muted={ false }
volume={ 1 }
rate={ 1 }
title={}
onLoadStart={}
onProgress={}
onError={}
onLoad={}
onEnd={}
goBack={}
/>