Socket
Socket
Sign inDemoInstall

react-native-media-controls

Package Overview
Dependencies
516
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-media-controls

A sweet UI to control your video and audio components


Version published
Maintainers
1
Install size
361 kB
Created

Readme

Source

react-native-media-controls

A sweet UI component to manipulate your media

mediac

Installation

yarn add react-native-media-controls

Usage

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

  render() {
    return (
      <View style={styles.container}>
        <Video
          onEnd={this.onEnd}
          onLoad={this.onLoad}
          onLoadStart={this.onLoadStart}
          onProgress={this.onProgress}
          paused={this.state.paused}
          ref={videoPlayer => (this.videoPlayer = videoPlayer)}
          resizeMode="cover"
          source={{ uri: 'https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' }}
          style={styles.mediaPlayer}
          volume={0.0}
        />
        <MediaControls
          duration={this.state.duration}
          isLoading={this.state.isLoading}
          mainColor="orange"
          onFullScreen={this.onFullScreen}
          onPaused={this.onPaused}
          onReplay={this.onReplay}
          onSeek={this.onSeek}
          playerState={this.state.playerState}
          progress={this.state.currentTime}
          toolbar={this.renderToolbar()}
        />
      </View>
    );
  }

Props

PropTypeOptionalDefaultDescription
toolbarnodeYesAdd a custom view on the top of the controls
mainColorstringYesrgba(12, 83, 175, 0.9)Change custom color to the media controls
isLoadingboolYesfalseWhen is loading
isFullScreenboolYesfalseTo change icon state of fullscreen
progressnumberNoCurrent time of the media player
durationnumberNoTotal duration of the media
playerStatenumberNoCould be PLAYING, PAUSED or ENDED (take a look at constants section)
onFullScreenfunctionYesTriggered when the fullscreen button is pressed
onPausedfunctionNoTriggered when the play/pause button is pressed. It returns the new toggled value (PLAYING or PAUSED)
onReplayfunctionYesTriggered when the replay button is pressed
onSeekfunctionNoTriggered when the user released the slider
onSeekingfunctionYesTriggered when the user is interacting with the slider

Constants

  PLAYING,
  PAUSED,
  ENDED,

Example

Refer to the example folder to find an implementation of this project

Keywords

FAQs

Last updated on 01 Jan 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc