| 1 | diff --git a/ios/AudioRecorder.swift b/ios/AudioRecorder.swift |
| 2 | index 73c6a036be6c76e219774a8d1e1cc3a7f18e6f8e..edfbbe00c2b0f3544bcbe42d02b829bf310d241c 100644 |
| 3 | --- a/ios/AudioRecorder.swift |
| 4 | +++ b/ios/AudioRecorder.swift |
| 5 | @@ -268,16 +268,16 @@ class AudioRecorder: SharedRef<AVAudioRecorder>, RecordingResultHandler { |
| 6 | } |
| 7 | |
| 8 | func didFinish(_ recorder: AVAudioRecorder, successfully flag: Bool) { |
| 9 | - // Update internal state when recording finishes automatically (e.g., from recordForDuration) |
| 10 | - currentState = .stopped |
| 11 | + // Update internal state when AVAudioRecorder finishes or fails. |
| 12 | + currentState = flag ? .stopped : .error |
| 13 | resetDurationTracking() |
| 14 | durationLimitSeconds = nil |
| 15 | |
| 16 | emit(event: recordingStatus, payload: [ |
| 17 | "id": id, |
| 18 | "isFinished": true, |
| 19 | - "hasError": false, |
| 20 | - "error": nil, |
| 21 | + "hasError": !flag, |
| 22 | + "error": flag ? nil : "Recording failed", |
| 23 | "url": recorder.url.absoluteString |
| 24 | ]) |
| 25 | } |