File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
android/src/main/kotlin/com/simform/audio_waveforms Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -66,23 +66,25 @@ class AudioRecorder : PluginRegistry.RequestPermissionsResultListener {
6666
6767 fun stopRecording (result : MethodChannel .Result , recorder : MediaRecorder ? , path : String ) {
6868 try {
69- var duration : String
69+ val audioInfoArrayList = ArrayList < String ?>()
7070
7171 try {
7272 recorder?.stop()
73- duration = getDuration(path)
73+
74+ val duration = getDuration(path)
75+ audioInfoArrayList.add(path)
76+ audioInfoArrayList.add(duration)
7477 } catch (e: RuntimeException ) {
7578 // Stop was called immediately after start which causes stop() call to fail.
76- duration = " -1"
79+ audioInfoArrayList.add(null )
80+ audioInfoArrayList.add(" -1" )
7781 }
7882
7983 recorder?.apply {
8084 reset()
8185 release()
8286 }
83- val audioInfoArrayList = ArrayList <String >()
84- audioInfoArrayList.add(path)
85- audioInfoArrayList.add(duration)
87+
8688 result.success(audioInfoArrayList)
8789 } catch (e: IllegalStateException ) {
8890 Log .e(LOG_TAG , " Failed to stop recording" )
You can’t perform that action at this time.
0 commit comments