This is an audio conversion format tool, supporting the conversion of AAC, MP3, M4A, WMA, WAV, FLAC.
$ npm install react-native-audiotransition --save
$ react-native link react-native-audiotransition
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-audiotransition
and addRNAudiotransition.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNAudiotransition.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
AndroidManifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
add permission
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.lk.audiotransition.RNAudiotransitionPackage;
to the imports at the top of the file - Add
new RNAudiotransitionPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-audiotransition' project(':react-native-audiotransition').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-audiotransition/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-audiotransition')
import RNAudiotransition from 'react-native-audiotransition';
// TODO: What to do with the module?
AndroidManifest.initAudioTransition();
RNAudiotransition. audioToStart(String audioUrl,String type, Callback callback)
##demo
import RNAudiotransition from 'react-native-audiotransition';
componentDidMount(){
RNAudiotransition.initAudioTransition();
this.timer = setTimeout(() => {
RNAudiotransition.audioToStart('/sdcard/audio.mp3', 'aac', (res)=>{
alert(res)
})
}, 1000);
}