nosnia-audio-recorder 0.9.6 → 0.9.8

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.
@@ -1,6 +1,6 @@
1
1
  #import "NosniaAudioRecorder.h"
2
2
  #import <AVFoundation/AVFoundation.h>
3
- #import <CoreMedia/CoreMedia.h>
3
+ #import <QuartzCore/QuartzCore.h>
4
4
  #import <React/RCTBridgeModule.h>
5
5
  #import <React/RCTEventEmitter.h>
6
6
  #import <React/RCTLog.h>
@@ -60,14 +60,12 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
60
60
  NSLog(@"[NosniaAudioRecorder] hasListeners: %d, isRecording: %d, audioRecorder: %@",
61
61
  _hasListeners, _isRecording, _audioRecorder ? @"YES" : @"NO");
62
62
 
63
- // Record the start time for elapsed time calculation
64
- _recordingStartTime = CACurrentMediaTime();
65
-
66
- // Send initial duration event immediately
63
+ // Send initial duration event immediately (should be very close to 0)
67
64
  if (_audioRecorder && _isRecording) {
68
- double durationMs = 0.0;
69
- NSLog(@"[NosniaAudioRecorder] Sending initial progress: duration=%f ms (hasListeners=%d)",
70
- durationMs, _hasListeners);
65
+ CFTimeInterval elapsedSeconds = CACurrentMediaTime() - _recordingStartTime;
66
+ double durationMs = elapsedSeconds * 1000;
67
+ NSLog(@"[NosniaAudioRecorder] Sending initial progress: elapsed=%f seconds, duration=%f ms (hasListeners=%d)",
68
+ elapsedSeconds, durationMs, _hasListeners);
71
69
 
72
70
  dispatch_async(dispatch_get_main_queue(), ^{
73
71
  NSLog(@"[NosniaAudioRecorder] About to send initial event on main thread");
@@ -113,6 +111,7 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
113
111
  [_progressTimer invalidate];
114
112
  _progressTimer = nil;
115
113
  }
114
+ _recordingStartTime = 0; // Reset start time
116
115
  }
117
116
 
118
117
  - (NSString *)getRecordingDirectory {
@@ -417,6 +416,7 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
417
416
  NSLog(@"[NosniaAudioRecorder] Recording started successfully");
418
417
 
419
418
  _isRecording = YES;
419
+ _recordingStartTime = CACurrentMediaTime(); // Record start time when recording actually starts
420
420
  [self startProgressTimer];
421
421
  resolve(nil);
422
422
  } @catch (NSException *innerException) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nosnia-audio-recorder",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
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",