File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
android/src/main/java/com/margelo/nitro/audiorecorderplayer Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,8 @@ class HybridAudioRecorderPlayer : HybridAudioRecorderPlayerSpec() {
224224 startRecordTimer()
225225 }
226226
227- promise.resolve(filePath)
227+ val fileUri = Uri .fromFile(File (filePath)).toString()
228+ promise.resolve(fileUri)
228229 } catch (e: Exception ) {
229230 promise.reject(e)
230231 }
@@ -280,9 +281,13 @@ class HybridAudioRecorderPlayer : HybridAudioRecorderPlayerSpec() {
280281 stopRecordTimer()
281282 }
282283
283- val path = currentRecordingPath ? : " Unknown path"
284- currentRecordingPath = null // Clear after returning
285- promise.resolve(path)
284+ val path = currentRecordingPath
285+ currentRecordingPath = null // State is cleared regardless of outcome
286+
287+ path?.let {
288+ val fileUri = Uri .fromFile(File (it)).toString()
289+ promise.resolve(fileUri)
290+ } ? : promise.reject(Exception (" Recorder not started or path is unavailable." ))
286291 } catch (e: Exception ) {
287292 mediaRecorder?.release()
288293 mediaRecorder = null
@@ -389,8 +394,12 @@ class HybridAudioRecorderPlayer : HybridAudioRecorderPlayerSpec() {
389394 // Handle content URI
390395 setDataSource(context, Uri .parse(uri))
391396 }
397+ uri.startsWith(" file://" ) -> {
398+ // Handle file URI
399+ setDataSource(context, Uri .parse(uri))
400+ }
392401 else -> {
393- // Handle local file
402+ // Handle local file paths
394403 setDataSource(uri)
395404 }
396405 }
Original file line number Diff line number Diff line change 88 - hermes-engine (0.81.1):
99 - hermes-engine/Pre-built (= 0.81.1)
1010 - hermes-engine/Pre-built (0.81.1)
11- - NitroAudioRecorderPlayer (4.4.1 ):
11+ - NitroAudioRecorderPlayer (4.4.2 ):
1212 - boost
1313 - DoubleConversion
1414 - fast_float
@@ -2613,7 +2613,7 @@ SPEC CHECKSUMS:
26132613 fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
26142614 glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
26152615 hermes-engine: 4f8246b1f6d79f625e0d99472d1f3a71da4d28ca
2616- NitroAudioRecorderPlayer: b7d9624d4405227b31708b75f1b6588325992567
2616+ NitroAudioRecorderPlayer: 94390244fbb3b2f9c3da47fc017e66e7fd5f2ee7
26172617 NitroModules: fb1a99c1009adb251a440be2280587331092317d
26182618 RCT-Folly: 59ec0ac1f2f39672a0c6e6cecdd39383b764646f
26192619 RCTDeprecation: c4b9e2fd0ab200e3af72b013ed6113187c607077
You can’t perform that action at this time.
0 commit comments