react-native-audio-concat 0.7.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/audioconcat/AudioConcatModule.kt +93 -1792
- package/ios/AudioConcat.mm +60 -0
- package/lib/module/NativeAudioConcat.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeAudioConcat.d.ts +1 -0
- package/lib/typescript/src/NativeAudioConcat.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeAudioConcat.ts +1 -0
- package/src/index.tsx +7 -0
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ Concatenate audio files and silence periods into a single audio file for React N
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- ✅ Concat multiple audio files with silence periods
|
|
8
|
+
- ✅ Convert audio files to M4A format with AAC encoding
|
|
8
9
|
- ✅ Support for iOS and Android
|
|
9
10
|
- ✅ Output in M4A format
|
|
10
11
|
|
|
@@ -26,6 +27,8 @@ No additional steps required.
|
|
|
26
27
|
|
|
27
28
|
## Usage
|
|
28
29
|
|
|
30
|
+
### Concatenate Audio Files
|
|
31
|
+
|
|
29
32
|
```typescript
|
|
30
33
|
import { concatAudioFiles } from 'react-native-audio-concat';
|
|
31
34
|
|
|
@@ -48,6 +51,22 @@ try {
|
|
|
48
51
|
}
|
|
49
52
|
```
|
|
50
53
|
|
|
54
|
+
### Convert Audio to M4A
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { convertToM4a } from 'react-native-audio-concat';
|
|
58
|
+
|
|
59
|
+
const inputPath = '/path/to/audio.mp3';
|
|
60
|
+
const outputPath = '/path/to/output.m4a';
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const result = await convertToM4a(inputPath, outputPath);
|
|
64
|
+
console.log('Converted to M4A:', result);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error('Conversion failed:', error);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
51
70
|
## API
|
|
52
71
|
|
|
53
72
|
### `concatAudioFiles(data, outputPath)`
|
|
@@ -65,6 +84,24 @@ Concatenates audio files and silence periods into a single output file.
|
|
|
65
84
|
|
|
66
85
|
- `Promise<string>` - Resolves with the output file path
|
|
67
86
|
|
|
87
|
+
### `convertToM4a(inputPath, outputPath)`
|
|
88
|
+
|
|
89
|
+
Converts an audio file to M4A format with AAC encoding.
|
|
90
|
+
|
|
91
|
+
**Parameters:**
|
|
92
|
+
|
|
93
|
+
- `inputPath`: `string` - Absolute path to the input audio file (supports MP3, WAV, FLAC, OGG, M4A, and other common formats)
|
|
94
|
+
- `outputPath`: `string` - Absolute path where the M4A file will be saved
|
|
95
|
+
|
|
96
|
+
**Returns:**
|
|
97
|
+
|
|
98
|
+
- `Promise<string>` - Resolves with the output file path
|
|
99
|
+
|
|
100
|
+
**Notes:**
|
|
101
|
+
|
|
102
|
+
- On Android: Uses FFmpeg with AAC codec at 128kbps bitrate
|
|
103
|
+
- On iOS: Uses AVFoundation's native M4A export preset
|
|
104
|
+
|
|
68
105
|
## Example
|
|
69
106
|
|
|
70
107
|
Check out the [example app](example/) for a complete working example.
|
package/android/build.gradle
CHANGED