Skip to content

Commit b9fe236

Browse files
fix: 🐛Recording with wav format never returns result
1 parent 70592bb commit b9fe236

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 2.0.1
22

33
- Fixed [#452](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/452) - OnAmplitude continues to add data points when recording is paused on iOS
4+
- Fixed [#453](https://github.com/SimformSolutionsPvtLtd/audio_waveforms/issues/453) - Recording with wav format never returns result
45

56
## 2.0.0
67

android/src/main/kotlin/com/simform/audio_waveforms/AudioRecorder.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,10 @@ class AudioRecorder : PluginRegistry.RequestPermissionsResultListener {
162162
if (encoder?.encodeForWav == true) {
163163
wavEncoder?.stop(result)
164164
recordingThread?.join()
165+
sendRecordingResult(result)
165166
} else {
166167
commonEncoder.setOnEncodingCompleted {
167-
val duration = getDuration(recorderSettings?.path)
168-
val hashMap = HashMap<String, Any?>()
169-
hashMap[Constants.resultFilePath] = recorderSettings?.path
170-
hashMap[Constants.resultDuration] = duration
171-
result.success(hashMap)
168+
sendRecordingResult(result)
172169
}
173170
commonEncoder.signalToStop()
174171
}
@@ -180,6 +177,14 @@ class AudioRecorder : PluginRegistry.RequestPermissionsResultListener {
180177
release()
181178
}
182179

180+
private fun sendRecordingResult(result: Result) {
181+
val duration = getDuration(recorderSettings?.path)
182+
val hashMap = HashMap<String, Any?>()
183+
hashMap[Constants.resultFilePath] = recorderSettings?.path
184+
hashMap[Constants.resultDuration] = duration
185+
result.success(hashMap)
186+
}
187+
183188
private fun sendBytesToFlutter(chunk: ByteArray, rms: Double) {
184189
val args: MutableMap<String, Any?> = HashMap()
185190
args["normalisedRms"] = rms

0 commit comments

Comments
 (0)