Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-video-player

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-video-player

A video player for React Native with controls

  • 0.14.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

PropDescription
videoThe video source to pass to react-native-video.
thumbnailAn Image source to use as thumbnail before the video gets loaded.
endThumbnailAn Image source to use as thumbnail after the video has ended.
videoWidthWidth of the video to calculate the player size.
videoHeightHeight of the video to calculate the player size.
durationDuration can not always be figured out (e.g. when using hls), this can be used as fallback.
showDurationShow duration in seek bar.
autoplayStart the video automatically.
defaultMutedStart the video muted, but allow toggling.
mutedStart the video muted and hide the mute toggle button.
controlsTimeoutTimeout when to hide the controls.
disableControlsAutoHideDisable auto hiding the controls.
disableFullscreenDisable the fullscreen button.
loopLoop the video after playback is done.
resizeModeThe video's resizeMode. defaults to contain and is passed to react-native-video.
hideControlsOnStartHides the controls on start video.
endWithThumbnailReturns to the thumbnail after the video ends. If an endThumbnail image is not specified then the image specified in thumbnail is shown.
disableSeekDisable video seeking.
pauseOnPressAutomatically pause/play when pressing the video player anywhere.
fullScreenOnLongPressAutomatically show video on fullscreen when doing a long press.
onStartCallback for when the start button is pressed.
onPlayPressCallback for when the play button is pressed.
onHideControlsCallback for when the controls are being hide.
onShowControlsCallback for when the controls are being shown.
customStylesThe 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

MethodPropsDescription
seektime: floatSeek the player to the given time.
stopStop the playback and reset back to 0:00.
pausePause the playback.
resumeResume 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

Keywords

FAQs

Package last updated on 29 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc