nosnia-audio-recorder 0.9.10 → 0.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,6 @@
17
17
  BOOL _isRecording;
18
18
  NSTimer *_progressTimer;
19
19
  BOOL _hasListeners;
20
- double _elapsedTimeMs;
21
20
  }
22
21
 
23
22
  RCT_EXPORT_MODULE(NosniaAudioRecorder)
@@ -56,7 +55,6 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
56
55
  }
57
56
 
58
57
  NSLog(@"[NosniaAudioRecorder] Starting progress timer");
59
- _elapsedTimeMs = 0.0;
60
58
 
61
59
  // Send initial duration event immediately
62
60
  if (_audioRecorder && _isRecording) {
@@ -73,15 +71,19 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
73
71
  repeats:YES
74
72
  block:^(NSTimer * _Nonnull timer) {
75
73
  if (self->_audioRecorder && self->_isRecording) {
76
- // Simply increment by 100ms (the interval)
77
- self->_elapsedTimeMs += 100.0;
74
+ // Update meters to ensure accurate currentTime reading
75
+ [self->_audioRecorder updateMeters];
78
76
 
79
- NSLog(@"[NosniaAudioRecorder] Sending duration: %.0f ms", self->_elapsedTimeMs);
77
+ // Use the recorder's currentTime directly - this is the reliable way
78
+ double durationMs = self->_audioRecorder.currentTime * 1000.0;
79
+
80
+ NSLog(@"[NosniaAudioRecorder] Duration: %.0f ms (currentTime: %.4f seconds)",
81
+ durationMs, self->_audioRecorder.currentTime);
80
82
 
81
83
  dispatch_async(dispatch_get_main_queue(), ^{
82
84
  [self sendEventWithName:@"onRecordingProgress"
83
85
  body:@{
84
- @"duration": @(self->_elapsedTimeMs),
86
+ @"duration": @(durationMs),
85
87
  @"isRecording": @(self->_audioRecorder.isRecording)
86
88
  }];
87
89
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nosnia-audio-recorder",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "This is a modern audio recorder which actually works cross platform",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",