react-native-audio-api 0.11.0-nightly-95f9c99-20251215 → 0.11.0-nightly-dd83923-20251216

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.
Files changed (138) hide show
  1. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +382 -39
  2. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +45 -18
  3. package/android/src/main/cpp/audioapi/android/core/NativeAudioRecorder.hpp +9 -9
  4. package/android/src/main/cpp/audioapi/android/core/utils/AndroidFileWriterBackend.h +33 -0
  5. package/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.cpp +170 -0
  6. package/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.h +46 -0
  7. package/android/src/main/cpp/audioapi/android/core/utils/AudioDecoder.cpp +0 -1
  8. package/android/src/main/cpp/audioapi/android/core/utils/FileOptions.cpp +83 -0
  9. package/android/src/main/cpp/audioapi/android/core/utils/FileOptions.h +22 -0
  10. package/android/src/main/cpp/audioapi/android/core/utils/MiniaudioImplementation.cpp +8 -0
  11. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.cpp +493 -0
  12. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.h +70 -0
  13. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/ptrs.hpp +56 -0
  14. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/utils.cpp +114 -0
  15. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/utils.h +34 -0
  16. package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp +296 -0
  17. package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.h +40 -0
  18. package/android/src/main/cpp/audioapi/android/system/NativeFileInfo.hpp +32 -0
  19. package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +2 -0
  20. package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +7 -3
  21. package/android/src/main/java/com/swmansion/audioapi/system/CentralizedForegroundService.kt +1 -0
  22. package/android/src/main/java/com/swmansion/audioapi/system/NativeFileInfo.kt +18 -0
  23. package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +1 -0
  24. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +2 -0
  25. package/android/src/oldarch/NativeAudioAPIModuleSpec.java +100 -80
  26. package/common/cpp/audioapi/AudioAPIModuleInstaller.h +3 -11
  27. package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.cpp +145 -16
  28. package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.h +21 -6
  29. package/common/cpp/audioapi/core/inputs/AudioRecorder.cpp +43 -60
  30. package/common/cpp/audioapi/core/inputs/AudioRecorder.h +53 -33
  31. package/common/cpp/audioapi/core/sources/RecorderAdapterNode.cpp +42 -14
  32. package/common/cpp/audioapi/core/sources/RecorderAdapterNode.h +12 -9
  33. package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +41 -0
  34. package/common/cpp/audioapi/core/utils/AudioFileWriter.h +44 -0
  35. package/common/cpp/audioapi/core/utils/AudioRecorderCallback.cpp +101 -0
  36. package/common/cpp/audioapi/core/utils/AudioRecorderCallback.h +52 -0
  37. package/common/cpp/audioapi/utils/AudioFileProperties.cpp +92 -0
  38. package/common/cpp/audioapi/utils/AudioFileProperties.h +76 -0
  39. package/common/cpp/audioapi/utils/Result.hpp +323 -0
  40. package/common/cpp/audioapi/utils/UnitConversion.h +9 -0
  41. package/ios/audioapi/ios/AudioAPIModule.mm +9 -14
  42. package/ios/audioapi/ios/core/IOSAudioPlayer.h +1 -1
  43. package/ios/audioapi/ios/core/IOSAudioPlayer.mm +7 -6
  44. package/ios/audioapi/ios/core/IOSAudioRecorder.h +39 -13
  45. package/ios/audioapi/ios/core/IOSAudioRecorder.mm +302 -26
  46. package/ios/audioapi/ios/core/NativeAudioPlayer.m +7 -11
  47. package/ios/audioapi/ios/core/NativeAudioRecorder.h +8 -9
  48. package/ios/audioapi/ios/core/NativeAudioRecorder.m +70 -76
  49. package/ios/audioapi/ios/core/utils/AudioDecoder.mm +1 -0
  50. package/ios/audioapi/ios/core/utils/FileOptions.h +33 -0
  51. package/ios/audioapi/ios/core/utils/FileOptions.mm +195 -0
  52. package/ios/audioapi/ios/core/utils/IOSFileWriter.h +53 -0
  53. package/ios/audioapi/ios/core/utils/IOSFileWriter.mm +239 -0
  54. package/ios/audioapi/ios/core/utils/IOSRecorderCallback.h +47 -0
  55. package/ios/audioapi/ios/core/utils/IOSRecorderCallback.mm +185 -0
  56. package/ios/audioapi/ios/system/AudioEngine.h +21 -16
  57. package/ios/audioapi/ios/system/AudioEngine.mm +138 -130
  58. package/ios/audioapi/ios/system/AudioSessionManager.h +19 -9
  59. package/ios/audioapi/ios/system/AudioSessionManager.mm +250 -215
  60. package/ios/audioapi/ios/system/NotificationManager.mm +24 -42
  61. package/lib/commonjs/api.js +82 -109
  62. package/lib/commonjs/api.js.map +1 -1
  63. package/lib/commonjs/core/AudioRecorder.js +159 -13
  64. package/lib/commonjs/core/AudioRecorder.js.map +1 -1
  65. package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
  66. package/lib/commonjs/system/notification/PlaybackNotificationManager.js +17 -14
  67. package/lib/commonjs/system/notification/PlaybackNotificationManager.js.map +1 -1
  68. package/lib/commonjs/system/notification/RecordingNotificationManager.js +22 -19
  69. package/lib/commonjs/system/notification/RecordingNotificationManager.js.map +1 -1
  70. package/lib/commonjs/system/notification/SimpleNotificationManager.js +16 -13
  71. package/lib/commonjs/system/notification/SimpleNotificationManager.js.map +1 -1
  72. package/lib/commonjs/types.js +39 -0
  73. package/lib/commonjs/types.js.map +1 -1
  74. package/lib/commonjs/utils/filePresets.js +43 -0
  75. package/lib/commonjs/utils/filePresets.js.map +1 -0
  76. package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js +6 -3
  77. package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js.map +1 -1
  78. package/lib/commonjs/web-system/notification/RecordingNotificationManager.js +6 -3
  79. package/lib/commonjs/web-system/notification/RecordingNotificationManager.js.map +1 -1
  80. package/lib/module/api.js +5 -4
  81. package/lib/module/api.js.map +1 -1
  82. package/lib/module/core/AudioRecorder.js +159 -13
  83. package/lib/module/core/AudioRecorder.js.map +1 -1
  84. package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
  85. package/lib/module/system/notification/PlaybackNotificationManager.js +17 -14
  86. package/lib/module/system/notification/PlaybackNotificationManager.js.map +1 -1
  87. package/lib/module/system/notification/RecordingNotificationManager.js +22 -19
  88. package/lib/module/system/notification/RecordingNotificationManager.js.map +1 -1
  89. package/lib/module/system/notification/SimpleNotificationManager.js +16 -13
  90. package/lib/module/system/notification/SimpleNotificationManager.js.map +1 -1
  91. package/lib/module/types.js +38 -1
  92. package/lib/module/types.js.map +1 -1
  93. package/lib/module/utils/filePresets.js +39 -0
  94. package/lib/module/utils/filePresets.js.map +1 -0
  95. package/lib/module/web-system/notification/PlaybackNotificationManager.js +6 -3
  96. package/lib/module/web-system/notification/PlaybackNotificationManager.js.map +1 -1
  97. package/lib/module/web-system/notification/RecordingNotificationManager.js +6 -3
  98. package/lib/module/web-system/notification/RecordingNotificationManager.js.map +1 -1
  99. package/lib/typescript/api.d.ts +5 -4
  100. package/lib/typescript/api.d.ts.map +1 -1
  101. package/lib/typescript/core/AudioRecorder.d.ts +69 -7
  102. package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
  103. package/lib/typescript/events/types.d.ts +36 -2
  104. package/lib/typescript/events/types.d.ts.map +1 -1
  105. package/lib/typescript/interfaces.d.ts +24 -4
  106. package/lib/typescript/interfaces.d.ts.map +1 -1
  107. package/lib/typescript/specs/NativeAudioAPIModule.d.ts +1 -1
  108. package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
  109. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts +4 -3
  110. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts.map +1 -1
  111. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts +4 -3
  112. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts.map +1 -1
  113. package/lib/typescript/system/notification/SimpleNotificationManager.d.ts +3 -2
  114. package/lib/typescript/system/notification/SimpleNotificationManager.d.ts.map +1 -1
  115. package/lib/typescript/system/notification/types.d.ts.map +1 -1
  116. package/lib/typescript/types.d.ts +79 -3
  117. package/lib/typescript/types.d.ts.map +1 -1
  118. package/lib/typescript/utils/filePresets.d.ts +9 -0
  119. package/lib/typescript/utils/filePresets.d.ts.map +1 -0
  120. package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts +4 -3
  121. package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts.map +1 -1
  122. package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts +4 -3
  123. package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts.map +1 -1
  124. package/package.json +4 -4
  125. package/src/AudioAPIModule/globals.d.ts +1 -2
  126. package/src/api.ts +8 -29
  127. package/src/core/AudioRecorder.ts +195 -23
  128. package/src/events/types.ts +40 -2
  129. package/src/interfaces.ts +34 -5
  130. package/src/specs/NativeAudioAPIModule.ts +2 -2
  131. package/src/system/notification/PlaybackNotificationManager.ts +20 -16
  132. package/src/system/notification/RecordingNotificationManager.ts +26 -21
  133. package/src/system/notification/SimpleNotificationManager.ts +18 -13
  134. package/src/system/notification/types.ts +1 -0
  135. package/src/types.ts +89 -3
  136. package/src/utils/filePresets.ts +47 -0
  137. package/src/web-system/notification/PlaybackNotificationManager.ts +9 -5
  138. package/src/web-system/notification/RecordingNotificationManager.ts +9 -5
@@ -22,8 +22,6 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
22
22
 
23
23
  - (void)cleanup
24
24
  {
25
- NSLog(@"[NotificationManager] cleanup");
26
-
27
25
  self.notificationCenter = nil;
28
26
  }
29
27
 
@@ -111,13 +109,16 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
111
109
  - (void)handleInterruption:(NSNotification *)notification
112
110
  {
113
111
  AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
112
+ AudioSessionManager *sessionManager = self.audioAPIModule.audioSessionManager;
113
+
114
114
  NSInteger interruptionType =
115
115
  [notification.userInfo[AVAudioSessionInterruptionTypeKey] integerValue];
116
116
  NSInteger interruptionOption =
117
117
  [notification.userInfo[AVAudioSessionInterruptionOptionKey] integerValue];
118
118
 
119
119
  if (interruptionType == AVAudioSessionInterruptionTypeBegan) {
120
- [audioEngine markAsInterrupted];
120
+ [audioEngine onInterruptionBegin];
121
+ [sessionManager markInactive];
121
122
 
122
123
  if (self.audioInterruptionsObserved) {
123
124
  NSDictionary *body = @{@"type" : @"began", @"shouldResume" : @false};
@@ -127,56 +128,41 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
127
128
  return;
128
129
  }
129
130
 
130
- if (interruptionOption == AVAudioSessionInterruptionOptionShouldResume) {
131
- [audioEngine unmarkAsInterrupted];
132
-
133
- if (self.audioInterruptionsObserved) {
134
- NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @true};
135
- [self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
136
- }
137
-
138
- return;
139
- }
131
+ bool shouldResume = interruptionOption == AVAudioSessionInterruptionOptionShouldResume;
140
132
 
141
133
  if (self.audioInterruptionsObserved) {
142
- NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @false};
134
+ NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @(shouldResume)};
143
135
  [self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
136
+ } else {
137
+ [audioEngine onInterruptionEnd:shouldResume];
144
138
  }
145
139
  }
146
140
 
147
141
  - (void)handleSecondaryAudio:(NSNotification *)notification
148
142
  {
149
143
  AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
144
+ AudioSessionManager *sessionManager = self.audioAPIModule.audioSessionManager;
150
145
  NSInteger secondaryAudioType =
151
146
  [notification.userInfo[AVAudioSessionSilenceSecondaryAudioHintTypeKey] integerValue];
152
147
 
153
- NSLog(@"handleSecondaryAudio");
154
-
155
148
  if (secondaryAudioType == AVAudioSessionSilenceSecondaryAudioHintTypeBegin) {
156
- [audioEngine markAsInterrupted];
149
+ [sessionManager markInactive];
150
+ [audioEngine onInterruptionBegin];
157
151
 
158
152
  if (self.audioInterruptionsObserved) {
159
153
  NSDictionary *body = @{@"type" : @"began", @"shouldResume" : @false};
160
154
  [self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
161
155
  }
162
-
163
156
  return;
164
157
  }
165
158
 
166
- if (secondaryAudioType == AVAudioSessionSilenceSecondaryAudioHintTypeEnd) {
167
- [audioEngine unmarkAsInterrupted];
168
-
169
- if (self.audioInterruptionsObserved) {
170
- NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @true};
171
- [self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
172
- }
173
-
174
- return;
175
- }
159
+ bool shouldResume = secondaryAudioType == AVAudioSessionSilenceSecondaryAudioHintTypeEnd;
176
160
 
177
161
  if (self.audioInterruptionsObserved) {
178
- NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @false};
162
+ NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @(shouldResume)};
179
163
  [self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
164
+ } else {
165
+ [audioEngine onInterruptionEnd:shouldResume];
180
166
  }
181
167
  }
182
168
 
@@ -226,10 +212,8 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
226
212
  NSLog(
227
213
  @"[NotificationManager] Media services have been reset, tearing down and rebuilding everything.");
228
214
  AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
229
- AudioSessionManager *audioSessionManager = self.audioAPIModule.audioSessionManager;
230
215
 
231
- [audioSessionManager reconfigureAudioSession];
232
- [audioEngine restartAudioEngine];
216
+ dispatch_async(dispatch_get_main_queue(), ^{ [audioEngine restartAudioEngine]; });
233
217
  }
234
218
 
235
219
  - (void)handleEngineConfigurationChange:(NSNotification *)notification
@@ -237,15 +221,9 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
237
221
  AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
238
222
  AudioSessionManager *sessionManager = self.audioAPIModule.audioSessionManager;
239
223
 
240
- if (![audioEngine isSupposedToBeRunning]) {
241
- NSLog(@"[NotificationManager] detected engine configuration change when engine is not running");
242
- [sessionManager markSettingsAsDirty];
243
- return;
244
- }
245
-
246
224
  dispatch_async(dispatch_get_main_queue(), ^{
247
- [sessionManager markSettingsAsDirty];
248
- [audioEngine rebuildAudioEngineAndStartIfNecessary];
225
+ [sessionManager markInactive];
226
+ [audioEngine restartAudioEngine];
249
227
  });
250
228
  }
251
229
 
@@ -281,10 +259,13 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
281
259
  }
282
260
 
283
261
  AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
262
+ AudioSessionManager *sessionManager = self.audioAPIModule.audioSessionManager;
263
+
284
264
  self.wasOtherAudioPlaying = shouldSilence;
285
265
 
286
266
  if (shouldSilence) {
287
- [audioEngine markAsInterrupted];
267
+ [sessionManager markInactive];
268
+ [audioEngine onInterruptionBegin];
288
269
  NSDictionary *body = @{@"type" : @"began", @"shouldResume" : @false};
289
270
 
290
271
  if (self.audioInterruptionsObserved) {
@@ -294,11 +275,12 @@ static NSString *NotificationManagerContext = @"NotificationManagerContext";
294
275
  return;
295
276
  }
296
277
 
297
- [audioEngine unmarkAsInterrupted];
298
278
  NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @true};
299
279
 
300
280
  if (self.audioInterruptionsObserved) {
301
281
  [self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
282
+ } else {
283
+ [audioEngine onInterruptionEnd:true];
302
284
  }
303
285
  }
304
286
 
@@ -3,6 +3,47 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ AnalyserNode: true,
8
+ AudioBuffer: true,
9
+ AudioBufferQueueSourceNode: true,
10
+ AudioBufferSourceNode: true,
11
+ AudioContext: true,
12
+ decodeAudioData: true,
13
+ decodePCMInBase64: true,
14
+ AudioDestinationNode: true,
15
+ AudioNode: true,
16
+ AudioParam: true,
17
+ AudioRecorder: true,
18
+ AudioScheduledSourceNode: true,
19
+ changePlaybackSpeed: true,
20
+ BaseAudioContext: true,
21
+ BiquadFilterNode: true,
22
+ ConstantSourceNode: true,
23
+ ConvolverNode: true,
24
+ GainNode: true,
25
+ OfflineAudioContext: true,
26
+ OscillatorNode: true,
27
+ RecorderAdapterNode: true,
28
+ StereoPannerNode: true,
29
+ StreamerNode: true,
30
+ WorkletNode: true,
31
+ WorkletProcessingNode: true,
32
+ WorkletSourceNode: true,
33
+ useSystemVolume: true,
34
+ AudioManager: true,
35
+ FilePreset: true,
36
+ PlaybackNotificationManager: true,
37
+ RecordingNotificationManager: true,
38
+ NotificationManager: true,
39
+ PlaybackControlName: true,
40
+ PlaybackNotificationEventName: true,
41
+ PlaybackNotificationInfo: true,
42
+ RecordingControlName: true,
43
+ RecordingNotificationEventName: true,
44
+ RecordingNotificationInfo: true,
45
+ SimpleNotificationOptions: true
46
+ };
6
47
  Object.defineProperty(exports, "AnalyserNode", {
7
48
  enumerable: true,
8
49
  get: function () {
@@ -69,12 +110,6 @@ Object.defineProperty(exports, "AudioScheduledSourceNode", {
69
110
  return _AudioScheduledSourceNode.default;
70
111
  }
71
112
  });
72
- Object.defineProperty(exports, "AudioWorkletRuntime", {
73
- enumerable: true,
74
- get: function () {
75
- return _types.AudioWorkletRuntime;
76
- }
77
- });
78
113
  Object.defineProperty(exports, "BaseAudioContext", {
79
114
  enumerable: true,
80
115
  get: function () {
@@ -87,88 +122,28 @@ Object.defineProperty(exports, "BiquadFilterNode", {
87
122
  return _BiquadFilterNode.default;
88
123
  }
89
124
  });
90
- Object.defineProperty(exports, "BiquadFilterType", {
91
- enumerable: true,
92
- get: function () {
93
- return _types.BiquadFilterType;
94
- }
95
- });
96
- Object.defineProperty(exports, "ChannelCountMode", {
97
- enumerable: true,
98
- get: function () {
99
- return _types.ChannelCountMode;
100
- }
101
- });
102
- Object.defineProperty(exports, "ChannelInterpretation", {
103
- enumerable: true,
104
- get: function () {
105
- return _types.ChannelInterpretation;
106
- }
107
- });
108
125
  Object.defineProperty(exports, "ConstantSourceNode", {
109
126
  enumerable: true,
110
127
  get: function () {
111
128
  return _ConstantSourceNode.default;
112
129
  }
113
130
  });
114
- Object.defineProperty(exports, "ContextState", {
115
- enumerable: true,
116
- get: function () {
117
- return _types.ContextState;
118
- }
119
- });
120
131
  Object.defineProperty(exports, "ConvolverNode", {
121
132
  enumerable: true,
122
133
  get: function () {
123
134
  return _ConvolverNode.default;
124
135
  }
125
136
  });
126
- Object.defineProperty(exports, "GainNode", {
127
- enumerable: true,
128
- get: function () {
129
- return _GainNode.default;
130
- }
131
- });
132
- Object.defineProperty(exports, "IOSCategory", {
133
- enumerable: true,
134
- get: function () {
135
- return _types2.IOSCategory;
136
- }
137
- });
138
- Object.defineProperty(exports, "IOSMode", {
139
- enumerable: true,
140
- get: function () {
141
- return _types2.IOSMode;
142
- }
143
- });
144
- Object.defineProperty(exports, "IOSOption", {
145
- enumerable: true,
146
- get: function () {
147
- return _types2.IOSOption;
148
- }
149
- });
150
- Object.defineProperty(exports, "IndexSizeError", {
151
- enumerable: true,
152
- get: function () {
153
- return _errors.IndexSizeError;
154
- }
155
- });
156
- Object.defineProperty(exports, "InvalidAccessError", {
137
+ Object.defineProperty(exports, "FilePreset", {
157
138
  enumerable: true,
158
139
  get: function () {
159
- return _errors.InvalidAccessError;
140
+ return _filePresets.default;
160
141
  }
161
142
  });
162
- Object.defineProperty(exports, "InvalidStateError", {
163
- enumerable: true,
164
- get: function () {
165
- return _errors.InvalidStateError;
166
- }
167
- });
168
- Object.defineProperty(exports, "NotSupportedError", {
143
+ Object.defineProperty(exports, "GainNode", {
169
144
  enumerable: true,
170
145
  get: function () {
171
- return _errors.NotSupportedError;
146
+ return _GainNode.default;
172
147
  }
173
148
  });
174
149
  Object.defineProperty(exports, "NotificationManager", {
@@ -189,24 +164,6 @@ Object.defineProperty(exports, "OscillatorNode", {
189
164
  return _OscillatorNode.default;
190
165
  }
191
166
  });
192
- Object.defineProperty(exports, "OscillatorType", {
193
- enumerable: true,
194
- get: function () {
195
- return _types.OscillatorType;
196
- }
197
- });
198
- Object.defineProperty(exports, "PeriodicWaveConstraints", {
199
- enumerable: true,
200
- get: function () {
201
- return _types.PeriodicWaveConstraints;
202
- }
203
- });
204
- Object.defineProperty(exports, "PermissionStatus", {
205
- enumerable: true,
206
- get: function () {
207
- return _types2.PermissionStatus;
208
- }
209
- });
210
167
  Object.defineProperty(exports, "PlaybackControlName", {
211
168
  enumerable: true,
212
169
  get: function () {
@@ -231,12 +188,6 @@ Object.defineProperty(exports, "PlaybackNotificationManager", {
231
188
  return _notification.PlaybackNotificationManager;
232
189
  }
233
190
  });
234
- Object.defineProperty(exports, "RangeError", {
235
- enumerable: true,
236
- get: function () {
237
- return _errors.RangeError;
238
- }
239
- });
240
191
  Object.defineProperty(exports, "RecorderAdapterNode", {
241
192
  enumerable: true,
242
193
  get: function () {
@@ -267,12 +218,6 @@ Object.defineProperty(exports, "RecordingNotificationManager", {
267
218
  return _notification.RecordingNotificationManager;
268
219
  }
269
220
  });
270
- Object.defineProperty(exports, "SessionOptions", {
271
- enumerable: true,
272
- get: function () {
273
- return _types2.SessionOptions;
274
- }
275
- });
276
221
  Object.defineProperty(exports, "SimpleNotificationOptions", {
277
222
  enumerable: true,
278
223
  get: function () {
@@ -291,12 +236,6 @@ Object.defineProperty(exports, "StreamerNode", {
291
236
  return _StreamerNode.default;
292
237
  }
293
238
  });
294
- Object.defineProperty(exports, "WindowType", {
295
- enumerable: true,
296
- get: function () {
297
- return _types.WindowType;
298
- }
299
- });
300
239
  Object.defineProperty(exports, "WorkletNode", {
301
240
  enumerable: true,
302
241
  get: function () {
@@ -367,9 +306,43 @@ var _WorkletProcessingNode = _interopRequireDefault(require("./core/WorkletProce
367
306
  var _WorkletSourceNode = _interopRequireDefault(require("./core/WorkletSourceNode"));
368
307
  var _useSystemVolume = _interopRequireDefault(require("./hooks/useSystemVolume"));
369
308
  var _system = _interopRequireDefault(require("./system"));
370
- var _notification = require("./system/notification");
371
- var _types = require("./types");
372
- var _types2 = require("./system/types");
373
309
  var _errors = require("./errors");
310
+ Object.keys(_errors).forEach(function (key) {
311
+ if (key === "default" || key === "__esModule") return;
312
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
313
+ if (key in exports && exports[key] === _errors[key]) return;
314
+ Object.defineProperty(exports, key, {
315
+ enumerable: true,
316
+ get: function () {
317
+ return _errors[key];
318
+ }
319
+ });
320
+ });
321
+ var _types = require("./system/types");
322
+ Object.keys(_types).forEach(function (key) {
323
+ if (key === "default" || key === "__esModule") return;
324
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
325
+ if (key in exports && exports[key] === _types[key]) return;
326
+ Object.defineProperty(exports, key, {
327
+ enumerable: true,
328
+ get: function () {
329
+ return _types[key];
330
+ }
331
+ });
332
+ });
333
+ var _types2 = require("./types");
334
+ Object.keys(_types2).forEach(function (key) {
335
+ if (key === "default" || key === "__esModule") return;
336
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
337
+ if (key in exports && exports[key] === _types2[key]) return;
338
+ Object.defineProperty(exports, key, {
339
+ enumerable: true,
340
+ get: function () {
341
+ return _types2[key];
342
+ }
343
+ });
344
+ });
345
+ var _filePresets = _interopRequireDefault(require("./utils/filePresets"));
346
+ var _notification = require("./system/notification");
374
347
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
375
348
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["require","_AnalyserNode","_interopRequireDefault","_AudioBuffer","_AudioBufferQueueSourceNode","_AudioBufferSourceNode","_AudioContext","_AudioDecoder","_AudioDestinationNode","_AudioNode","_AudioParam","_AudioRecorder","_AudioScheduledSourceNode","_AudioStretcher","_BaseAudioContext","_BiquadFilterNode","_ConstantSourceNode","_ConvolverNode","_GainNode","_OfflineAudioContext","_OscillatorNode","_RecorderAdapterNode","_StereoPannerNode","_StreamerNode","_WorkletNode","_WorkletProcessingNode","_WorkletSourceNode","_useSystemVolume","_system","_notification","_types","_types2","_errors","e","__esModule","default"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AAEA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,2BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,sBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,WAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,cAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,yBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,eAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,iBAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,iBAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IAAAgB,mBAAA,GAAAd,sBAAA,CAAAF,OAAA;AACA,IAAAiB,cAAA,GAAAf,sBAAA,CAAAF,OAAA;AACA,IAAAkB,SAAA,GAAAhB,sBAAA,CAAAF,OAAA;AACA,IAAAmB,oBAAA,GAAAjB,sBAAA,CAAAF,OAAA;AACA,IAAAoB,eAAA,GAAAlB,sBAAA,CAAAF,OAAA;AACA,IAAAqB,oBAAA,GAAAnB,sBAAA,CAAAF,OAAA;AACA,IAAAsB,iBAAA,GAAApB,sBAAA,CAAAF,OAAA;AACA,IAAAuB,aAAA,GAAArB,sBAAA,CAAAF,OAAA;AACA,IAAAwB,YAAA,GAAAtB,sBAAA,CAAAF,OAAA;AACA,IAAAyB,sBAAA,GAAAvB,sBAAA,CAAAF,OAAA;AACA,IAAA0B,kBAAA,GAAAxB,sBAAA,CAAAF,OAAA;AACA,IAAA2B,gBAAA,GAAAzB,sBAAA,CAAAF,OAAA;AACA,IAAA4B,OAAA,GAAA1B,sBAAA,CAAAF,OAAA;AAGA,IAAA6B,aAAA,GAAA7B,OAAA;AAKA,IAAA8B,MAAA,GAAA9B,OAAA;AAWA,IAAA+B,OAAA,GAAA/B,OAAA;AAmBA,IAAAgC,OAAA,GAAAhC,OAAA;AAMkB,SAAAE,uBAAA+B,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
1
+ {"version":3,"names":["require","_AnalyserNode","_interopRequireDefault","_AudioBuffer","_AudioBufferQueueSourceNode","_AudioBufferSourceNode","_AudioContext","_AudioDecoder","_AudioDestinationNode","_AudioNode","_AudioParam","_AudioRecorder","_AudioScheduledSourceNode","_AudioStretcher","_BaseAudioContext","_BiquadFilterNode","_ConstantSourceNode","_ConvolverNode","_GainNode","_OfflineAudioContext","_OscillatorNode","_RecorderAdapterNode","_StereoPannerNode","_StreamerNode","_WorkletNode","_WorkletProcessingNode","_WorkletSourceNode","_useSystemVolume","_system","_errors","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_types","_types2","_filePresets","_notification","e","__esModule","default"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AAEA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,2BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,sBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,WAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,cAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,yBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,eAAA,GAAAX,sBAAA,CAAAF,O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AAAC,IAAA,CAAAW,MAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,MAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,OAAA,GAAA3C,OAAA;AAAA8B,MAAA,CAAAC,IAAA,CAAAY,OAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,OAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,OAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,YAAA,GAAA1C,sBAAA,CAAAF,OAAA;AAGA,IAAA6C,aAAA,GAAA7C,OAAA;AAG+B,SAAAE,uBAAA4C,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -4,20 +4,89 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
8
7
  var _events = require("../events");
8
+ var _types = require("../types");
9
+ var _filePresets = _interopRequireDefault(require("../utils/filePresets"));
10
+ var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
9
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ // Enforces default options, making sure that all properties are defined
13
+ // for the contract with native code.
14
+ function withDefaultOptions(inOptions) {
15
+ return {
16
+ directory: _types.FileDirectory.Cache,
17
+ subDirectory: 'AudioAPI',
18
+ fileNamePrefix: 'recording_',
19
+ channelCount: 2,
20
+ format: _types.FileFormat.M4A,
21
+ batchDurationSeconds: 0,
22
+ preset: _filePresets.default.High,
23
+ androidFlushIntervalMs: 500,
24
+ ...inOptions
25
+ };
26
+ }
10
27
  class AudioRecorder {
28
+ onAudioReadySubscription = null;
29
+ onErrorSubscription = null;
30
+ options_ = null;
31
+ isFileOutputEnabled = false;
11
32
  audioEventEmitter = new _events.AudioEventEmitter(global.AudioEventEmitter);
12
- constructor(options) {
13
- this.recorder = global.createAudioRecorder(options);
33
+ constructor() {
34
+ this.recorder = global.createAudioRecorder();
35
+ }
36
+ enableFileOutput(
37
+ // TODO: Re-enable 'batchDurationSeconds' once supported
38
+ options) {
39
+ this.options_ = options || {};
40
+ const parsedOptions = withDefaultOptions(this.options_);
41
+ const result = this.recorder.enableFileOutput(parsedOptions);
42
+ this.isFileOutputEnabled = true;
43
+ return result;
14
44
  }
45
+ get options() {
46
+ return this.options_;
47
+ }
48
+ disableFileOutput() {
49
+ this.options_ = null;
50
+ this.recorder.disableFileOutput();
51
+ this.isFileOutputEnabled = false;
52
+ }
53
+
54
+ /** Starts the audio recording process with configured output options */
15
55
  start() {
16
- this.recorder.start();
56
+ if (!this.isFileOutputEnabled) {
57
+ this.recorder.start();
58
+ return {
59
+ status: 'success',
60
+ path: ''
61
+ };
62
+ }
63
+ return this.recorder.start();
17
64
  }
65
+
66
+ /** Stops the audio recording process and releases internal resources */
18
67
  stop() {
19
- this.recorder.stop();
68
+ return this.recorder.stop();
69
+ }
70
+
71
+ /** Pauses the audio recording process without tearing down anything */
72
+ pause() {
73
+ this.recorder.pause();
20
74
  }
75
+
76
+ /** Resumes the audio recording process after being paused */
77
+ resume() {
78
+ this.recorder.resume();
79
+ }
80
+
81
+ /**
82
+ * Connects a {@link RecorderAdapterNode} to the recorder’s audio graph.
83
+ *
84
+ * Each node can only be connected once. Attempting to connect a node multiple
85
+ * times will throw an error.
86
+ *
87
+ * @param node - The adapter node to connect to the recorder.
88
+ * @throws If the node has already been connected.
89
+ */
21
90
  connect(node) {
22
91
  if (node.wasConnected) {
23
92
  throw new Error('RecorderAdapterNode cannot be connected more than once. Refer to the documentation for more details.');
@@ -25,19 +94,96 @@ class AudioRecorder {
25
94
  node.wasConnected = true;
26
95
  this.recorder.connect(node.getNode());
27
96
  }
97
+
98
+ /**
99
+ * Disconnects the recorder from all connected adapter nodes.
100
+ *
101
+ * After calling this method, any connected {@link RecorderAdapterNode} will no
102
+ * longer receive audio data until reconnected.
103
+ */
28
104
  disconnect() {
29
105
  this.recorder.disconnect();
30
106
  }
31
- onAudioReady(callback) {
32
- const onAudioReadyCallback = event => {
107
+
108
+ /**
109
+ * Registers a callback to receive raw audio data during an active recording
110
+ * session.
111
+ *
112
+ * The callback is periodically invoked with audio buffers that match the
113
+ * preferred configuration provided in `options`. These parameters (sample
114
+ * rate, buffer length, and channel count) guide how audio data is chunked and
115
+ * delivered, though the exact values may vary depending on device
116
+ * capabilities. Values may vary depending on device capabilities.
117
+ *
118
+ * @param options - Preferred configuration for the audio buffers delivered to
119
+ * the callback.
120
+ * @param callback - Function invoked each time a new audio buffer is
121
+ * available. The callback receives an {@link OnAudioReadyEventType} object
122
+ * containing the audio data and associated metadata.
123
+ */
124
+ onAudioReady(options, callback) {
125
+ if (this.onAudioReadySubscription) {
126
+ this.recorder.clearOnAudioReady();
127
+ this.onAudioReadySubscription.remove();
128
+ this.onAudioReadySubscription = null;
129
+ }
130
+ this.onAudioReadySubscription = this.audioEventEmitter.addAudioEventListener('audioReady', event => {
131
+ const audioBuffer = new _AudioBuffer.default(event.buffer);
33
132
  callback({
34
- buffer: new _AudioBuffer.default(event.buffer),
35
- numFrames: event.numFrames,
36
- when: event.when
133
+ ...event,
134
+ buffer: audioBuffer
37
135
  });
38
- };
39
- const subscription = this.audioEventEmitter.addAudioEventListener('audioReady', onAudioReadyCallback);
40
- this.recorder.onAudioReady = subscription.subscriptionId;
136
+ });
137
+ return this.recorder.setOnAudioReady({
138
+ sampleRate: options.sampleRate,
139
+ bufferLength: options.bufferLength,
140
+ channelCount: options.channelCount,
141
+ callbackId: this.onAudioReadySubscription.subscriptionId
142
+ });
143
+ }
144
+
145
+ /**
146
+ * Removes the previously registered audio data callback, if any.
147
+ *
148
+ * This stops further `onAudioReady` events from being delivered during
149
+ * recording. Calling this method is safe even if no callback is currently
150
+ * registered.
151
+ */
152
+ clearOnAudioReady() {
153
+ if (!this.onAudioReadySubscription) {
154
+ return;
155
+ }
156
+ this.recorder.clearOnAudioReady();
157
+ this.onAudioReadySubscription.remove();
158
+ this.onAudioReadySubscription = null;
159
+ }
160
+ isRecording() {
161
+ return this.recorder.isRecording();
162
+ }
163
+ isPaused() {
164
+ return this.recorder.isPaused();
165
+ }
166
+ getCurrentDuration() {
167
+ return this.recorder.getCurrentDuration();
168
+ }
169
+ onError(callback) {
170
+ if (this.onErrorSubscription) {
171
+ this.recorder.clearOnError();
172
+ this.onErrorSubscription.remove();
173
+ this.onErrorSubscription = null;
174
+ }
175
+ this.onErrorSubscription = this.audioEventEmitter.addAudioEventListener('recorderError', callback);
176
+ this.recorder.setOnError({
177
+ callbackId: this.onErrorSubscription.subscriptionId
178
+ });
179
+ }
180
+ clearOnError() {
181
+ if (!this.onErrorSubscription) {
182
+ return;
183
+ }
184
+ this.recorder.clearOnError();
185
+ this.onErrorSubscription.remove();
186
+ this.onErrorSubscription = null;
41
187
  }
42
188
  }
43
189
  exports.default = AudioRecorder;
@@ -1 +1 @@
1
- {"version":3,"names":["_AudioBuffer","_interopRequireDefault","require","_events","e","__esModule","default","AudioRecorder","audioEventEmitter","AudioEventEmitter","global","constructor","options","recorder","createAudioRecorder","start","stop","connect","node","wasConnected","Error","getNode","disconnect","onAudioReady","callback","onAudioReadyCallback","event","buffer","AudioBuffer","numFrames","when","subscription","addAudioEventListener","subscriptionId","exports"],"sourceRoot":"../../../src","sources":["core/AudioRecorder.ts"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAA8C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG/B,MAAMG,aAAa,CAAC;EAGhBC,iBAAiB,GAAG,IAAIC,yBAAiB,CACxDC,MAAM,CAACD,iBACT,CAAC;EAEDE,WAAWA,CAACC,OAA6B,EAAE;IACzC,IAAI,CAACC,QAAQ,GAAGH,MAAM,CAACI,mBAAmB,CAACF,OAAO,CAAC;EACrD;EAEOG,KAAKA,CAAA,EAAS;IACnB,IAAI,CAACF,QAAQ,CAACE,KAAK,CAAC,CAAC;EACvB;EAEOC,IAAIA,CAAA,EAAS;IAClB,IAAI,CAACH,QAAQ,CAACG,IAAI,CAAC,CAAC;EACtB;EAEOC,OAAOA,CAACC,IAAyB,EAAQ;IAC9C,IAAIA,IAAI,CAACC,YAAY,EAAE;MACrB,MAAM,IAAIC,KAAK,CACb,sGACF,CAAC;IACH;IACAF,IAAI,CAACC,YAAY,GAAG,IAAI;IACxB,IAAI,CAACN,QAAQ,CAACI,OAAO,CAACC,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC;EACvC;EAEOC,UAAUA,CAAA,EAAS;IACxB,IAAI,CAACT,QAAQ,CAACS,UAAU,CAAC,CAAC;EAC5B;EAEOC,YAAYA,CAACC,QAAgD,EAAQ;IAC1E,MAAMC,oBAAoB,GAAIC,KAA4B,IAAK;MAC7DF,QAAQ,CAAC;QACPG,MAAM,EAAE,IAAIC,oBAAW,CAACF,KAAK,CAACC,MAAM,CAAC;QACrCE,SAAS,EAAEH,KAAK,CAACG,SAAS;QAC1BC,IAAI,EAAEJ,KAAK,CAACI;MACd,CAAC,CAAC;IACJ,CAAC;IAED,MAAMC,YAAY,GAAG,IAAI,CAACvB,iBAAiB,CAACwB,qBAAqB,CAC/D,YAAY,EACZP,oBACF,CAAC;IAED,IAAI,CAACZ,QAAQ,CAACU,YAAY,GAAGQ,YAAY,CAACE,cAAc;EAC1D;AACF;AAACC,OAAA,CAAA5B,OAAA,GAAAC,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_events","require","_types","_filePresets","_interopRequireDefault","_AudioBuffer","e","__esModule","default","withDefaultOptions","inOptions","directory","FileDirectory","Cache","subDirectory","fileNamePrefix","channelCount","format","FileFormat","M4A","batchDurationSeconds","preset","FilePreset","High","androidFlushIntervalMs","AudioRecorder","onAudioReadySubscription","onErrorSubscription","options_","isFileOutputEnabled","audioEventEmitter","AudioEventEmitter","global","constructor","recorder","createAudioRecorder","enableFileOutput","options","parsedOptions","result","disableFileOutput","start","status","path","stop","pause","resume","connect","node","wasConnected","Error","getNode","disconnect","onAudioReady","callback","clearOnAudioReady","remove","addAudioEventListener","event","audioBuffer","AudioBuffer","buffer","setOnAudioReady","sampleRate","bufferLength","callbackId","subscriptionId","isRecording","isPaused","getCurrentDuration","onError","clearOnError","setOnError","exports"],"sourceRoot":"../../../src","sources":["core/AudioRecorder.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AAAwC,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGxC;AACA;AACA,SAASG,kBAAkBA,CACzBC,SAAmC,EACC;EACpC,OAAO;IACL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,IAAI;IACjC;IAEA,IAAI,CAACA,mBAAmB,GAAG,IAAI,CAACG,iBAAiB,CAAC2B,qBAAqB,CACrE,eAAe,EACfH,QACF,CAAC;IAED,IAAI,CAACpB,QAAQ,CAACsC,UAAU,CAAC;MACvBP,UAAU,EAAE,IAAI,CAACtC,mBAAmB,CAACuC;IACvC,CAAC,CAAC;EACJ;EAEAK,YAAYA,CAAA,EAAS;IACnB,IAAI,CAAC,IAAI,CAAC5C,mBAAmB,EAAE;MAC7B;IACF;IAEA,IAAI,CAACO,QAAQ,CAACqC,YAAY,CAAC,CAAC;IAE5B,IAAI,CAAC5C,mBAAmB,CAAC6B,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC7B,mBAAmB,GAAG,IAAI;EACjC;AACF;AAAC8C,OAAA,CAAAjE,OAAA,GAAAiB,aAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Object","defineProperty","exports","value","NativeAudioAPIModule","_reactNative","require","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,oBAAA;AACb,IAAAC,YAAA,GAAAC,OAAA;AAsDA,MAAMF,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAAGG,gCAAmB,CAACC,GAAG,CAAO,gBAAgB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Object","defineProperty","exports","value","NativeAudioAPIModule","_reactNative","require","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,oBAAA;AAEb,IAAAC,YAAA,GAAAC,OAAA;AAqDA,MAAMF,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAAGG,gCAAmB,CAACC,GAAG,CAAO,gBAAgB,CAAC","ignoreList":[]}