Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.1.2 #139

Merged
merged 30 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8d8f7b9
fix: fix leaking promise on getDuration + NSError() leak rejection
dprevost-LMI Oct 19, 2024
90c3f7b
fix: `startPlayer`, `pausePlayer`, `seekToPlayer`, `setVolume` also leak
dprevost-LMI Oct 20, 2024
de6a55c
fix: play/stop button not showing on iOS + recording radius black theme
dprevost-LMI Oct 20, 2024
785b416
fix: use partial imports for lodash
prathamesh-wrktalk Oct 30, 2024
e71c116
Merge pull request #118 from dprevost-LMI/fix-iOS-invisble-play-stop-…
mukesh-simform Nov 8, 2024
a6b6e51
feat: keep recording on reboot + allow to delete them
dprevost-LMI Oct 20, 2024
0bfe0c4
fix: refresh the list instead of needing to reboot
dprevost-LMI Oct 23, 2024
2c3648a
fix: disable delete button when no recording
dprevost-LMI Oct 23, 2024
23365d5
Update example/src/App.tsx
dprevost-LMI Oct 23, 2024
c164249
fix: using pink `tintColor` so it also work on light theme
dprevost-LMI Oct 23, 2024
58e83a8
fix(UNT-T30512): Issue #129 Handle division by 0
prince-d-simform Nov 13, 2024
7657a51
Merge pull request #117 from dprevost-LMI/fix-getDuration-promise-lea…
mukesh-simform Nov 13, 2024
05d9dbc
Merge pull request #133 from SimformSolutionsPvtLtd/fix/UNT-T30512_Is…
mukesh-simform Nov 13, 2024
9bff4cd
Merge pull request #122 from dprevost-LMI/show-recoring-on-boot-and-d…
mukesh-simform Nov 13, 2024
1e538d0
Merge pull request #126 from prathameshmm02/master
mukesh-simform Nov 13, 2024
7dc0cf8
fix(UNT-T30467): seek on tap functionality
nilesh-simform Nov 14, 2024
6d9ebe6
Merge pull request #134 from SimformSolutionsPvtLtd/fix/UNT-T30467_se…
mukesh-simform Nov 14, 2024
62ff0af
fix: stop only the current player and not all players
dprevost-LMI Oct 20, 2024
b3479cc
fix: playing was not restarting once stopped
dprevost-LMI Nov 9, 2024
6cdc6b2
chore: code review
dprevost-LMI Nov 9, 2024
b9b2753
fix: do not start player when recording
dprevost-LMI Nov 9, 2024
686e71f
fix: reconcile code with the new stop and pause button
dprevost-LMI Nov 15, 2024
f1f0205
fix(UNT-T30609): kotlin issue while building android
nilesh-simform Nov 15, 2024
2f0b576
fix: reconcile code with the pause/resume feature
dprevost-LMI Nov 15, 2024
ec20a1e
Merge pull request #135 from SimformSolutionsPvtLtd/fix/UNT-T30609_ko…
mukesh-simform Nov 18, 2024
c1ed072
Merge pull request #123 from dprevost-LMI/stop-only-the-playing-player
mukesh-simform Nov 18, 2024
84bac61
chor: update the lib version to 2.1.2
prince-d-simform Nov 18, 2024
9c5415c
Merge pull request #137 from SimformSolutionsPvtLtd/chor/version-upgr…
mukesh-simform Nov 18, 2024
8b19f08
fix(UNT-T30665): promises leak android
nilesh-simform Nov 19, 2024
7b44723
Merge pull request #138 from SimformSolutionsPvtLtd/fix/UNT-T30665_an…
mukesh-simform Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 29 additions & 31 deletions android/src/main/java/com/audiowaveform/AudioWaveformModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,10 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
@ReactMethod
fun startPlayer(obj: ReadableMap, promise: Promise) {
val finishMode = obj.getInt(Constants.finishMode)
val key = obj.getString(Constants.playerKey)
val speed = obj.getDouble(Constants.speed)
if (key != null) {
audioPlayers[key]?.start(finishMode ?: 2, speed.toFloat(),promise)
} else {
promise.reject("startPlayer Error", "Player key can't be null")
}

val player = getPlayerOrReject(obj, promise, "startPlayer Error");
player?.start(finishMode ?: 2, speed.toFloat(),promise)
}

@ReactMethod
Expand All @@ -182,25 +179,18 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav

@ReactMethod
fun pausePlayer(obj: ReadableMap, promise: Promise) {
val key = obj.getString(Constants.playerKey)
if (key != null) {
audioPlayers[key]?.pause(promise)
} else {
promise.reject("pausePlayer Error", "Player key can't be null")
}
val player = getPlayerOrReject(obj, promise, "pausePlayer Error");
player?.pause(promise);
}

@ReactMethod
fun seekToPlayer(obj: ReadableMap, promise: Promise) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val progress = obj.getInt(Constants.progress)
val key = obj.getString(Constants.playerKey)
if (key != null) {
audioPlayers[key]?.seekToPosition(progress.toLong(), promise)
} else {
promise.reject("seekTo Error", "Player key can't be null")
}

val player = getPlayerOrReject(obj, promise, "seekTo Error");
player?.seekToPosition(progress.toLong(), promise)
} else {
Log.e(
Constants.LOG_TAG,
Expand All @@ -216,24 +206,18 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
@ReactMethod
fun setVolume(obj: ReadableMap, promise: Promise) {
val volume = obj.getInt(Constants.volume)
val key = obj.getString(Constants.playerKey)
if (key != null) {
audioPlayers[key]?.setVolume(volume.toFloat(), promise)
} else {
promise.reject("setVolume error", "Player key can't be null")
}

val player = getPlayerOrReject(obj, promise, "setVolume Error");
player?.setVolume(volume.toFloat(), promise)
}

@ReactMethod
fun getDuration(obj: ReadableMap, promise: Promise) {
val key = obj.getString(Constants.playerKey)
val duration = obj.getInt(Constants.durationType)
val type = if (duration == 0) DurationType.Current else DurationType.Max
if (key != null) {
audioPlayers[key]?.getDuration(type, promise)
} else {
promise.reject("getDuration Error", "Player key can't be null")
}

val player = getPlayerOrReject(obj, promise, "getDuration Error");
player?.getDuration(type, promise)
}

@ReactMethod
Expand Down Expand Up @@ -316,7 +300,7 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
}
}
override fun onReject(error: String?, message: String?) {
promise.reject(error, message)
promise.reject(error ?: "Error", message ?: "An error is thrown while decoding the audio file")
}
override fun onResolve(value: MutableList<MutableList<Float>>) {
promise.resolve(Arguments.fromList(value))
Expand Down Expand Up @@ -429,4 +413,18 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
handler.removeCallbacks(emitLiveRecordValue)
}

private fun getPlayerOrReject(arguments: ReadableMap, promise: Promise, errorCode: String): AudioPlayer? {
val key = getPlayerKeyOrReject(arguments, promise, errorCode)
return audioPlayers[key] ?: run {
promise.reject(errorCode, "$errorCode: Player not in the list")
null
}
}

private fun getPlayerKeyOrReject(arguments: ReadableMap, promise: Promise, errorCode: String): String? {
return arguments.getString(Constants.playerKey) ?: run {
promise.reject(errorCode, "$errorCode: Player key can't be null")
null
}
}
}
40 changes: 36 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ PODS:
- hermes-engine/Pre-built (= 0.72.7)
- hermes-engine/Pre-built (0.72.7)
- libevent (2.1.12)
- libwebp (1.3.2):
- libwebp/demux (= 1.3.2)
- libwebp/mux (= 1.3.2)
- libwebp/sharpyuv (= 1.3.2)
- libwebp/webp (= 1.3.2)
- libwebp/demux (1.3.2):
- libwebp/webp
- libwebp/mux (1.3.2):
- libwebp/demux
- libwebp/sharpyuv (1.3.2)
- libwebp/webp (1.3.2):
- libwebp/sharpyuv
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2021.07.22.00):
- boost
Expand Down Expand Up @@ -378,7 +390,7 @@ PODS:
- react-native-audio-waveform (1.0.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-safe-area-context (4.9.0):
- react-native-safe-area-context (4.11.0):
- React-Core
- React-NativeModulesApple (0.72.7):
- hermes-engine
Expand Down Expand Up @@ -492,11 +504,21 @@ PODS:
- React-perflogger (= 0.72.7)
- rn-fetch-blob (0.12.0):
- React-Core
- RNFastImage (8.6.3):
- React-Core
- SDWebImage (~> 5.11.1)
- SDWebImageWebPCoder (~> 0.8.4)
- RNFS (2.20.0):
- React-Core
- RNGestureHandler (2.14.0):
- RNGestureHandler (2.19.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- SDWebImage (5.11.1):
- SDWebImage/Core (= 5.11.1)
- SDWebImage/Core (5.11.1)
- SDWebImageWebPCoder (0.8.5):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- SocketRocket (0.6.1)
- Yoga (1.14.0)
- YogaKit (1.18.1):
Expand Down Expand Up @@ -568,6 +590,7 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- rn-fetch-blob (from `../node_modules/rn-fetch-blob`)
- RNFastImage (from `../node_modules/react-native-fast-image`)
- RNFS (from `../node_modules/react-native-fs`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
Expand All @@ -585,7 +608,10 @@ SPEC REPOS:
- FlipperKit
- fmt
- libevent
- libwebp
- OpenSSL-Universal
- SDWebImage
- SDWebImageWebPCoder
- SocketRocket
- YogaKit

Expand Down Expand Up @@ -673,6 +699,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
rn-fetch-blob:
:path: "../node_modules/rn-fetch-blob"
RNFastImage:
:path: "../node_modules/react-native-fast-image"
RNFS:
:path: "../node_modules/react-native-fs"
RNGestureHandler:
Expand All @@ -698,6 +726,7 @@ SPEC CHECKSUMS:
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: 9180d43df05c1ed658a87cc733dc3044cf90c00a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: 83bca1c184feb4d2e51c72c8369b83d641443f95
Expand All @@ -715,7 +744,7 @@ SPEC CHECKSUMS:
React-jsinspector: 8baadae51f01d867c3921213a25ab78ab4fbcd91
React-logger: 8edc785c47c8686c7962199a307015e2ce9a0e4f
react-native-audio-waveform: 7cdb6e4963eeae907240396975b9c79713591758
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
react-native-safe-area-context: 851c62c48dce80ccaa5637b6aa5991a1bc36eca9
React-NativeModulesApple: b6868ee904013a7923128892ee4a032498a1024a
React-perflogger: 31ea61077185eb1428baf60c0db6e2886f141a5a
React-RCTActionSheet: 392090a3abc8992eb269ef0eaa561750588fc39d
Expand All @@ -734,8 +763,11 @@ SPEC CHECKSUMS:
React-utils: 56838edeaaf651220d1e53cd0b8934fb8ce68415
ReactCommon: 5f704096ccf7733b390f59043b6fa9cc180ee4f6
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741
RNGestureHandler: 7ad14a6c7b491add489246611d324f10009083ac
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 4c3aa327e4a6a23eeacd71f61c81df1bcdf677d5
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"react": "18.2.0",
"react-native": "0.72.7",
"react-native-fast-image": "^8.6.3",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.13.4",
"react-native-safe-area-context": "^4.9.0",
Expand Down
Loading