react-native-video-trim
v8.2.4
Published
Video trimmer for your React Native app
Maintainers
Readme
React Native Video Trim
✨ Key features
- 📹 Video & audio: a native trimmer screen with a thumbnail timeline, or a waveform for audio files
- 🔄 Flip, rotate & crop: built-in edit toolbar with undo and redo
- 🎯 Precise trimming: optional frame-accurate cuts with hardware re-encoding
- 🔇 Mute & ⏩ speed: strip the audio or change the speed (0.25x–4x), in the editor or headless
- ⚙️ Headless APIs:
trim,compress,getFrameAt,extractAudio,toGif,merge,mixAudio - 💾 Save & share: Photos, Documents or the share sheet, plus file management helpers
- 🌐 Local & remote files: HTTPS sources with the
httpsFFmpegKit package - 🎨 Dark & light theme: with custom trimmer, handle, header and waveform colors
Installation
npm install react-native-video-trim
# or
yarn add react-native-video-trim
# iOS
npx pod-install iosExpo: run npx expo prebuild and use a development build (Expo Go is not supported). Permissions, Android build options and the HTTPS setup are covered in the installation guide.
Quick start
import { useEffect } from 'react';
import VideoTrim, { showEditor, trim } from 'react-native-video-trim';
// Open the editor (all durations are in milliseconds)
showEditor(videoUri, {
maxDuration: 60_000,
saveToPhoto: true,
});
// Listen for the result (New Architecture)
useEffect(() => {
const sub = VideoTrim.onFinishTrimming(({ outputPath }) => {
console.log('Trimmed file:', outputPath);
});
return () => sub.remove();
}, []);
// Or trim without any UI
const { outputPath } = await trim(videoUri, { startTime: 5_000, endTime: 25_000 });Old Architecture: still supported, but support will be removed over time. Events arrive through
NativeEventEmitterinstead of the default export; see the Old Architecture note.
Documentation
Everything else lives on the documentation site: https://maitrungduc1410.github.io/react-native-video-trim/
- Opening the editor and every option
- Events
- Headless APIs
- Theming, with a live playground
- Troubleshooting
- API reference
A complete demo app is in example/.
Contributing
See CONTRIBUTING.md. The docs site source is in docs/; run yarn docs:dev to work on it.
Credits
- Android: based on Android-Video-Trimmer
- iOS: UI from VideoTrimmerControl
License
MIT
