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

react-native-video-basic-controls

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-video-basic-controls

Controls for the React Native <Video> component at react-native-video.

  • 0.1.16
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
180
decreased by-59.37%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-video-basic-controls

React native video controls. Controls for the react-native-video component for Android and IOS.

Features

  • Full screen support.
  • Change volume and brightness with Swipe/ Slider controls.
  • Seek forword and back button.
  • Slider customisation.
  • Swipe controls left-side brightness & right-side volume.

Installation

npm install react-native-video-basic-controls
For Brightness or Volume controls install react-native-system-setting
npm install react-native-system-setting

link react-native-system-setting

react-native link

Add permission in android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="YourPackageName"
    android:versionCode="1"
    android:versionName="1.0">

    <!-- setBrightness() & setScreenMode() & saveBrightness() -->
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />

    ...

</manifest>

Usage

// Require the module
import MediaControls, {
  PLAYER_STATES,
} from 'react-native-video-basic-controls';

const App = () => {
  const [currentTime, setCurrentTime] = useState(0);
  const [duration, setDuration] = useState(0);
  const [isFullScreen, setIsFullScreen] = useState(false);
  const [isLoading, setIsLoading] = useState(true);
  const [paused, setPaused] = useState(false);
  const [playerState, setPlayerState] = useState(PLAYER_STATES.PLAYING);

  return (
    <View style={styles.container}>
      <Video {...videoProps} />
      <MediaControls
        duration={duration}
        isLoading={isLoading}
        mainColor="orange"
        onFullScreen={noop}
        onPaused={onPaused}
        onReplay={onReplay}
        onSeek={onSeek}
        onSeeking={onSeeking}
        playerState={playerState}
        progress={currentTime}
      >
        <MediaControls.Toolbar>// ...</MediaControls.Toolbar>
      </MediaControls>
    </View>
  );
};

Refer to example for implementation of this project

Props

Main Props

PropTypeOptionalDefaultDescription
progressnumberNoCurrent time of the media player
durationnumberNoTotal duration of the media
playerStatenumberNoCould be PLAYING, PAUSED or ENDED (take a look at constants section)
onPausedfunctionNoTriggered when the play/pause button is pressed. It returns the new toggled value (PLAYING or PAUSED)
onSeekfunctionNoTriggered when the user released the slider
onReplayfunctionYesTriggered when the replay button is pressed
onSeekingfunctionYesTriggered when the user is interacting with the slider

Other Props

PropTypeOptionalDefaultDescription
isLoadingbooleanYesfalseWhen is loading (displays loading icon).
fadeOutDelaynumberYes5000Allows to customize the delay between fade in and fade out transition.
onFullScreenfunctionYesCustom fullscreen function, triggered when the fullscreen button is pressed.
showOnStartbooleanYestruecontrols the visibility of the controls during the initial render.
fullScreenIconLcomponentYesFullscreen icon (landscape mode).
fullScreenIconPcomponentYesFullscreen icon (Portrait mode).
bufferValuenumberYesAdd buffer value to Slider.
onSkipForStringYesTo seek forward.
onSkipBackStringYesTo seek back.
showVolumebooleanYesfalseShow Volume controls.
showBrightnessbooleanYesfalseShow Brightness controls.
sliderScalenumberYes10Scale brightness/ volume slider on press.
sliderTypeStringYes'Slider'Select brightness/ volume slider type(Slider/swipe).

Style Props

PropTypeOptionalDefaultDescription
mainColorstringYesrgba(12, 83, 175, 0.9)Change custom color to the media controls
containerStyleStyleSheetYesApply styles to the container
toolbarStyleStyleSheetYesApply styles to <MediaControls.Toolbar>
iconStyleStyleSheetYesApply styles to fullscreen icon
sliderStyleStyleSheetYesApply styles to Slider
bufferColorStringYes#fffChange color of buffer view
VSliderOuterStylesStyleSheetYesApply styles to volume/brightness outer slider.
VSliderInnerStylesStyleSheetYesApply styles to volume/brightness track slider.
sliderStyle={{
  thumbStyle:{
     // ...
   },
   trackStyle:{
     // ...
   },
   containerStyle:{
     // ...
   }
}}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Package last updated on 09 Nov 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