• Stars
    star
    517
  • Rank 85,558 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A video player for React Native with controls

Why do you use this library?

I'd like to learn more about why people use this library over others. If you have the time, please leave a reaction at #166

React Native Video Player npm

A React Native video player with a few controls. This player uses react-native-video for the video playback.

Looking for maintainers! This project is currently no longer maintained. Please respond to issue #157 to become the new maintainer.

demo gif

Installation

yarn add react-native-video-player react-native-video react-native-vector-icons

or

npm install --save react-native-video-player react-native-video react-native-vector-icons

Then, for React Native >= 0.60:

cd ios
pod install

Add the following at the beginning of ./android/app/build.gradle on Android (required for react-native-vector-icons to work):

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

Add the following in your Info.plist file on iOS (required for react-native-vector-icons to work):

<key>UIAppFonts</key>
<array>
	<string>MaterialIcons.ttf</string>
</array>

For React Native < 0.60

react-native link react-native-video
react-native link react-native-vector-icons

Important Note

To avoid Build Error "Could not find com.yqritc:android-scalablevideoview:1.0.4." Add jcenter() to your build.gradle file present at the android folder (add it under allprojects). after the adding the changes, code would look like

For more info please refer to LINK

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        jcenter()
  }
}

Example

<VideoPlayer
    video={{ uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' }}
    videoWidth={1600}
    videoHeight={900}
    thumbnail={{ uri: 'https://i.picsum.photos/id/866/1600/900.jpg' }}
/>

Props

Prop Description
video The video source to pass to react-native-video.
thumbnail An Image source to use as thumbnail before the video gets loaded.
endThumbnail An Image source to use as thumbnail after the video has ended.
videoWidth Width of the video to calculate the player size.
videoHeight Height of the video to calculate the player size.
duration Duration can not always be figured out (e.g. when using hls), this can be used as fallback.
showDuration Show duration in seek bar.
autoplay Start the video automatically.
defaultMuted Start the video muted, but allow toggling.
muted Start the video muted and hide the mute toggle button.
controlsTimeout Timeout when to hide the controls.
disableControlsAutoHide Disable auto hiding the controls.
disableFullscreen Disable the fullscreen button.
loop Loop the video after playback is done.
resizeMode The video's resizeMode. defaults to contain and is passed to react-native-video.
hideControlsOnStart Hides the controls on start video.
endWithThumbnail Returns to the thumbnail after the video ends. If an endThumbnail image is not specified then the image specified in thumbnail is shown.
disableSeek Disable video seeking.
pauseOnPress Automatically pause/play when pressing the video player anywhere.
fullScreenOnLongPress Automatically show video on fullscreen when doing a long press.
onStart Callback for when the start button is pressed.
onPlayPress Callback for when the play button is pressed.
onHideControls Callback for when the controls are being hide.
onShowControls Callback for when the controls are being shown.
customStyles The player can be customized in this object, see customStyles for the options.

All other props are passed to the react-native-video component.

customStyles

  • wrapper
  • video
  • controls
  • playControl
  • controlButton
  • controlIcon
  • playIcon
  • seekBar
  • seekBarFullWidth
  • seekBarProgress
  • seekBarKnob
  • seekBarBackground
  • thumbnail
  • playButton
  • playArrow
  • videoWrapper

Methods

Method Props Description
seek time: float Seek the player to the given time.
stop Stop the playback and reset back to 0:00.
pause Pause the playback.
resume Resume the playback.

Future features

  • Make seek bar seekable.
  • Make player customizable.
  • Add volume control
  • Add fullscreen button
    • Add fullscreen button for Android (See PR #38 if you need fullscreen in Android)
  • Add loader
  • Add video duration/play time

More Repositories

1

react-native-video

A <Video /> component for react-native
Swift
7,176
star
2

react-native-notificated

โšก๏ธReact Native toast notifications
TypeScript
380
star
3

rn-emoji-keyboard

Super performant, lightweight, fully customizable emoji picker ๐Ÿš€
TypeScript
340
star
4

nextjs-authentication

Next.js app with token-based authentication
TypeScript
46
star
5

multistep-form-xstate-formik

Multistep form handling | React Native, TypeScript, XState and Formik
TypeScript
43
star
6

holidaily

๐ŸŒดโ˜€๏ธ๐ŸŒดโ˜€๏ธ๐ŸŒด
TypeScript
40
star
7

RT7-example

Code for the React Table 7 article
JavaScript
39
star
8

JWTAuthBackend

Express.js app with token-based authentication
TypeScript
24
star
9

quibi-cards-swipe

๐Ÿ“ฑ Recreating Quibi cards-swipe list with React Native and Reanimated ๐Ÿ”ฅ
TypeScript
17
star
10

hooks-workshops-solutions

๐Ÿš€ Example solutions to React Hooks workshops quests!
TypeScript
16
star
11

rn-reanimated-olx-animation

OLX's Welcome screen animation recreated with React Native and Reanimated library (v1 API), part of an article
TypeScript
11
star
12

rn-bottom-nav

TypeScript
10
star
13

react-native-video-visionos-example

Example of usage react-native-video in visionOS
Objective-C
7
star
14

reanimated2-slider

Exploring the Reanimated2 library. Repo is part of a article https://thewidlarzgroup.com/reanimated2-slider/
JavaScript
7
star
15

rn-oauth-deep-universal-asset-links

๐Ÿ“ฒ Deep Links / Universal Links / App Links
TypeScript
6
star
16

reanimated2-slider-article

Exploring the Reanimated2 library. Repo contains code from the article.
JavaScript
6
star
17

async-params-phoenix-socket

๐Ÿงช Phoenix Socket - overwrite default implementation in order to use async code in e.g. params setter
TypeScript
5
star
18

hooks-presentation

This is the React Hooks: useState and useEffect presentation for workshops.
MDX
4
star
19

react-native-modals

React native modals playground for the linked article.
TypeScript
4
star
20

charts-library

TypeScript
4
star
21

Spotify-Heart-Reanimated

Spotify heart (like button) animation recreated with React Native, Typescript, Styled components and Reanimated 2. The repository is an integral part of the Spotify Heart Reanimated Article
TypeScript
3
star
22

react-dnd-example

TypeScript
3
star
23

rn-emoji-compat

Support new Emojis on older Android versions
Java
3
star
24

ramda-playground

TypeScript
2
star
25

hooks-workshop-task-2021

HTML
2
star
26

react-native-video-tvos-example

Example of usage react-native-video library in TVOS
TypeScript
2
star
27

reanimated-color-picker

TypeScript
1
star
28

The-Hooks-Museum

React Snippets
TypeScript
1
star