@venomousone/rn-videokit
v0.1.1
Published
A gesture-driven, composable video player kit for React Native
Maintainers
Readme
@venomousone/rn-videokit
A gesture-driven, composable video player kit for React Native.
Built on react-native-video v6+, Reanimated 4, and Gesture Handler 2.
Features
- ▶️ Play / pause with animated controls
- ⏩ Double-tap left/right to seek ±N seconds with ripple animation
- ⚡️ Long-press for 2× speed
- 🔆 Swipe up/down on left side to adjust brightness
- 🔊 Swipe up/down on right side to adjust volume
- ⛶ Fullscreen via button (Modal-based, no activity change)
- 📶 Buffered progress indicator on scrubber
- 🎨 Themeable accent colors
- 🧩 Headless
useVideoPlayerhook for custom UIs - 📦 100% TypeScript
Installation
yarn add @venomousone/rn-videokitPeer dependencies
Install all peer dependencies in your app:
yarn add react-native-video \
react-native-reanimated \
react-native-gesture-handler \
react-native-worklets \
react-native-orientation-locker \
react-native-volume-manager \
react-native-svg \
@reeq/react-native-device-brightnessThen run pod install:
cd ios && pod installNative setup
react-native-gesture-handler — wrap your root component:
import { GestureHandlerRootView } from 'react-native-gesture-handler';
export default function App() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
{/* your app */}
</GestureHandlerRootView>
);
}react-native-orientation-locker (iOS) — add to AppDelegate.swift:
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return Orientation.getOrientation()
}react-native-orientation-locker (Android) — add to AndroidManifest.xml:
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"And in MainActivity.kt:
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
val intent = Intent("onConfigurationChanged")
intent.putExtra("newConfig", newConfig)
sendBroadcast(intent)
}Usage
Basic
import { VideoKit } from '@venomousone/rn-videokit';
<VideoKit
source={{ uri: 'https://example.com/video.m3u8' }}
poster="https://example.com/thumb.jpg"
autoPlay
style={{ width: '100%', aspectRatio: 16 / 9 }}
/>;With safe area (recommended for fullscreen)
import { useSafeAreaInsets } from 'react-native-safe-area-context';
function Player() {
const insets = useSafeAreaInsets();
return (
<VideoKit
source={{ uri: '...' }}
safeAreaInsets={insets}
onFullscreenChange={(isFullscreen) => {
// orientation is locked automatically by the library
console.log('fullscreen:', isFullscreen);
}}
/>
);
}Disable specific controls
<VideoKit
source={{ uri: '...' }}
controls={{
speed: false, // hide speed button
volume: false, // hide mute button
}}
/>Theming
<VideoKit
source={{ uri: '...' }}
theme={{
accentColor: '#ff0000', // scrubber thumb and played track
controlsTint: '#ffffff', // icon color
overlayColor: 'rgba(0,0,0,0.6)',
}}
/>Headless (custom UI)
import { VideoPlayerProvider, useVideoPlayer } from '@venomousone/rn-videokit';
function MyControls() {
const { play, pause, seek, status, currentTime, duration } = useVideoPlayer();
return (
// your own controls UI
);
}
function MyPlayer() {
return (
<VideoPlayerProvider>
<MyVideoSurface />
<MyControls />
</VideoPlayerProvider>
);
}Props
| Prop | Type | Default | Description |
| ---------------------- | ----------------------------------- | ------- | ---------------------------------------------- |
| source | { uri: string } \| number | — | Required. Video URI or local require() |
| poster | string | — | Thumbnail shown before first frame |
| autoPlay | boolean | false | Start playing immediately on mount |
| loop | boolean | false | Loop playback |
| muted | boolean | false | Mute audio |
| controls | VideoKitControlsConfig \| boolean | true | Control which buttons render |
| theme | VideoKitTheme | — | Visual theming |
| autoHideDelay | number | 3000 | Ms before controls fade (while playing) |
| doubleTapSeekSeconds | number | 10 | Seconds to seek on double-tap |
| safeAreaInsets | EdgeInsets | — | Pass from useSafeAreaInsets() for fullscreen |
| style | StyleProp<ViewStyle> | — | Container style |
| onProgress | (p: VideoProgress) => void | — | Fires every 250ms during playback |
| onEnd | () => void | — | Fires when video ends |
| onError | (e: Error) => void | — | Fires on playback error |
| onBuffer | (isBuffering: boolean) => void | — | Fires on buffer state change |
| onFullscreenChange | (isFullscreen: boolean) => void | — | Fires on fullscreen toggle |
VideoKitControlsConfig
| Key | Default |
| ------------ | ------- |
| playPause | true |
| scrubber | true |
| time | true |
| volume | true |
| fullscreen | true |
| speed | true |
VideoKitTheme
| Key | Default |
| -------------- | -------------------- |
| accentColor | '#ffffff' |
| controlsTint | '#ffffff' |
| overlayColor | 'rgba(0,0,0,0.45)' |
| trackHeight | 3 |
Gesture reference
| Gesture | Action | | --------------------------- | -------------------- | | Tap | Toggle controls | | Double tap left (35% zone) | Seek −N seconds | | Double tap right (35% zone) | Seek +N seconds | | Long press | 2× speed while held | | Swipe up/down — left half | Adjust brightness | | Swipe up/down — right half | Adjust system volume | | Swipe up | Enter fullscreen | | Swipe down (in fullscreen) | Exit fullscreen |
Roadmap
- [x] v0.1 — Core player, gestures, controls, fullscreen
- [ ] v0.* — Quality selector, chapter markers
- [ ] v0.* — Picture-in-Picture
- [ ] v0.* — Subtitles / captions
- [ ] v0.* — AirPlay / Chromecast
License
MIT © Oluwamurewa
