Skip to content

Commit

Permalink
Release 3.0.0-beta.3 (#287)
Browse files Browse the repository at this point in the history
* Fix broken android default path

* Update readme
  • Loading branch information
hyochan authored May 8, 2021
1 parent 7f5816b commit 81f960b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 29 deletions.
50 changes: 29 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
## Changelogs
- **[3.0.0]**
- 3.0.0-beta.2
- Add `resumeRecorder` and `pauseRecorder` features.
- beta.3
[Android]
1. Fix `Android` default path to `cacheDir`.
* Fix [#283](https://github.com/hyochan/react-native-audio-recorder-player/issues/283).

- beta.2
1. Add `resumeRecorder` and `pauseRecorder` features.
- **Caveat**: Android now requires min sdk of `24`.
- Renamed listener callback variables from `snake_case` to `camelCase`.
* Below are return types.
```ts
export type RecordBackType = {
isRecording?: boolean;
currentPosition: number;
currentMetering?: number;
};
2. Renamed listener callback variables from `snake_case` to `camelCase`.
* Below are return types.
```ts
export type RecordBackType = {
isRecording?: boolean;
currentPosition: number;
currentMetering?: number;
};

export type PlayBackType = {
isMuted?: boolean;
currentPosition: number;
duration: number;
};
```
- 3.0.0-beta.1
- [iOS]
* Codebase re-written in `Swift`.
* Migrate `AVAudioPlayer` to `AVPlayer`.
export type PlayBackType = {
isMuted?: boolean;
currentPosition: number;
duration: number;
};
```
3. `subscriptionDuration` offset not defaults to `0.5` which is `500ms`.
* Resolve [#273](https://github.com/hyochan/react-native-audio-recorder-player/issues/273)

- beta.1
[iOS]
1. Codebase re-written in `Swift`.
2. Migrate `AVAudioPlayer` to `AVPlayer`.

- **[2.7.0]**
- Migrate `android` module to `kotlin`.
Expand All @@ -40,7 +48,7 @@
- Add android record parameters [#210](dooboolab/react-native-audio-recorder-player/issues/210)
- Play music in bluetooth earpiece while recording [#192](dooboolab/react-native-audio-recorder-player/issues/192)
- Adding optional volume metering [#191](dooboolab/react-native-audio-recorder-player/issues/191)
- Upgrade packages
Upgrade packages
- **[2.5.1]**
- Resolve [#157](https://github.com/dooboolab/react-native-audio-recorder-player/issues/157), android path problem once again.
- **[2.5.0]**
Expand Down
15 changes: 13 additions & 2 deletions Example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,15 @@ class Page extends Component<any, State> {
};

console.log('audioSet', audioSet);
//? Custom path
// const uri = await this.audioRecorderPlayer.startRecorder(
// this.path,
// audioSet,
// );

//? Default path
const uri = await this.audioRecorderPlayer.startRecorder(
this.path,
undefined,
audioSet,
);

Expand Down Expand Up @@ -345,7 +352,11 @@ class Page extends Component<any, State> {

private onStartPlay = async () => {
console.log('onStartPlay');
const msg = await this.audioRecorderPlayer.startPlayer(this.path);
//? Custom path
// const msg = await this.audioRecorderPlayer.startPlayer(this.path);

//? Default path
const msg = await this.audioRecorderPlayer.startPlayer();
const volume = await this.audioRecorderPlayer.setVolume(1.0);
console.log(`file: ${msg}`, `volume: ${volume}`);

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is a react-native link module for audio recorder and player. This is not a

## Preview

<img src="https://user-images.githubusercontent.com/27461460/116999369-7c3c1780-ad1a-11eb-90ff-5aa7141e7565.gif" width=300/>
<img src="https://user-images.githubusercontent.com/27461460/117547014-3fe52000-b068-11eb-9f34-2bfc1e5092fd.gif" width=300/>

## Free read

Expand Down Expand Up @@ -40,6 +40,8 @@ This is a react-native link module for audio recorder and player. This is not a
duration: number;
};
```
4. `subscriptionDuration` offset not defaults to `0.5` which is `500ms`.
* Resolve [#273](https://github.com/hyochan/react-native-audio-recorder-player/issues/273)

- There has been vast improvements in [#114](https://github.com/dooboolab/react-native-audio-recorder-player/pull/114) which is released in `2.3.0`. We now support all `RN` versions without any version differenciating. See below installation guide for your understanding.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RNAudioRecorderPlayerModule(private val reactContext: ReactApplicationCont
promise.reject("No permission granted.", "Try again after adding permission.")
return
}
audioFileURL = if (((path == "DEFAULT"))) fileLocation else path
audioFileURL = if (((path == "DEFAULT"))) "${reactContext.cacheDir}/$defaultFileName" else path
_meteringEnabled = meteringEnabled

if (mediaRecorder == null) {
Expand Down Expand Up @@ -195,7 +195,7 @@ class RNAudioRecorderPlayerModule(private val reactContext: ReactApplicationCont

try {
if ((path == "DEFAULT")) {
mediaPlayer!!.setDataSource(fileLocation)
mediaPlayer!!.setDataSource("${reactContext.cacheDir}/$defaultFileName")
} else {
if (httpHeaders != null) {
val headers: MutableMap<String, String?> = HashMap<String, String?>()
Expand Down Expand Up @@ -227,7 +227,7 @@ class RNAudioRecorderPlayerModule(private val reactContext: ReactApplicationCont

mTimer = Timer()
mTimer!!.schedule(mTask, 0, subsDurationMillis.toLong())
val resolvedPath = if (((path == "DEFAULT"))) "file:///$fileLocation" else path
val resolvedPath = if (((path == "DEFAULT"))) "${reactContext.cacheDir}/$defaultFileName" else path
promise.resolve(resolvedPath)
}

Expand Down Expand Up @@ -358,6 +358,6 @@ class RNAudioRecorderPlayerModule(private val reactContext: ReactApplicationCont

companion object {
private var tag = "RNAudioRecorderPlayer"
private var fileLocation = "sdcard/sound.mp4"
private var defaultFileName = "sound.mp4"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-audio-recorder-player",
"version": "3.0.0-beta.2",
"version": "3.0.0-beta.3",
"description": "React Native Audio Recorder and Player.",
"homepage": "https://github.com/dooboolab/react-native-audio-recorder-player",
"main": "index.ts",
Expand Down

0 comments on commit 81f960b

Please sign in to comment.