Git Product home page Git Product logo

react-native-video-ui's Introduction

react-native-video-controls

Controls for the React Native <Video> component at react-native-video. For support with RN 0.38.x or lower use version 1.0.x.

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, error handling and timer toggle that can switch between time remaining and current time when tapped.

How it looks

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 onBack 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.

By default, tapping the screen anywhere will show the player controls. After 10s the controls disappear. Double tapping will toggle fullscreen.

Installation

Run npm install --save react-native-video react-native-video-controls

Then run react-native link react-native-video

If you're using RN < 39 run npm install --save [email protected]. Note this version includes react-native-video as a normal dependency instead of a peer-dependency.

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 relies on using the built-in <Navigator> functionality in React Native and pops the current scene off the stack. This can be overridden if desired, see the API for more details.

// At the top where our imports are...
import VideoPlayer from 'react-native-video-controls';


// in the component's render() function
<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

    // react-native-video props
    // Pass any prop that the <Video> element may accept

    // settings
    controlTimeout={ 15000 }         // hide controls after ms of inactivity.
    navigator={ navigator }          // prop from React Native <Navigator> component
    seekColor={ '#FFF' }             // fill/handle colour of the seekbar
    videoStyle={ {} }                // Style appended to <Video> component
    style={ {} }                     // Style appended to <View> container

    // event callbacks
    onError={ () => {} }             // Fired when an error is encountered on load
    onBack={ () => {} }              // Function fired when back button is pressed.
    onEnd={ () => {} }               // Fired when the video is complete.

/>

react-native-video-ui's People

Contributors

jsm avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.