0.0.3 • Published 8 months ago

react-native-nitro-media-kit v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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:


šŸ“¦ 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! 🌟

Sponsor


šŸ—‚ļø 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! šŸš€šŸŽ‰