nosnia-audio-recorder 0.9.2 → 0.9.3

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.
@@ -66,11 +66,14 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
66
66
  NSTimeInterval currentTime = self->_audioRecorder.currentTime;
67
67
  NSLog(@"[NosniaAudioRecorder] Sending progress: duration=%f ms", currentTime * 1000);
68
68
 
69
- [self sendEventWithName:@"onRecordingProgress"
70
- body:@{
71
- @"duration": @(currentTime * 1000),
72
- @"isRecording": @(self->_audioRecorder.isRecording)
73
- }];
69
+ // Ensure event is sent on main thread
70
+ dispatch_async(dispatch_get_main_queue(), ^{
71
+ [self sendEventWithName:@"onRecordingProgress"
72
+ body:@{
73
+ @"duration": @(currentTime * 1000),
74
+ @"isRecording": @(self->_audioRecorder.isRecording)
75
+ }];
76
+ });
74
77
  } else {
75
78
  NSLog(@"[NosniaAudioRecorder] Skipping event: audioRecorder=%@, isRecording=%d",
76
79
  self->_audioRecorder ? @"yes" : @"no", self->_isRecording);
@@ -127,12 +130,15 @@ RCT_EXPORT_MODULE(NosniaAudioRecorder)
127
130
  RCT_EXPORT_METHOD(testEventEmitter) {
128
131
  NSLog(@"[NosniaAudioRecorder] testEventEmitter called - sending test event");
129
132
  NSLog(@"[NosniaAudioRecorder] hasListeners: %d", _hasListeners);
130
- [self sendEventWithName:@"onRecordingProgress"
131
- body:@{
132
- @"duration": @(999.0),
133
- @"isRecording": @(NO)
134
- }];
135
- NSLog(@"[NosniaAudioRecorder] Test event sent");
133
+
134
+ dispatch_async(dispatch_get_main_queue(), ^{
135
+ [self sendEventWithName:@"onRecordingProgress"
136
+ body:@{
137
+ @"duration": @(999.0),
138
+ @"isRecording": @(NO)
139
+ }];
140
+ NSLog(@"[NosniaAudioRecorder] Test event sent from main thread");
141
+ });
136
142
  }
137
143
 
138
144
  RCT_EXPORT_METHOD(startRecording:(NSDictionary *)options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nosnia-audio-recorder",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
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",