react-native-audio-api 0.11.0-nightly-b30bac9-20260114 → 0.11.0

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 (173) hide show
  1. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +3 -10
  2. package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +0 -4
  3. package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +4 -83
  4. package/android/src/main/java/com/swmansion/audioapi/system/CentralizedForegroundService.kt +14 -29
  5. package/android/src/main/java/com/swmansion/audioapi/system/ForegroundServiceManager.kt +10 -9
  6. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +10 -51
  7. package/android/src/main/java/com/swmansion/audioapi/system/notification/BaseNotification.kt +6 -14
  8. package/android/src/main/java/com/swmansion/audioapi/system/notification/NotificationRegistry.kt +79 -60
  9. package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +249 -411
  10. package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotificationReceiver.kt +8 -3
  11. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotification.kt +240 -222
  12. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +11 -22
  13. package/android/src/main/java/com/swmansion/audioapi/system/notification/state/RecordingNotificationState.kt +24 -0
  14. package/android/src/main/res/layout/btn_round_ripple.xml +9 -0
  15. package/android/src/main/res/layout/notification_collapsed.xml +45 -0
  16. package/android/src/main/res/layout/notification_expanded.xml +44 -0
  17. package/android/src/oldarch/NativeAudioAPIModuleSpec.java +1 -13
  18. package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +1 -1
  19. package/ios/audioapi/ios/AudioAPIModule.mm +5 -48
  20. package/ios/audioapi/ios/system/notification/BaseNotification.h +0 -7
  21. package/ios/audioapi/ios/system/notification/NotificationRegistry.h +5 -25
  22. package/ios/audioapi/ios/system/notification/NotificationRegistry.mm +19 -64
  23. package/ios/audioapi/ios/system/notification/PlaybackNotification.mm +4 -15
  24. package/lib/commonjs/AudioAPIModule/AudioAPIModule.js +2 -1
  25. package/lib/commonjs/AudioAPIModule/AudioAPIModule.js.map +1 -1
  26. package/lib/commonjs/api.js +1 -29
  27. package/lib/commonjs/api.js.map +1 -1
  28. package/lib/commonjs/core/AudioDecoder.js +42 -16
  29. package/lib/commonjs/core/AudioDecoder.js.map +1 -1
  30. package/lib/commonjs/core/AudioRecorder.js +2 -1
  31. package/lib/commonjs/core/AudioRecorder.js.map +1 -1
  32. package/lib/commonjs/core/AudioStretcher.js +2 -1
  33. package/lib/commonjs/core/AudioStretcher.js.map +1 -1
  34. package/lib/commonjs/core/BaseAudioContext.js +2 -5
  35. package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
  36. package/lib/commonjs/errors/AudioApiError.js +14 -0
  37. package/lib/commonjs/errors/AudioApiError.js.map +1 -0
  38. package/lib/commonjs/errors/index.js +7 -0
  39. package/lib/commonjs/errors/index.js.map +1 -1
  40. package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
  41. package/lib/commonjs/specs/NativeAudioAPIModule.web.js +0 -9
  42. package/lib/commonjs/specs/NativeAudioAPIModule.web.js.map +1 -1
  43. package/lib/commonjs/system/notification/PlaybackNotificationManager.js +40 -85
  44. package/lib/commonjs/system/notification/PlaybackNotificationManager.js.map +1 -1
  45. package/lib/commonjs/system/notification/RecordingNotificationManager.ios.js +51 -0
  46. package/lib/commonjs/system/notification/RecordingNotificationManager.ios.js.map +1 -0
  47. package/lib/commonjs/system/notification/RecordingNotificationManager.js +30 -144
  48. package/lib/commonjs/system/notification/RecordingNotificationManager.js.map +1 -1
  49. package/lib/commonjs/system/notification/index.js +1 -9
  50. package/lib/commonjs/system/notification/index.js.map +1 -1
  51. package/lib/commonjs/utils/index.js +3 -2
  52. package/lib/commonjs/utils/index.js.map +1 -1
  53. package/lib/commonjs/utils/paths.js +18 -0
  54. package/lib/commonjs/utils/paths.js.map +1 -0
  55. package/lib/commonjs/web-core/AudioContext.js +20 -11
  56. package/lib/commonjs/web-core/AudioContext.js.map +1 -1
  57. package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js +0 -1
  58. package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js.map +1 -1
  59. package/lib/commonjs/web-system/notification/RecordingNotificationManager.js +1 -6
  60. package/lib/commonjs/web-system/notification/RecordingNotificationManager.js.map +1 -1
  61. package/lib/module/AudioAPIModule/AudioAPIModule.js +2 -1
  62. package/lib/module/AudioAPIModule/AudioAPIModule.js.map +1 -1
  63. package/lib/module/api.js +3 -2
  64. package/lib/module/api.js.map +1 -1
  65. package/lib/module/core/AudioDecoder.js +42 -16
  66. package/lib/module/core/AudioDecoder.js.map +1 -1
  67. package/lib/module/core/AudioRecorder.js +3 -1
  68. package/lib/module/core/AudioRecorder.js.map +1 -1
  69. package/lib/module/core/AudioStretcher.js +2 -1
  70. package/lib/module/core/AudioStretcher.js.map +1 -1
  71. package/lib/module/core/BaseAudioContext.js +2 -5
  72. package/lib/module/core/BaseAudioContext.js.map +1 -1
  73. package/lib/module/errors/AudioApiError.js +10 -0
  74. package/lib/module/errors/AudioApiError.js.map +1 -0
  75. package/lib/module/errors/index.js +1 -0
  76. package/lib/module/errors/index.js.map +1 -1
  77. package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
  78. package/lib/module/specs/NativeAudioAPIModule.web.js +0 -9
  79. package/lib/module/specs/NativeAudioAPIModule.web.js.map +1 -1
  80. package/lib/module/system/notification/PlaybackNotificationManager.js +40 -85
  81. package/lib/module/system/notification/PlaybackNotificationManager.js.map +1 -1
  82. package/lib/module/system/notification/RecordingNotificationManager.ios.js +47 -0
  83. package/lib/module/system/notification/RecordingNotificationManager.ios.js.map +1 -0
  84. package/lib/module/system/notification/RecordingNotificationManager.js +30 -144
  85. package/lib/module/system/notification/RecordingNotificationManager.js.map +1 -1
  86. package/lib/module/system/notification/index.js +1 -2
  87. package/lib/module/system/notification/index.js.map +1 -1
  88. package/lib/module/utils/index.js +3 -2
  89. package/lib/module/utils/index.js.map +1 -1
  90. package/lib/module/utils/paths.js +12 -0
  91. package/lib/module/utils/paths.js.map +1 -0
  92. package/lib/module/web-core/AudioContext.js +20 -11
  93. package/lib/module/web-core/AudioContext.js.map +1 -1
  94. package/lib/module/web-system/notification/PlaybackNotificationManager.js +0 -1
  95. package/lib/module/web-system/notification/PlaybackNotificationManager.js.map +1 -1
  96. package/lib/module/web-system/notification/RecordingNotificationManager.js +1 -6
  97. package/lib/module/web-system/notification/RecordingNotificationManager.js.map +1 -1
  98. package/lib/typescript/AudioAPIModule/AudioAPIModule.d.ts.map +1 -1
  99. package/lib/typescript/api.d.ts +3 -2
  100. package/lib/typescript/api.d.ts.map +1 -1
  101. package/lib/typescript/core/AudioDecoder.d.ts +2 -1
  102. package/lib/typescript/core/AudioDecoder.d.ts.map +1 -1
  103. package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
  104. package/lib/typescript/core/AudioStretcher.d.ts.map +1 -1
  105. package/lib/typescript/core/BaseAudioContext.d.ts +2 -2
  106. package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
  107. package/lib/typescript/errors/AudioApiError.d.ts +5 -0
  108. package/lib/typescript/errors/AudioApiError.d.ts.map +1 -0
  109. package/lib/typescript/errors/index.d.ts +1 -0
  110. package/lib/typescript/errors/index.d.ts.map +1 -1
  111. package/lib/typescript/interfaces.d.ts +1 -1
  112. package/lib/typescript/interfaces.d.ts.map +1 -1
  113. package/lib/typescript/specs/NativeAudioAPIModule.d.ts +2 -5
  114. package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
  115. package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts +1 -4
  116. package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts.map +1 -1
  117. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts +32 -9
  118. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts.map +1 -1
  119. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts +26 -13
  120. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts.map +1 -1
  121. package/lib/typescript/system/notification/RecordingNotificationManager.ios.d.ts +36 -0
  122. package/lib/typescript/system/notification/RecordingNotificationManager.ios.d.ts.map +1 -0
  123. package/lib/typescript/system/notification/index.d.ts +0 -1
  124. package/lib/typescript/system/notification/index.d.ts.map +1 -1
  125. package/lib/typescript/system/notification/types.d.ts +12 -22
  126. package/lib/typescript/system/notification/types.d.ts.map +1 -1
  127. package/lib/typescript/types.d.ts +1 -0
  128. package/lib/typescript/types.d.ts.map +1 -1
  129. package/lib/typescript/utils/index.d.ts.map +1 -1
  130. package/lib/typescript/utils/paths.d.ts +4 -0
  131. package/lib/typescript/utils/paths.d.ts.map +1 -0
  132. package/lib/typescript/web-core/AudioContext.d.ts +8 -9
  133. package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
  134. package/lib/typescript/web-core/BaseAudioContext.d.ts +6 -7
  135. package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
  136. package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts +1 -2
  137. package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts.map +1 -1
  138. package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts +2 -7
  139. package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts.map +1 -1
  140. package/package.json +1 -1
  141. package/src/AudioAPIModule/AudioAPIModule.ts +2 -1
  142. package/src/api.ts +2 -8
  143. package/src/core/AudioDecoder.ts +91 -21
  144. package/src/core/AudioRecorder.ts +2 -1
  145. package/src/core/AudioStretcher.ts +2 -1
  146. package/src/core/BaseAudioContext.ts +4 -6
  147. package/src/errors/AudioApiError.ts +8 -0
  148. package/src/errors/index.ts +1 -0
  149. package/src/interfaces.ts +1 -1
  150. package/src/specs/NativeAudioAPIModule.ts +5 -15
  151. package/src/specs/NativeAudioAPIModule.web.ts +1 -12
  152. package/src/system/notification/PlaybackNotificationManager.ts +42 -117
  153. package/src/system/notification/RecordingNotificationManager.ios.ts +65 -0
  154. package/src/system/notification/RecordingNotificationManager.ts +33 -183
  155. package/src/system/notification/index.ts +0 -1
  156. package/src/system/notification/types.ts +15 -37
  157. package/src/types.ts +2 -0
  158. package/src/utils/index.ts +3 -2
  159. package/src/utils/paths.ts +11 -0
  160. package/src/web-core/AudioContext.tsx +34 -19
  161. package/src/web-core/BaseAudioContext.tsx +9 -7
  162. package/src/web-system/notification/PlaybackNotificationManager.ts +1 -7
  163. package/src/web-system/notification/RecordingNotificationManager.ts +1 -16
  164. package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioPlayer.kt +0 -26
  165. package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioRecorder.kt +0 -26
  166. package/android/src/main/java/com/swmansion/audioapi/system/notification/SimpleNotification.kt +0 -119
  167. package/lib/commonjs/system/notification/SimpleNotificationManager.js +0 -125
  168. package/lib/commonjs/system/notification/SimpleNotificationManager.js.map +0 -1
  169. package/lib/module/system/notification/SimpleNotificationManager.js +0 -121
  170. package/lib/module/system/notification/SimpleNotificationManager.js.map +0 -1
  171. package/lib/typescript/system/notification/SimpleNotificationManager.d.ts +0 -21
  172. package/lib/typescript/system/notification/SimpleNotificationManager.d.ts.map +0 -1
  173. package/src/system/notification/SimpleNotificationManager.ts +0 -175
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="64dp"
5
+ android:gravity="center_vertical"
6
+ android:orientation="horizontal"
7
+ android:paddingStart="16dp"
8
+ android:paddingEnd="16dp"
9
+ android:paddingBottom="16dp">
10
+
11
+ <LinearLayout
12
+ android:layout_width="0dp"
13
+ android:layout_height="wrap_content"
14
+ android:layout_weight="1"
15
+ android:orientation="vertical"
16
+ android:paddingEnd="16dp">
17
+
18
+ <TextView
19
+ android:id="@+id/notification_title"
20
+ style="@style/TextAppearance.Compat.Notification.Title"
21
+ android:layout_width="wrap_content"
22
+ android:layout_height="wrap_content"
23
+ android:ellipsize="end"
24
+ android:maxLines="1"
25
+ android:text="Recording Audio" />
26
+
27
+ <TextView
28
+ android:id="@+id/notification_content"
29
+ style="@style/TextAppearance.Compat.Notification.Line2"
30
+ android:layout_width="wrap_content"
31
+ android:layout_height="wrap_content"
32
+ android:ellipsize="end"
33
+ android:maxLines="1"
34
+ android:text="00:12" />
35
+ </LinearLayout>
36
+
37
+ <ImageButton
38
+ android:id="@+id/notification_action_btn"
39
+ android:layout_width="40dp"
40
+ android:layout_height="40dp"
41
+ android:background="@layout/btn_round_ripple"
42
+ android:contentDescription="Pause or Resume"
43
+ android:scaleType="centerInside" />
44
+
45
+ </LinearLayout>
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="wrap_content"
5
+ android:gravity="center_vertical"
6
+ android:minHeight="64dp"
7
+ android:orientation="horizontal"
8
+ android:paddingStart="16dp"
9
+ android:paddingTop="12dp"
10
+ android:paddingEnd="16dp"
11
+ android:paddingBottom="12dp">
12
+
13
+ <LinearLayout
14
+ android:layout_width="0dp"
15
+ android:layout_height="wrap_content"
16
+ android:layout_weight="1"
17
+ android:orientation="vertical"
18
+ android:paddingEnd="16dp">
19
+
20
+ <TextView
21
+ android:id="@+id/notification_title"
22
+ style="@style/TextAppearance.Compat.Notification.Title"
23
+ android:layout_width="wrap_content"
24
+ android:layout_height="wrap_content"
25
+ android:text="Recording Audio" />
26
+
27
+ <TextView
28
+ android:id="@+id/notification_content"
29
+ style="@style/TextAppearance.Compat.Notification.Line2"
30
+ android:layout_width="wrap_content"
31
+ android:layout_height="wrap_content"
32
+ android:layout_marginTop="4dp"
33
+ android:text="Your recording is in progress..." />
34
+ </LinearLayout>
35
+
36
+ <ImageButton
37
+ android:id="@+id/notification_action_btn"
38
+ android:layout_width="48dp"
39
+ android:layout_height="48dp"
40
+ android:background="@layout/btn_round_ripple"
41
+ android:scaleType="centerInside"
42
+ android:contentDescription="Pause or Resume" />
43
+
44
+ </LinearLayout>
@@ -88,24 +88,12 @@ public abstract class NativeAudioAPIModuleSpec extends ReactContextBaseJavaModul
88
88
 
89
89
  @ReactMethod
90
90
  @DoNotStrip
91
- public abstract void registerNotification(String type, String key, Promise promise);
92
-
93
- @ReactMethod
94
- @DoNotStrip
95
- public abstract void showNotification(String key, ReadableMap options, Promise promise);
96
-
97
- @ReactMethod
98
- @DoNotStrip
99
- public abstract void updateNotification(String key, ReadableMap options, Promise promise);
91
+ public abstract void showNotification(String type, String key, ReadableMap options, Promise promise);
100
92
 
101
93
  @ReactMethod
102
94
  @DoNotStrip
103
95
  public abstract void hideNotification(String key, Promise promise);
104
96
 
105
- @ReactMethod
106
- @DoNotStrip
107
- public abstract void unregisterNotification(String key, Promise promise);
108
-
109
97
  @ReactMethod
110
98
  @DoNotStrip
111
99
  public abstract void isNotificationActive(String key, Promise promise);
@@ -9,7 +9,7 @@ namespace audioapi {
9
9
  AudioFileWriter::AudioFileWriter(
10
10
  const std::shared_ptr<AudioEventHandlerRegistry> &audioEventHandlerRegistry,
11
11
  const std::shared_ptr<AudioFileProperties> &fileProperties)
12
- : audioEventHandlerRegistry_(audioEventHandlerRegistry), fileProperties_(fileProperties) {}
12
+ : fileProperties_(fileProperties), audioEventHandlerRegistry_(audioEventHandlerRegistry) {}
13
13
 
14
14
  void AudioFileWriter::setOnErrorCallback(uint64_t callbackId) {
15
15
  errorCallbackId_.store(callbackId, std::memory_order_release);
@@ -110,7 +110,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
110
110
  #endif
111
111
 
112
112
  NSLog(@"Successfully installed JSI bindings for react-native-audio-api!");
113
- return @true;
113
+ return @YES;
114
114
  }
115
115
 
116
116
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getDevicePreferredSampleRate)
@@ -210,26 +210,13 @@ RCT_EXPORT_METHOD(disableSessionManagement)
210
210
 
211
211
  // New notification system methods
212
212
  RCT_EXPORT_METHOD(
213
- registerNotification : (NSString *)type key : (NSString *)key resolve : (RCTPromiseResolveBlock)
214
- resolve reject : (RCTPromiseRejectBlock)reject)
215
- {
216
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
217
- BOOL success = [self.notificationRegistry registerNotificationType:type withKey:key];
218
-
219
- if (success) {
220
- resolve(@{@"success" : @true});
221
- } else {
222
- resolve(@{@"success" : @false, @"error" : @"Failed to register notification"});
223
- }
224
- });
225
- }
226
-
227
- RCT_EXPORT_METHOD(
228
- showNotification : (NSString *)key options : (NSDictionary *)
213
+ showNotification : (NSString *)type key : (NSString *)key options : (NSDictionary *)
229
214
  options resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject)
230
215
  {
231
216
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
232
- BOOL success = [self.notificationRegistry showNotificationWithKey:key options:options];
217
+ BOOL success = [self.notificationRegistry showNotificationWithType:type
218
+ key:key
219
+ options:options];
233
220
 
234
221
  if (success) {
235
222
  resolve(@{@"success" : @true});
@@ -239,21 +226,6 @@ RCT_EXPORT_METHOD(
239
226
  });
240
227
  }
241
228
 
242
- RCT_EXPORT_METHOD(
243
- updateNotification : (NSString *)key options : (NSDictionary *)
244
- options resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject)
245
- {
246
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
247
- BOOL success = [self.notificationRegistry updateNotificationWithKey:key options:options];
248
-
249
- if (success) {
250
- resolve(@{@"success" : @true});
251
- } else {
252
- resolve(@{@"success" : @false, @"error" : @"Failed to update notification"});
253
- }
254
- });
255
- }
256
-
257
229
  RCT_EXPORT_METHOD(
258
230
  hideNotification : (NSString *)key resolve : (RCTPromiseResolveBlock)
259
231
  resolve reject : (RCTPromiseRejectBlock)reject)
@@ -269,21 +241,6 @@ RCT_EXPORT_METHOD(
269
241
  });
270
242
  }
271
243
 
272
- RCT_EXPORT_METHOD(
273
- unregisterNotification : (NSString *)key resolve : (RCTPromiseResolveBlock)
274
- resolve reject : (RCTPromiseRejectBlock)reject)
275
- {
276
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
277
- BOOL success = [self.notificationRegistry unregisterNotificationWithKey:key];
278
-
279
- if (success) {
280
- resolve(@{@"success" : @true});
281
- } else {
282
- resolve(@{@"success" : @false, @"error" : @"Failed to unregister notification"});
283
- }
284
- });
285
- }
286
-
287
244
  RCT_EXPORT_METHOD(
288
245
  isNotificationActive : (NSString *)key resolve : (RCTPromiseResolveBlock)
289
246
  resolve reject : (RCTPromiseRejectBlock)reject)
@@ -25,13 +25,6 @@
25
25
  */
26
26
  - (BOOL)showWithOptions:(NSDictionary *)options;
27
27
 
28
- /**
29
- * Update notification metadata.
30
- * @param options Updated information
31
- * @return YES if successful
32
- */
33
- - (BOOL)updateWithOptions:(NSDictionary *)options;
34
-
35
28
  /**
36
29
  * Hide the notification (clears metadata on iOS).
37
30
  * @return YES if successful
@@ -18,28 +18,15 @@
18
18
  - (instancetype)initWithAudioAPIModule:(AudioAPIModule *)audioAPIModule;
19
19
 
20
20
  /**
21
- * Register a new notification type.
22
- * @param type The notification type identifier (e.g., "playback", "recording")
23
- * @param key Unique key for this notification instance
24
- * @return YES if registration succeeded, NO otherwise
25
- */
26
- - (BOOL)registerNotificationType:(NSString *)type withKey:(NSString *)key;
27
-
28
- /**
29
- * Show a registered notification.
21
+ * Show a notification. Creates it if it doesn't exist.
22
+ * @param type The notification type identifier
30
23
  * @param key The notification key
31
24
  * @param options Options for showing the notification
32
25
  * @return YES if successful, NO otherwise
33
26
  */
34
- - (BOOL)showNotificationWithKey:(NSString *)key options:(NSDictionary *)options;
35
-
36
- /**
37
- * Update a shown notification.
38
- * @param key The notification key
39
- * @param options Updated options
40
- * @return YES if successful, NO otherwise
41
- */
42
- - (BOOL)updateNotificationWithKey:(NSString *)key options:(NSDictionary *)options;
27
+ - (BOOL)showNotificationWithType:(NSString *)type
28
+ key:(NSString *)key
29
+ options:(NSDictionary *)options;
43
30
 
44
31
  /**
45
32
  * Hide a notification.
@@ -48,13 +35,6 @@
48
35
  */
49
36
  - (BOOL)hideNotificationWithKey:(NSString *)key;
50
37
 
51
- /**
52
- * Unregister and clean up a notification.
53
- * @param key The notification key
54
- * @return YES if successful, NO otherwise
55
- */
56
- - (BOOL)unregisterNotificationWithKey:(NSString *)key;
57
-
58
38
  /**
59
39
  * Check if a notification is active.
60
40
  * @param key The notification key
@@ -18,41 +18,33 @@
18
18
  return self;
19
19
  }
20
20
 
21
- - (BOOL)registerNotificationType:(NSString *)type withKey:(NSString *)key
21
+ - (BOOL)showNotificationWithType:(NSString *)type
22
+ key:(NSString *)key
23
+ options:(NSDictionary *)options
22
24
  {
23
- if (!type || !key) {
24
- NSLog(@"[NotificationRegistry] Invalid type or key");
25
+ if (!key) {
26
+ NSLog(@"[NotificationRegistry] Invalid key");
25
27
  return false;
26
28
  }
27
29
 
28
- // Check if already registered
29
- if (_notifications[key]) {
30
- NSLog(@"[NotificationRegistry] Notification with key '%@' already registered", key);
31
- return false;
32
- }
33
-
34
- // Create the appropriate notification type
35
- id<BaseNotification> notification = [self createNotificationForType:type];
30
+ id<BaseNotification> notification = _notifications[key];
36
31
 
32
+ // Create if doesn't exist
37
33
  if (!notification) {
38
- NSLog(@"[NotificationRegistry] Unknown notification type: %@", type);
39
- return false;
40
- }
34
+ if (!type) {
35
+ NSLog(@"[NotificationRegistry] Type required for new notification: %@", key);
36
+ return false;
37
+ }
41
38
 
42
- // Store the notification
43
- _notifications[key] = notification;
39
+ notification = [self createNotificationForType:type];
44
40
 
45
- NSLog(@"[NotificationRegistry] Registered notification type '%@' with key '%@'", type, key);
46
- return true;
47
- }
48
-
49
- - (BOOL)showNotificationWithKey:(NSString *)key options:(NSDictionary *)options
50
- {
51
- id<BaseNotification> notification = _notifications[key];
41
+ if (!notification) {
42
+ NSLog(@"[NotificationRegistry] Unknown notification type: %@", type);
43
+ return false;
44
+ }
52
45
 
53
- if (!notification) {
54
- NSLog(@"[NotificationRegistry] No notification found with key: %@", key);
55
- return false;
46
+ _notifications[key] = notification;
47
+ NSLog(@"[NotificationRegistry] Created notification type '%@' with key '%@'", type, key);
56
48
  }
57
49
 
58
50
  // Initialize if first time showing
@@ -66,7 +58,7 @@
66
58
  BOOL success = [notification showWithOptions:options];
67
59
 
68
60
  if (success) {
69
- NSLog(@"[NotificationRegistry] Showed notification: %@", key);
61
+ NSLog(@"[NotificationRegistry] Showed/Updated notification: %@", key);
70
62
  } else {
71
63
  NSLog(@"[NotificationRegistry] Failed to show notification: %@", key);
72
64
  }
@@ -74,26 +66,6 @@
74
66
  return success;
75
67
  }
76
68
 
77
- - (BOOL)updateNotificationWithKey:(NSString *)key options:(NSDictionary *)options
78
- {
79
- id<BaseNotification> notification = _notifications[key];
80
-
81
- if (!notification) {
82
- NSLog(@"[NotificationRegistry] No notification found with key: %@", key);
83
- return false;
84
- }
85
-
86
- BOOL success = [notification updateWithOptions:options];
87
-
88
- if (success) {
89
- NSLog(@"[NotificationRegistry] Updated notification: %@", key);
90
- } else {
91
- NSLog(@"[NotificationRegistry] Failed to update notification: %@", key);
92
- }
93
-
94
- return success;
95
- }
96
-
97
69
  - (BOOL)hideNotificationWithKey:(NSString *)key
98
70
  {
99
71
  id<BaseNotification> notification = _notifications[key];
@@ -114,23 +86,6 @@
114
86
  return success;
115
87
  }
116
88
 
117
- - (BOOL)unregisterNotificationWithKey:(NSString *)key
118
- {
119
- id<BaseNotification> notification = _notifications[key];
120
-
121
- if (!notification) {
122
- NSLog(@"[NotificationRegistry] No notification found with key: %@", key);
123
- return false;
124
- }
125
-
126
- // Clean up and remove
127
- [notification cleanup];
128
- [_notifications removeObjectForKey:key];
129
-
130
- NSLog(@"[NotificationRegistry] Unregistered notification: %@", key);
131
- return true;
132
- }
133
-
134
89
  - (BOOL)isNotificationActiveWithKey:(NSString *)key
135
90
  {
136
91
  id<BaseNotification> notification = _notifications[key];
@@ -64,31 +64,20 @@
64
64
  }
65
65
  }
66
66
 
67
- // Update the now playing info
68
- [self updateNowPlayingInfo:options];
69
-
70
- _isActive = true;
71
-
72
- return true;
73
- }
74
-
75
- - (BOOL)updateWithOptions:(NSDictionary *)options
76
- {
77
- if (!_isActive) {
78
- return false;
79
- }
80
-
81
67
  // Handle control enable/disable
82
68
  if (options[@"control"] && options[@"enabled"]) {
83
69
  NSString *control = options[@"control"];
84
70
  BOOL enabled = [options[@"enabled"] boolValue];
85
71
  [self enableControl:control enabled:enabled];
86
- return true;
72
+ // If it's a control update, we can return early or continue
73
+ // Continuing lets us update metadata if provided mixed with controls
87
74
  }
88
75
 
89
76
  // Update the now playing info
90
77
  [self updateNowPlayingInfo:options];
91
78
 
79
+ _isActive = true;
80
+
92
81
  return true;
93
82
  }
94
83
 
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _specs = require("../specs");
8
+ var _errors = require("../errors");
8
9
  class AudioAPIModule {
9
10
  #workletsModule_ = null;
10
11
  #canUseWorklets_ = false;
@@ -20,7 +21,7 @@ class AudioAPIModule {
20
21
  return;
21
22
  }
22
23
  if (!_specs.NativeAudioAPIModule) {
23
- throw new Error(`Failed to install react-native-audio-api: The native module could not be found.`);
24
+ throw new _errors.AudioApiError(`Failed to install react-native-audio-api: The native module could not be found.`);
24
25
  }
25
26
  _specs.NativeAudioAPIModule.install();
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_specs","require","AudioAPIModule","workletsModule_","canUseWorklets_","workletsVersion","workletsAvailable_","supportedWorkletsVersion","constructor","verifyWorklets","verifyInstallation","NativeAudioAPIModule","Error","install","#verifyWorklets","workletsPackage","workletsPackageJson","version","includes","#verifyInstallation","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","createAudioDecoder","createAudioStretcher","AudioEventEmitter","workletsModule","canUseWorklets","areWorkletsAvailable","isWorkletsVersionSupported","createAudioRuntime","createWorkletRuntime","_default","exports","default"],"sourceRoot":"../../../src","sources":["AudioAPIModule/AudioAPIModule.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,MAAMC,cAAc,CAA4B;EAC9C,CAACC,eAAe,GAA2B,IAAI;EAC/C,CAACC,eAAe,GAAG,KAAK;EACxB,CAACC,eAAe,GAAG,SAAS;EAC5B,CAACC,kBAAkB,GAAG,KAAK;EAEpBC,wBAAwB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;EAEtEC,WAAWA,CAAA,EAAG;IACZ;IACA;IACA;IACA,IAAI,CAAC,CAACC,cAAc,CAAC,CAAC;IAEtB,IAAI,IAAI,CAAC,CAACC,kBAAkB,CAAC,CAAC,EAAE;MAC9B;IACF;IAEA,IAAI,CAACC,2BAAoB,EAAE;MACzB,MAAM,IAAIC,KAAK,CACb,iFACF,CAAC;IACH;IAEAD,2BAAoB,CAACE,OAAO,CAAC,CAAC;EAChC;EAEA,CAACJ,cAAcK,CAAA,EAAY;IACzB,IAAI;MACF,MAAMC,eAAe,GAAGd,OAAO,CAAC,uBAAuB,CAAC;MACxD,MAAMe,mBAAmB,GAAGf,OAAO,CAAC,oCAAoC,CAAC;MACzE,IAAI,CAAC,CAACI,eAAe,GAAGW,mBAAmB,CAACC,OAAO;MACnD,IAAI,CAAC,CAACX,kBAAkB,GAAG,IAAI;MAE/B,IAAI,CAAC,CAACF,eAAe,GAAG,IAAI,CAACG,wBAAwB,CAACW,QAAQ,CAC5DF,mBAAmB,CAACC,OACtB,CAAC;MAED,IAAI,IAAI,CAAC,CAACb,eAAe,EAAE;QACzB,IAAI,CAAC,CAACD,eAA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workletsModule_","canUseWorklets_","workletsVersion","workletsAvailable_","supportedWorkletsVersion","constructor","verifyWorklets","verifyInstallation","NativeAudioAPIModule","AudioApiError","install","#verifyWorklets","workletsPackage","workletsPackageJson","version","includes","#verifyInstallation","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","createAudioDecoder","createAudioStretcher","AudioEventEmitter","workletsModule","canUseWorklets","areWorkletsAvailable","isWorkletsVersionSupported","createAudioRuntime","createWorkletRuntime","_default","exports","default"],"sourceRoot":"../../../src","sources":["AudioAPIModule/AudioAPIModule.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,cAAc,CAA4B;EAC9C,CAACC,eAAe,GAA2B,IAAI;EAC/C,CAACC,eAAe,GAAG,KAAK;EACxB,CAACC,eAAe,GAAG,SAAS;EAC5B,CAACC,kBAAkB,GAAG,KAAK;EAEpBC,wBAAwB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;EAEtEC,WAAWA,CAAA,EAAG;IACZ;IACA;IACA;IACA,IAAI,CAAC,CAACC,cAAc,CAAC,CAAC;IAEtB,IAAI,IAAI,CAAC,CAACC,kBAAkB,CAAC,CAAC,EAAE;MAC9B;IACF;IAEA,IAAI,CAACC,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CACrB,iFACF,CAAC;IACH;IAEAD,2BAAoB,CAACE,OAAO,CAAC,CAAC;EAChC;EAEA,CAACJ,cAAcK,CAAA,EAAY;IACzB,IAAI;MACF,MAAMC,eAAe,GAAGf,OAAO,CAAC,uBAAuB,CAAC;MACxD,MAAMgB,mBAAmB,GAAGhB,OAAO,CAAC,oCAAoC,CAAC;MACzE,IAAI,CAAC,CAACK,eAAe,GAAGW,mBAAmB,CAACC,OAAO;MACnD,IAAI,CAAC,CAACX,kBAAkB,GAAG,IAAI;MAE/B,IAAI,CAAC,CAACF,eAAe,GAAG,IAA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ACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAIjC,cAAc,CAAC,CAAC","ignoreList":[]}
@@ -40,11 +40,7 @@ var _exportNames = {
40
40
  NotificationManager: true,
41
41
  PlaybackControlName: true,
42
42
  PlaybackNotificationEventName: true,
43
- PlaybackNotificationInfo: true,
44
- RecordingControlName: true,
45
- RecordingNotificationEventName: true,
46
- RecordingNotificationInfo: true,
47
- SimpleNotificationOptions: true
43
+ PlaybackNotificationInfo: true
48
44
  };
49
45
  Object.defineProperty(exports, "AnalyserNode", {
50
46
  enumerable: true,
@@ -202,36 +198,12 @@ Object.defineProperty(exports, "RecorderAdapterNode", {
202
198
  return _RecorderAdapterNode.default;
203
199
  }
204
200
  });
205
- Object.defineProperty(exports, "RecordingControlName", {
206
- enumerable: true,
207
- get: function () {
208
- return _notification.RecordingControlName;
209
- }
210
- });
211
- Object.defineProperty(exports, "RecordingNotificationEventName", {
212
- enumerable: true,
213
- get: function () {
214
- return _notification.RecordingNotificationEventName;
215
- }
216
- });
217
- Object.defineProperty(exports, "RecordingNotificationInfo", {
218
- enumerable: true,
219
- get: function () {
220
- return _notification.RecordingNotificationInfo;
221
- }
222
- });
223
201
  Object.defineProperty(exports, "RecordingNotificationManager", {
224
202
  enumerable: true,
225
203
  get: function () {
226
204
  return _notification.RecordingNotificationManager;
227
205
  }
228
206
  });
229
- Object.defineProperty(exports, "SimpleNotificationOptions", {
230
- enumerable: true,
231
- get: function () {
232
- return _notification.SimpleNotificationOptions;
233
- }
234
- });
235
207
  Object.defineProperty(exports, "StereoPannerNode", {
236
208
  enumerable: true,
237
209
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["require","_AnalyserNode","_interopRequireDefault","_AudioBuffer","_AudioBufferQueueSourceNode","_AudioBufferSourceNode","_AudioContext","_AudioDecoder","_AudioDestinationNode","_AudioNode","_AudioParam","_AudioRecorder","_AudioScheduledSourceNode","_AudioStretcher","_BaseAudioContext","_BiquadFilterNode","_ConstantSourceNode","_ConvolverNode","_DelayNode","_GainNode","_OfflineAudioContext","_OscillatorNode","_RecorderAdapterNode","_StereoPannerNode","_StreamerNode","_WaveShaperNode","_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,OAAA;AACA,IAAAc,iBAAA,GAAAZ,s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A;EAAA;AAAA;AACA,IAAAS,MAAA,GAAA5C,OAAA;AAAAgC,MAAA,CAAAC,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,GAAA7C,OAAA;AAAAgC,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,GAAA5C,sBAAA,CAAAF,OAAA;AAGA,IAAA+C,aAAA,GAAA/C,OAAA;AAG+B,SAAAE,uBAAA8C,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","_DelayNode","_GainNode","_OfflineAudioContext","_OscillatorNode","_RecorderAdapterNode","_StereoPannerNode","_StreamerNode","_WaveShaperNode","_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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udioData = decodeAudioData;
7
7
  exports.decodePCMInBase64 = decodePCMInBase64;
8
+ var _reactNative = require("react-native");
9
+ var _paths = require("../utils/paths");
8
10
  var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
11
+ var _errors = require("../errors");
9
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
13
  class AudioDecoder {
11
14
  static instance = null;
12
15
  constructor() {
13
16
  this.decoder = global.createAudioDecoder();
14
17
  }
18
+ async decodeAudioDataImplementation(input, sampleRate, fetchOptions) {
19
+ if (input instanceof ArrayBuffer) {
20
+ const buffer = await this.decoder.decodeWithMemoryBlock(new Uint8Array(input), sampleRate ?? 0);
21
+ return new _AudioBuffer.default(buffer);
22
+ }
23
+ const stringSource = typeof input === 'number' ? _reactNative.Image.resolveAssetSource(input).uri : input;
24
+
25
+ // input is data:audio/...;base64,...
26
+ if ((0, _paths.isBase64Source)(stringSource)) {
27
+ throw new _errors.AudioApiError('Base64 source decoding is not currently supported, to decode raw PCM base64 strings use decodePCMInBase64 method.');
28
+ }
29
+
30
+ // input is blob:...
31
+ if ((0, _paths.isDataBlobString)(stringSource)) {
32
+ throw new _errors.AudioApiError('Data Blob string decoding is not currently supported.');
33
+ }
34
+
35
+ // input is http(s)://...
36
+ if ((0, _paths.isRemoteSource)(stringSource)) {
37
+ const arrayBuffer = await fetch(stringSource, fetchOptions).then(res => res.arrayBuffer());
38
+ const buffer = await this.decoder.decodeWithMemoryBlock(new Uint8Array(arrayBuffer), sampleRate ?? 0);
39
+ return new _AudioBuffer.default(buffer);
40
+ }
41
+ if (!(typeof input === 'string')) {
42
+ throw new TypeError('Input must be a module, uri or ArrayBuffer');
43
+ }
44
+
45
+ // Local file path
46
+ const filePath = stringSource.startsWith('file://') ? stringSource.replace('file://', '') : stringSource;
47
+ const buffer = await this.decoder.decodeWithFilePath(filePath, sampleRate ?? 0);
48
+ return new _AudioBuffer.default(buffer);
49
+ }
15
50
  static getInstance() {
16
51
  if (!AudioDecoder.instance) {
17
52
  AudioDecoder.instance = new AudioDecoder();
18
53
  }
19
54
  return AudioDecoder.instance;
20
55
  }
21
- async decodeAudioDataInstance(input, sampleRate) {
22
- let buffer;
23
- if (typeof input === 'string') {
24
- // Remove the file:// prefix if it exists
25
- if (input.startsWith('file://')) {
26
- input = input.replace('file://', '');
27
- }
28
- buffer = await this.decoder.decodeWithFilePath(input, sampleRate ?? 0);
29
- } else if (input instanceof ArrayBuffer) {
30
- buffer = await this.decoder.decodeWithMemoryBlock(new Uint8Array(input), sampleRate ?? 0);
31
- }
32
- if (!buffer) {
33
- throw new Error('Unsupported input type or failed to decode audio');
56
+ async decodeAudioDataInstance(input, sampleRate, fetchOptions) {
57
+ const audioBuffer = await this.decodeAudioDataImplementation(input, sampleRate, fetchOptions);
58
+ if (!audioBuffer) {
59
+ throw new _errors.AudioApiError('Failed to decode audio data.');
34
60
  }
35
- return new _AudioBuffer.default(buffer);
61
+ return audioBuffer;
36
62
  }
37
63
  async decodePCMInBase64Instance(base64String, inputSampleRate, inputChannelCount, interleaved) {
38
64
  const buffer = await this.decoder.decodeWithPCMInBase64(base64String, inputSampleRate, inputChannelCount, interleaved);
39
65
  return new _AudioBuffer.default(buffer);
40
66
  }
41
67
  }
42
- async function decodeAudioData(input, sampleRate) {
43
- return AudioDecoder.getInstance().decodeAudioDataInstance(input, sampleRate);
68
+ async function decodeAudioData(input, sampleRate, fetchOptions) {
69
+ return AudioDecoder.getInstance().decodeAudioDataInstance(input, sampleRate, fetchOptions);
44
70
  }
45
71
  async function decodePCMInBase64(base64String, inputSampleRate, inputChannelCount, isInterleaved = true) {
46
72
  return AudioDecoder.getInstance().decodePCMInBase64Instance(base64String, inputSampleRate, inputChannelCount, isInterleaved);
@@ -1 +1 @@
1
- {"version":3,"names":["_AudioBuffer","_interopRequireDefault","require","e","__esModule","default","AudioDecoder","instance","constructor","decoder","global","createAudioDecoder","getInstance","decodeAudioDataInstance","input","sampleRate","buffer","startsWith","replace","decodeWithFilePath","ArrayBuffer","decodeWithMemoryBlock","Uint8Array","Error","AudioBuffer","decodePCMInBase64Instance","base64String","inputSampleRate","inputChannelCount","interleaved","decodeWithPCMInBase64","decodeAudioData","decodePCMInBase64","isInterleaved"],"sourceRoot":"../../../src","sources":["core/AudioDecoder.ts"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExC,MAAMG,YAAY,CAAC;EACjB,OAAeC,QAAQ,GAAwB,IAAI;EAG3CC,WAAWA,CAAA,EAAG;IACpB,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,kBAAkB,CAAC,CAAC;EAC5C;EAEA,OAAcC,WAAWA,CAAA,EAAiB;IACxC,IAAI,CAACN,YAAY,CAACC,QAAQ,EAAE;MAC1BD,YAAY,CAACC,QAAQ,GAAG,IAAID,YAAY,CAAC,CAAC;IAC5C;IACA,OAAOA,YAAY,CAACC,QAAQ;EAC9B;EAEA,MAAaM,uBAAuBA,CAClCC,KAA2B,EAC3BC,UAAmB,EACG;IACtB,IAAIC,MAAM;IACV,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;MAC7B;MACA,IAAIA,KAAK,CAACG,UAAU,CAAC,SAAS,CAAC,EAAE;QAC/BH,KAAK,GAAGA,KAAK,CAACI,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;MACtC;MACAF,MAAM,GAAG,MAAM,IAAI,CAACP,OAAO,CAACU,kBAAkB,CAACL,KAAK,EAAEC,UAAU,IAAI,CAAC,CAAC;IACxE,CAAC,MAAM,IAAID,KAAK,YAAYM,WAAW,EAAE;MACvCJ,MAAM,GAAG,MAAM,IAAI,CAACP,OAAO,CAACY,qBAAqB,CAC/C,IAAIC,UAAU,CAACR,KAAK,CAAC,EACrBC,UAAU,IAAI,CAChB,CAAC;IACH;IAEA,IAAI,CAACC,MAAM,EAAE;MACX,MAAM,IAAIO,KAAK,CAAC,kDAAkD,CAAC;IACrE;IACA,OAAO,IAAIC,oBAAW,CAACR,MAAM,CAAC;EAChC;EAEA,MAAaS,yBAAyBA,CACpCC,YAAoB,EACpBC,eAAuB,EACvBC,iBAAyB,EACzBC,WAAoB,EACE;IACtB,MAAMb,MAAM,GAAG,MAAM,IAAI,CAACP,OAAO,CAACqB,qBAAqB,CACrDJ,YAAY,EACZC,eAAe,EACfC,iBAAiB,EACjBC,WACF,CAAC;IACD,OAAO,IAAIL,oBAAW,CAACR,MAAM,CAAC;EAChC;AACF;AAEO,eAAee,eAAeA,CACnCjB,KAA2B,EAC3BC,UAAmB,EACG;EACtB,OAAOT,YAAY,CAACM,WAAW,CAAC,CAAC,CAACC,uBAAuB,CAACC,KAAK,EAAEC,UAAU,CAAC;AAC9E;AAEO,eAAeiB,iBAAiBA,CACrCN,YAAoB,EACpBC,eAAuB,EACvBC,iBAAyB,EACzBK,aAAsB,GAAG,IAAI,EACP;EACtB,OAAO3B,YAAY,CAACM,WAAW,CAAC,CAAC,CAACa,yBAAyB,CACzDC,YAAY,EACZC,eAAe,EACfC,iBAAiB,EACjBK,aACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_paths","_AudioBuffer","_interopRequireDefault","_errors","e","__esModule","default","AudioDecoder","instance","constructor","decoder","global","createAudioDecoder","decodeAudioDataImplementation","input","sampleRate","fetchOptions","ArrayBuffer","buffer","decodeWithMemoryBlock","Uint8Array","AudioBuffer","stringSource","Image","resolveAssetSource","uri","isBase64Source","AudioApiError","isDataBlobString","isRemoteSource","arrayBuffer","fetch","then","res","TypeError","filePath","startsWith","replace","decodeWithFilePath","getInstance","decodeAudioDataInstance","audioBuffer","decodePCMInBase64Instance","base64String","inputSampleRate","inputChannelCount","interleaved","decodeWithPCMInBase64","decodeAudioData","decodePCMInBase64","isInterleaved"],"sourceRoot":"../../../src","sources":["core/AudioDecoder.ts"],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AqB,CACrDJ,YAAY,EACZC,eAAe,EACfC,iBAAiB,EACjBC,WACF,CAAC;IACD,OAAO,IAAIzB,oBAAW,CAACH,MAAM,CAAC;EAChC;AACF;AAEO,eAAe8B,eAAeA,CACnClC,KAAsB,EACtBC,UAAmB,EACnBC,YAA0B,EACJ;EACtB,OAAOT,YAAY,CAACgC,WAAW,CAAC,CAAC,CAACC,uBAAuB,CACvD1B,KAAK,EACLC,UAAU,EACVC,YACF,CAAC;AACH;AAEO,eAAeiC,iBAAiBA,CACrCN,YAAoB,EACpBC,eAAuB,EACvBC,iBAAyB,EACzBK,aAAsB,GAAG,IAAI,EACP;EACtB,OAAO3C,YAAY,CAACgC,WAAW,CAAC,CAAC,CAACG,yBAAyB,CACzDC,YAAY,EACZC,eAAe,EACfC,iBAAiB,EACjBK,aACF,CAAC;AACH","ignoreList":[]}
@@ -8,6 +8,7 @@ var _events = require("../events");
8
8
  var _types = require("../types");
9
9
  var _filePresets = _interopRequireDefault(require("../utils/filePresets"));
10
10
  var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
11
+ var _errors = require("../errors");
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  // Enforces default options, making sure that all properties are defined
13
14
  // for the contract with native code.
@@ -89,7 +90,7 @@ class AudioRecorder {
89
90
  */
90
91
  connect(node) {
91
92
  if (node.wasConnected) {
92
- throw new Error('RecorderAdapterNode cannot be connected more than once. Refer to the documentation for more details.');
93
+ throw new _errors.AudioApiError('RecorderAdapterNode cannot be connected more than once. Refer to the documentation for more details.');
93
94
  }
94
95
  node.wasConnected = true;
95
96
  this.recorder.connect(node.getNode());