nosnia-audio-recorder 0.9.9 → 0.9.10
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.
- package/ios/NosniaAudioRecorder.mm +8 -18
- package/package.json +1 -1
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
BOOL _isRecording;
|
|
18
18
|
NSTimer *_progressTimer;
|
|
19
19
|
BOOL _hasListeners;
|
|
20
|
-
|
|
21
|
-
NSTimeInterval _pausedDuration;
|
|
20
|
+
double _elapsedTimeMs;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
@@ -57,19 +56,14 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
NSLog(@"[NosniaAudioRecorder] Starting progress timer");
|
|
60
|
-
|
|
61
|
-
_hasListeners, _isRecording, _audioRecorder ? @"YES" : @"NO");
|
|
59
|
+
_elapsedTimeMs = 0.0;
|
|
62
60
|
|
|
63
|
-
// Send initial duration event immediately
|
|
61
|
+
// Send initial duration event immediately
|
|
64
62
|
if (_audioRecorder && _isRecording) {
|
|
65
|
-
double durationMs = 0.0;
|
|
66
|
-
NSLog(@"[NosniaAudioRecorder] Sending initial progress: duration=%f ms (hasListeners=%d)",
|
|
67
|
-
durationMs, _hasListeners);
|
|
68
|
-
|
|
69
63
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
70
64
|
[self sendEventWithName:@"onRecordingProgress"
|
|
71
65
|
body:@{
|
|
72
|
-
@"duration": @(
|
|
66
|
+
@"duration": @(0.0),
|
|
73
67
|
@"isRecording": @(self->_audioRecorder.isRecording)
|
|
74
68
|
}];
|
|
75
69
|
});
|
|
@@ -79,17 +73,15 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
79
73
|
repeats:YES
|
|
80
74
|
block:^(NSTimer * _Nonnull timer) {
|
|
81
75
|
if (self->_audioRecorder && self->_isRecording) {
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
double durationMs = elapsedSeconds * 1000;
|
|
76
|
+
// Simply increment by 100ms (the interval)
|
|
77
|
+
self->_elapsedTimeMs += 100.0;
|
|
85
78
|
|
|
86
|
-
NSLog(@"[NosniaAudioRecorder]
|
|
79
|
+
NSLog(@"[NosniaAudioRecorder] Sending duration: %.0f ms", self->_elapsedTimeMs);
|
|
87
80
|
|
|
88
|
-
// Ensure event is sent on main thread
|
|
89
81
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
90
82
|
[self sendEventWithName:@"onRecordingProgress"
|
|
91
83
|
body:@{
|
|
92
|
-
@"duration": @(
|
|
84
|
+
@"duration": @(self->_elapsedTimeMs),
|
|
93
85
|
@"isRecording": @(self->_audioRecorder.isRecording)
|
|
94
86
|
}];
|
|
95
87
|
});
|
|
@@ -102,7 +94,6 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
102
94
|
[_progressTimer invalidate];
|
|
103
95
|
_progressTimer = nil;
|
|
104
96
|
}
|
|
105
|
-
_recordingStartTime = 0; // Reset start time
|
|
106
97
|
}
|
|
107
98
|
|
|
108
99
|
- (NSString *)getRecordingDirectory {
|
|
@@ -407,7 +398,6 @@ RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
|
|
|
407
398
|
NSLog(@"[NosniaAudioRecorder] Recording started successfully");
|
|
408
399
|
|
|
409
400
|
_isRecording = YES;
|
|
410
|
-
_recordingStartTime = [[NSDate date] timeIntervalSinceReferenceDate];
|
|
411
401
|
[self startProgressTimer];
|
|
412
402
|
resolve(nil);
|
|
413
403
|
} @catch (NSException *innerException) {
|
package/package.json
CHANGED