
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
react-native-scrubber
Advanced tools
A Scrubber component for handling audio/video within React Native
A video/audio scrubber for react native.
npm install react-native-scrubber
or
yarn add react-native-scrubber
import Scrubber from 'react-native-scrubber'
If you are using Expo, you are done.
If you don't use Expo, install and link react-native-gesture-handler.
| Name | Type | Description |
|---|---|---|
value | Number | The current value of the video/audio. |
bufferedValue | Number | The current buffered value of the video/audio. |
totalDuration | Number | The total duration of the video/audio (Needed to calculated animations within the scrubber). Note If you supply a totalDuration of 0 the starting and ending number will display both as --:-- since we require the totalDuration to display those numbers. |
onSlidingStart | Function | Optional callback that is called when the user starts scrubbing. |
onSlide | Function | Optional callback that is called while the user is scrubbing. The callback takes the current scrubbing position in seconds as its first argument. |
onSlidingComplete | Function | Callback that is called when the user releases the slider, regardless if the value has changed. The callback takes the current scrubbing position in seconds as its first argument. |
trackBackgroundColor | String | Hex color representing the color of the background (Unfilled) track |
trackColor | String | Hex color representing the color of the foregroud (Filled) track. |
bufferedTrackColor | String | Hex color representing the color of the buffered track which sits inbetween the background track and the progress track. |
scrubbedColor | String | Hex color represending the color of the foregroud (Filled) track and the dot when the scrubber is active. Also changes the color of the starting number. |
displayedValueStyle | Object | This stlye is applied to both the displayed values |
displayValues | Boolean | Defaults to true, if set false will hide the numbers under the scrub bar. |
import React, { Component } from 'react'
import { View, Text } from 'react-native'
import Scrubber from 'react-native-scrubber'
class Example extends Component {
state = {
scrubberValue: 0,
}
componentDidMount() {
this.valueChangeInterval = setInterval(() => {
this.setState({
scrubberValue: this.state.scrubberValue + 1,
})
}, 200);
}
componentWillUnmount() {
clearInterval(this.valueChangeInterval);
}
valueChange = value => {
this.setState({ scrubberValue: value })
}
render() {
return (
<View>
<Scrubber
value={this.state.scrubberValue}
onSlidingComplete={this.valueChange}
totalDuration={7000}
trackColor='#666'
scrubbedColor='#8d309b'
/>
</View>
);
}
}
export default Example
A Scrubber is a component used for audio or video to choose where in the media the user wants to navigate to.
I tried implementing a slider in my app at first and the problem with a slider is new values will be constantly coming in due to the audio or video playing, and a slider will jerk around while the user is scrubbing. Also a user can't fine tune the exact value on large values. Also also the React Native Slider has a limiting styling and no nice animations.
FAQs
A Scrubber component for handling audio/video within React Native
The npm package react-native-scrubber receives a total of 2,348 weekly downloads. As such, react-native-scrubber popularity was classified as popular.
We found that react-native-scrubber demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.