Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taltultc/react-native-mov-to-mp4
React native convert mov file to mp4 (iOS)
https://github.com/taltultc/react-native-mov-to-mp4
convert ios mov-files mp4 react-native
Last synced: about 2 months ago
JSON representation
React native convert mov file to mp4 (iOS)
- Host: GitHub
- URL: https://github.com/taltultc/react-native-mov-to-mp4
- Owner: taltultc
- Created: 2017-02-01T08:32:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T08:14:08.000Z (almost 3 years ago)
- Last Synced: 2024-11-11T15:47:00.085Z (2 months ago)
- Topics: convert, ios, mov-files, mp4, react-native
- Language: Objective-C
- Homepage:
- Size: 50.8 KB
- Stars: 59
- Watchers: 3
- Forks: 43
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-react-native - react-native-mov-to-mp4 ★44 - utils for Converting mov file to mp4 for cross-platform playback compatibility. (Components / Utils & Infra)
- awesome-react-native - react-native-mov-to-mp4 ★44 - utils for Converting mov file to mp4 for cross-platform playback compatibility. (Components / Utils & Infra)
README
# react-native-mov-to-mp4
Convert mov file to mp4 for cross-platform playback compatibility.
## Installation
**react-native >= 0.40:**
```
npm install react-native-mov-to-mp4 --save
```also for iOS:
```
cd ios && pod install && cd ..
```**react-native < 0.40:**
```
npm install [email protected] --save
```link react-native-mov-to-mp4:
```ruby
react-native link react-native-mov-to-mp4
``````javascript
import MovToMp4 from 'react-native-mov-to-mp4';const filename = Date.now().toString();
MovToMp4.convertMovToMp4(data.path, filename + ".mp4")
.then(function (results) {
//here you can upload the video...
console.log(results);
});
```**Parameters:**
```
convertMovToMp4(videoFilePath,newFilenameMp4,callback)
```## Example
this example use [react-native-camera](https://github.com/react-native-community/react-native-camera)
```javascript
render() {
return (
{
this.camera = cam;
}}
captureTarget={Camera.constants.CaptureTarget.disk}
captureMode={Camera.constants.CaptureMode.video}
style={styles.preview}
aspect={Camera.constants.Aspect.fill}>
[CAPTURE]
);
}
takeVideo() {
if(this.isRec){
this.isRec = false;
this.camera.stopCapture();
}else {
this.isRec = true;
this.camera.capture()
.then((data) => {
const filename = Date.now().toString();
MovToMp4.convertMovToMp4(data.path, filename + ".mp4")
.then(function (results) {
//here you can upload the video...
console.log(results);
});
})
.catch(err => console.error(err));
}
}
```## License
MIT