0.1.26 • Published 2 years ago

react-native-audio-remove v0.1.26

Weekly downloads
-
License
Apache License 2....
Repository
github
Last release
2 years ago

react-native-audio-remove

(Android Only)

This library is a React Native bridge around native Video Editing libraries. It allows you to edit any video by providing below set of features:

  • Video Trimming
  • Merge Video And Audio
  • Audio Trimming
  • Remove Audio From Video
  • FastMotion Video
  • SlowMotion Video

📖 Getting started

$ yarn add react-native-audio-remove

  • Android

  • Please add below script in your build.gradle

android {
//2 files found for path lib/arm64-v8a/libc++\_shared.so. This version of the Android Gradle Plugin chooses the f
packagingOptions {
pickFirst 'lib/x86/libc++\_shared.so'
pickFirst 'lib/x86_64/libc++\_shared.so'
pickFirst 'lib/armeabi-v7a/libc++\_shared.so'
pickFirst 'lib/arm64-v8a/libc++\_shared.so'
}
}

💻 Usage

import * as React from 'react';

import { StyleSheet, View, Text, Button } from 'react-native';
import {
  mergeVideoAndAudio,
  removeAudio,
  fastAndSlow,
  trimVideo,
  cropAudio,
} from 'react-native-audio-remove';
import Video from 'react-native-video';
export default function App() {
  const [result, setResult] = React.useState<String | undefined>();
  const [result2, setResult2] = React.useState<String | undefined>();
  const [result3, setResult3] = React.useState<String | undefined>();
  const [result4, setResult4] = React.useState<String | undefined>();
  const [result5, setResult5] = React.useState<String | undefined>();

  const removeAudioFromVideo = () => {
    removeAudio({
      path: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4',
    })
      .then((res) => {
        console.log(res);

        setResult(res);
      })
      .catch((err) => console.log(err));
  };

  const mergeVideo = () => {
    mergeVideoAndAudio({
      videoPath:
        'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
      audioPath: 'https://samplelib.com/lib/preview/mp3/sample-15s.mp3',
    })
      .then((res) => {
        setResult2(res);
      })
      .catch((err) => console.log(err));
  };

  const fastAndSlowVideo = () => {
    fastAndSlow({
      videoPath:
        'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
      setPts: 0.5,
      tempo: 4.0,
    })
      .then((res) => {
        setResult3(res);
      })
      .catch((err) => console.log(err));
  };

  const videoTrim = () => {
    trimVideo({
      videoPath:
        'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
      startTime: "00:1:00'",
      endingTime: '00:02:10',
    })
      .then((res) => {
        setResult4(res);
      })
      .catch((err) => console.log(err));
  };

  const AudioTrim = () => {
    cropAudio({
      audioPath: 'https://samplelib.com/lib/preview/mp3/sample-15s.mp3',
      startTime: "00:1:00'",
      endingTime: '00:05:10',
    })
      .then((res) => {
        setResult5(res);
      })
      .catch((err) => console.log(err));
  };

  return (
    <View style={styles.container}>
      <Button title="Remove Audio" onPress={() => removeAudioFromVideo()} />
      <Text>Result: {result}</Text>
      {typeof result == 'string' && (
        <Video source={{ uri: result }} style={{ height: 200, width: 200 }} />
      )}
      <Button title="Merge Audio And Video" onPress={() => mergeVideo()} />
      <Text>Result: {result2}</Text>
      {typeof result2 == 'string' && (
        <Video source={{ uri: result2 }} style={{ height: 250, width: 250 }} />
      )}
      <Button title="fastAnd Slow Video" onPress={() => fastAndSlowVideo()} />
      <Text>Result: {result3}</Text>
      {typeof result3 == 'string' && (
        <Video source={{ uri: result3 }} style={{ height: 250, width: 250 }} />
      )}
      <Button title="Trim Video" onPress={() => videoTrim()} />
      <Text>Result: {result4}</Text>
      {typeof result4 == 'string' && (
        <Video source={{ uri: result4 }} style={{ height: 250, width: 250 }} />
      )}

      <Button title="Crop Audio" onPress={() => AudioTrim()} />
      <Text>Result: {result5}</Text>
      {typeof result5 == 'string' && (
        <Video source={{ uri: result5 }} style={{ height: 250, width: 250 }} />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});

✨ Credits

Thank you for Contribution Akshy K.

📜 License

This library is provided under the Apache 2 License.\

💖 Support my projects

I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • Starring and sharing the projects you like 🚀
  • If you're feeling especially charitable, please follow abhi3691 on GitHub.

    Thanks! ❤️ abhi3691.github.io </ Abhinand Vk >

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago