npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-video-basic-controls

v0.1.16

Published

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

Downloads

1,125

Readme

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

| Prop | Type | Optional | Default | Description | | ----------- | -------- | -------- | ------- | ----------------------------------------------------------------------------------------------------- | | progress | number | No | | Current time of the media player | | duration | number | No | | Total duration of the media | | playerState | number | No | | Could be PLAYING, PAUSED or ENDED (take a look at constants section) | | onPaused | function | No | | Triggered when the play/pause button is pressed. It returns the new toggled value (PLAYING or PAUSED) | | onSeek | function | No | | Triggered when the user released the slider | | onReplay | function | Yes | | Triggered when the replay button is pressed | | onSeeking | function | Yes | | Triggered when the user is interacting with the slider |

Other Props

| Prop | Type | Optional | Default | Description | | --------------- | --------- | -------- | -------- | ---------------------------------------------------------------------------- | | isLoading | boolean | Yes | false | When is loading (displays loading icon). | | fadeOutDelay | number | Yes | 5000 | Allows to customize the delay between fade in and fade out transition. | | onFullScreen | function | Yes | | Custom fullscreen function, triggered when the fullscreen button is pressed. | | showOnStart | boolean | Yes | true | controls the visibility of the controls during the initial render. | | fullScreenIconL | component | Yes | | Fullscreen icon (landscape mode). | | fullScreenIconP | component | Yes | | Fullscreen icon (Portrait mode). | | bufferValue | number | Yes | | Add buffer value to Slider. | | onSkipFor | String | Yes | | To seek forward. | | onSkipBack | String | Yes | | To seek back. | | showVolume | boolean | Yes | false | Show Volume controls. | | showBrightness | boolean | Yes | false | Show Brightness controls. | | sliderScale | number | Yes | 10 | Scale brightness/ volume slider on press. | | sliderType | String | Yes | 'Slider' | Select brightness/ volume slider type(Slider/swipe). |

Style Props

| Prop | Type | Optional | Default | Description | | ------------------ | ---------- | -------- | ---------------------- | ----------------------------------------------- | | mainColor | string | Yes | rgba(12, 83, 175, 0.9) | Change custom color to the media controls | | containerStyle | StyleSheet | Yes | | Apply styles to the container | | toolbarStyle | StyleSheet | Yes | | Apply styles to <MediaControls.Toolbar> | | iconStyle | StyleSheet | Yes | | Apply styles to fullscreen icon | | sliderStyle | StyleSheet | Yes | | Apply styles to Slider | | bufferColor | String | Yes | #fff | Change color of buffer view | | VSliderOuterStyles | StyleSheet | Yes | | Apply styles to volume/brightness outer slider. | | VSliderInnerStyles | StyleSheet | Yes | | Apply 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