nosnia-audio-recorder 0.9.2 → 0.9.4
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 +31 -11
- package/package.json +1 -1
|
@@ -56,6 +56,20 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
56
56
|
|
|
57
57
|
NSLog(@"[NosniaAudioRecorder] Starting progress timer");
|
|
58
58
|
|
|
59
|
+
// Send initial duration event immediately
|
|
60
|
+
if (_audioRecorder && _isRecording) {
|
|
61
|
+
NSTimeInterval currentTime = _audioRecorder.currentTime;
|
|
62
|
+
NSLog(@"[NosniaAudioRecorder] Sending initial progress: duration=%f ms", currentTime * 1000);
|
|
63
|
+
|
|
64
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
65
|
+
[self sendEventWithName:@"onRecordingProgress"
|
|
66
|
+
body:@{
|
|
67
|
+
@"duration": @(currentTime * 1000),
|
|
68
|
+
@"isRecording": @(self->_audioRecorder.isRecording)
|
|
69
|
+
}];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
_progressTimer = [NSTimer scheduledTimerWithTimeInterval:0.1
|
|
60
74
|
repeats:YES
|
|
61
75
|
block:^(NSTimer * _Nonnull timer) {
|
|
@@ -66,11 +80,14 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
66
80
|
NSTimeInterval currentTime = self->_audioRecorder.currentTime;
|
|
67
81
|
NSLog(@"[NosniaAudioRecorder] Sending progress: duration=%f ms", currentTime * 1000);
|
|
68
82
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
// Ensure event is sent on main thread
|
|
84
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
|
+
[self sendEventWithName:@"onRecordingProgress"
|
|
86
|
+
body:@{
|
|
87
|
+
@"duration": @(currentTime * 1000),
|
|
88
|
+
@"isRecording": @(self->_audioRecorder.isRecording)
|
|
89
|
+
}];
|
|
90
|
+
});
|
|
74
91
|
} else {
|
|
75
92
|
NSLog(@"[NosniaAudioRecorder] Skipping event: audioRecorder=%@, isRecording=%d",
|
|
76
93
|
self->_audioRecorder ? @"yes" : @"no", self->_isRecording);
|
|
@@ -127,12 +144,15 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
|
|
|
127
144
|
RCT_EXPORT_METHOD(testEventEmitter) {
|
|
128
145
|
NSLog(@"[NosniaAudioRecorder] testEventEmitter called - sending test event");
|
|
129
146
|
NSLog(@"[NosniaAudioRecorder] hasListeners: %d", _hasListeners);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
|
|
148
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
149
|
+
[self sendEventWithName:@"onRecordingProgress"
|
|
150
|
+
body:@{
|
|
151
|
+
@"duration": @(999.0),
|
|
152
|
+
@"isRecording": @(NO)
|
|
153
|
+
}];
|
|
154
|
+
NSLog(@"[NosniaAudioRecorder] Test event sent from main thread");
|
|
155
|
+
});
|
|
136
156
|
}
|
|
137
157
|
|
|
138
158
|
RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
|
package/package.json
CHANGED