react-native-nitro-media-kit v0.0.3
React Native Nitro Media Kit
š„ React Native Nitro Media Kit empowers your React Native applications with robust media processing capabilities. Perform tasks like merging videos and converting images into videos with ease, all while leveraging the power of Nitro Modules.
š Features
- šØ Convert Image to Video: Turn your static images into dynamic videos.
- š¬ Merge Videos: Combine multiple videos seamlessly into one.
- ā” Fast and Efficient: Optimized for high performance with Nitro Modules.
- š± Cross-Platform: Fully supports both Android and iOS.
š ļø Prerequisites
Before getting started, ensure you have the following:
- React Native version
0.60+
react-native-nitro-modules
š¦ Installation
Run the following command to install the package and its dependencies:
npm install react-native-nitro-media-kit react-native-nitro-modules
For iOS, install pods:
cd ios && pod install
š Examples
šØ Convert Image to Video
import { mediakit } from 'react-native-nitro-media-kit'
const handleConvertImageToVideo = async () => {
try {
const video = await mediakit.convertImageToVideo(
'https://unsplash.com/photos/b9-odQi5oDo/download?ixid=M3wxMjA3fDB8MXxzZWFyY2h8Mnx8dXJsfGVufDB8fHx8MTczMjM0MTM2NXww&force=true&w=1920',
5
)
console.log('Video created at:', video)
} catch (error) {
console.error('Error converting image to video:', error)
}
}
š¬ Merge Videos
import { mediakit } from 'react-native-nitro-media-kit'
const handleMergeVideos = async () => {
try {
const video = await mediakit.mergeVideos([
'https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4',
'https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_2mb.mp4',
'https://www.sample-videos.com/video321/mp4/720/big_buck_bunny_720p_2mb.mp4',
])
console.log('Merged video saved at:', video)
} catch (error) {
console.error('Error merging videos:', error)
}
}
š API Reference
šØ convertImageToVideo
Converts an image into a video with a specified duration.
š Parameters:
imagePathOrUrl
(string): Local path or URL of the image.duration
(number): Duration of the video in seconds.
š ļø Returns:
- A promise that resolves with the local path to the created video.
š¬ mergeVideos
Merges multiple videos into one.
š Parameters:
videoPathsOrUrls
(string[]): Array of local paths or URLs of the videos.
š ļø Returns:
- A promise that resolves with the local path to the merged video.
ā¤ļø Support the Project
If you find this package useful, consider sponsoring me to support ongoing development and maintenance. Every contribution, big or small, helps keep this project alive and thriving! š
šļø Project Structure
āāā android/
ā āāā src/main/java/com/yourpackagename/nitromediakit/
ā āāā build.gradle
āāā ios/
ā āāā NitroMediaKit.swift
ā āāā NitroMediaKit.podspec
āāā src/
ā āāā index.ts
ā āāā specs/
āāā cpp/
āāā nitrogen/
āāā nitro.json
āāā package.json
š¤ Contributing
We ā¤ļø contributions! If you'd like to improve this package, open an issue or create a pull request. Let's build this together! š
š License
This project is licensed under the MIT License.
Happy coding! šš