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
@@ -1,18 +1,87 @@
1
1
  "use strict";
2
2
 
3
- import AudioBuffer from "./AudioBuffer.js";
4
3
  import { AudioEventEmitter } from "../events/index.js";
4
+ import { FileDirectory, FileFormat } from "../types.js";
5
+ import FilePreset from "../utils/filePresets.js";
6
+ import AudioBuffer from "./AudioBuffer.js";
7
+ // Enforces default options, making sure that all properties are defined
8
+ // for the contract with native code.
9
+ function withDefaultOptions(inOptions) {
10
+ return {
11
+ directory: FileDirectory.Cache,
12
+ subDirectory: 'AudioAPI',
13
+ fileNamePrefix: 'recording_',
14
+ channelCount: 2,
15
+ format: FileFormat.M4A,
16
+ batchDurationSeconds: 0,
17
+ preset: FilePreset.High,
18
+ androidFlushIntervalMs: 500,
19
+ ...inOptions
20
+ };
21
+ }
5
22
  export default class AudioRecorder {
23
+ onAudioReadySubscription = null;
24
+ onErrorSubscription = null;
25
+ options_ = null;
26
+ isFileOutputEnabled = false;
6
27
  audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
7
- constructor(options) {
8
- this.recorder = global.createAudioRecorder(options);
28
+ constructor() {
29
+ this.recorder = global.createAudioRecorder();
30
+ }
31
+ enableFileOutput(
32
+ // TODO: Re-enable 'batchDurationSeconds' once supported
33
+ options) {
34
+ this.options_ = options || {};
35
+ const parsedOptions = withDefaultOptions(this.options_);
36
+ const result = this.recorder.enableFileOutput(parsedOptions);
37
+ this.isFileOutputEnabled = true;
38
+ return result;
9
39
  }
40
+ get options() {
41
+ return this.options_;
42
+ }
43
+ disableFileOutput() {
44
+ this.options_ = null;
45
+ this.recorder.disableFileOutput();
46
+ this.isFileOutputEnabled = false;
47
+ }
48
+
49
+ /** Starts the audio recording process with configured output options */
10
50
  start() {
11
- this.recorder.start();
51
+ if (!this.isFileOutputEnabled) {
52
+ this.recorder.start();
53
+ return {
54
+ status: 'success',
55
+ path: ''
56
+ };
57
+ }
58
+ return this.recorder.start();
12
59
  }
60
+
61
+ /** Stops the audio recording process and releases internal resources */
13
62
  stop() {
14
- this.recorder.stop();
63
+ return this.recorder.stop();
64
+ }
65
+
66
+ /** Pauses the audio recording process without tearing down anything */
67
+ pause() {
68
+ this.recorder.pause();
15
69
  }
70
+
71
+ /** Resumes the audio recording process after being paused */
72
+ resume() {
73
+ this.recorder.resume();
74
+ }
75
+
76
+ /**
77
+ * Connects a {@link RecorderAdapterNode} to the recorder’s audio graph.
78
+ *
79
+ * Each node can only be connected once. Attempting to connect a node multiple
80
+ * times will throw an error.
81
+ *
82
+ * @param node - The adapter node to connect to the recorder.
83
+ * @throws If the node has already been connected.
84
+ */
16
85
  connect(node) {
17
86
  if (node.wasConnected) {
18
87
  throw new Error('RecorderAdapterNode cannot be connected more than once. Refer to the documentation for more details.');
@@ -20,19 +89,96 @@ export default class AudioRecorder {
20
89
  node.wasConnected = true;
21
90
  this.recorder.connect(node.getNode());
22
91
  }
92
+
93
+ /**
94
+ * Disconnects the recorder from all connected adapter nodes.
95
+ *
96
+ * After calling this method, any connected {@link RecorderAdapterNode} will no
97
+ * longer receive audio data until reconnected.
98
+ */
23
99
  disconnect() {
24
100
  this.recorder.disconnect();
25
101
  }
26
- onAudioReady(callback) {
27
- const onAudioReadyCallback = event => {
102
+
103
+ /**
104
+ * Registers a callback to receive raw audio data during an active recording
105
+ * session.
106
+ *
107
+ * The callback is periodically invoked with audio buffers that match the
108
+ * preferred configuration provided in `options`. These parameters (sample
109
+ * rate, buffer length, and channel count) guide how audio data is chunked and
110
+ * delivered, though the exact values may vary depending on device
111
+ * capabilities. Values may vary depending on device capabilities.
112
+ *
113
+ * @param options - Preferred configuration for the audio buffers delivered to
114
+ * the callback.
115
+ * @param callback - Function invoked each time a new audio buffer is
116
+ * available. The callback receives an {@link OnAudioReadyEventType} object
117
+ * containing the audio data and associated metadata.
118
+ */
119
+ onAudioReady(options, callback) {
120
+ if (this.onAudioReadySubscription) {
121
+ this.recorder.clearOnAudioReady();
122
+ this.onAudioReadySubscription.remove();
123
+ this.onAudioReadySubscription = null;
124
+ }
125
+ this.onAudioReadySubscription = this.audioEventEmitter.addAudioEventListener('audioReady', event => {
126
+ const audioBuffer = new AudioBuffer(event.buffer);
28
127
  callback({
29
- buffer: new AudioBuffer(event.buffer),
30
- numFrames: event.numFrames,
31
- when: event.when
128
+ ...event,
129
+ buffer: audioBuffer
32
130
  });
33
- };
34
- const subscription = this.audioEventEmitter.addAudioEventListener('audioReady', onAudioReadyCallback);
35
- this.recorder.onAudioReady = subscription.subscriptionId;
131
+ });
132
+ return this.recorder.setOnAudioReady({
133
+ sampleRate: options.sampleRate,
134
+ bufferLength: options.bufferLength,
135
+ channelCount: options.channelCount,
136
+ callbackId: this.onAudioReadySubscription.subscriptionId
137
+ });
138
+ }
139
+
140
+ /**
141
+ * Removes the previously registered audio data callback, if any.
142
+ *
143
+ * This stops further `onAudioReady` events from being delivered during
144
+ * recording. Calling this method is safe even if no callback is currently
145
+ * registered.
146
+ */
147
+ clearOnAudioReady() {
148
+ if (!this.onAudioReadySubscription) {
149
+ return;
150
+ }
151
+ this.recorder.clearOnAudioReady();
152
+ this.onAudioReadySubscription.remove();
153
+ this.onAudioReadySubscription = null;
154
+ }
155
+ isRecording() {
156
+ return this.recorder.isRecording();
157
+ }
158
+ isPaused() {
159
+ return this.recorder.isPaused();
160
+ }
161
+ getCurrentDuration() {
162
+ return this.recorder.getCurrentDuration();
163
+ }
164
+ onError(callback) {
165
+ if (this.onErrorSubscription) {
166
+ this.recorder.clearOnError();
167
+ this.onErrorSubscription.remove();
168
+ this.onErrorSubscription = null;
169
+ }
170
+ this.onErrorSubscription = this.audioEventEmitter.addAudioEventListener('recorderError', callback);
171
+ this.recorder.setOnError({
172
+ callbackId: this.onErrorSubscription.subscriptionId
173
+ });
174
+ }
175
+ clearOnError() {
176
+ if (!this.onErrorSubscription) {
177
+ return;
178
+ }
179
+ this.recorder.clearOnError();
180
+ this.onErrorSubscription.remove();
181
+ this.onErrorSubscription = null;
36
182
  }
37
183
  }
38
184
  //# sourceMappingURL=AudioRecorder.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AudioBuffer","AudioEventEmitter","AudioRecorder","audioEventEmitter","global","constructor","options","recorder","createAudioRecorder","start","stop","connect","node","wasConnected","Error","getNode","disconnect","onAudioReady","callback","onAudioReadyCallback","event","buffer","numFrames","when","subscription","addAudioEventListener","subscriptionId"],"sourceRoot":"../../../src","sources":["core/AudioRecorder.ts"],"mappings":";;AAEA,OAAOA,WAAW,MAAM,kBAAe;AAEvC,SAASC,iBAAiB,QAAQ,oBAAW;AAG7C,eAAe,MAAMC,aAAa,CAAC;EAGhBC,iBAAiB,GAAG,IAAIF,iBAAiB,CACxDG,MAAM,CAACH,iBACT,CAAC;EAEDI,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,IAAIrB,WAAW,CAACoB,KAAK,CAACC,MAAM,CAAC;QACrCC,SAAS,EAAEF,KAAK,CAACE,SAAS;QAC1BC,IAAI,EAAEH,KAAK,CAACG;MACd,CAAC,CAAC;IACJ,CAAC;IAED,MAAMC,YAAY,GAAG,IAAI,CAACrB,iBAAiB,CAACsB,qBAAqB,CAC/D,YAAY,EACZN,oBACF,CAAC;IAED,IAAI,CAACZ,QAAQ,CAACU,YAAY,GAAGO,YAAY,CAACE,cAAc;EAC1D;AACF","ignoreList":[]}
1
+ {"version":3,"names":["AudioEventEmitter","FileDirectory","FileFormat","FilePreset","AudioBuffer","withDefaultOptions","inOptions","directory","Cache","subDirectory","fileNamePrefix","channelCount","format","M4A","batchDurationSeconds","preset","High","androidFlushIntervalMs","AudioRecorder","onAudioReadySubscription","onErrorSubscription","options_","isFileOutputEnabled","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","buffer","setOnAudioReady","sampleRate","bufferLength","callbackId","subscriptionId","isRecording","isPaused","getCurrentDuration","onError","clearOnError","setOnError"],"sourceRoot":"../../../src","sources":["core/AudioRecorder.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAgC,oBAAW;AAMrE,SAGEC,aAAa,EACbC,UAAU,QAGL,aAAU;AACjB,OAAOC,UAAU,MAAM,yBAAsB;AAC7C,OAAOC,WAAW,MAAM,kBAAe;AAGvC;AACA;AACA,SAASC,kBAAkBA,CACzBC,SAAmC,EACC;EACpC,OAAO;IACLC,SAAS,EAAEN,aAAa,CAACO,KAAK;IAC9BC,YAAY,EAAE,UAAU;IACxBC,cAAc,EAAE,YAAY;IAC5BC,YAAY,EAAE,CAAC;IACfC,MAAM,EAAEV,UAAU,CAACW,GAAG;IACtBC,oBAAoB,EAAE,CAAC;IACvBC,MAAM,EAAEZ,UAAU,CAACa,IAAI;IACvBC,sBAAsB,EAAE,GAAG;IAC3B,GAAGX;EACL,CAAC;AACH;AAEA,eAAe,MAAMY,aAAa,CAAC;EACvBC,wBAAwB,GAAkC,IAAI;EAC9DC,mBAAmB,GAAkC,IAAI;EAEzDC,QAAQ,GAAoC,IAAI;EAClDC,mBAAmB,GAAY,KAAK;EAEzBC,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C,IAAI,CAAC5B,mBAAmB,GAAG,IAAI;EACjC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","NativeAudioAPIModule","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AACZ,SAASA,mBAAmB,QAAQ,cAAc;AAsDlD,MAAMC,oBAAoB,GAAGD,mBAAmB,CAACE,GAAG,CAAO,gBAAgB,CAAC;AAE5E,SAASD,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","NativeAudioAPIModule","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,mBAAmB,QAAQ,cAAc;AAqDlD,MAAMC,oBAAoB,GAAGD,mBAAmB,CAACE,GAAG,CAAO,gBAAgB,CAAC;AAE5E,SAASD,oBAAoB","ignoreList":[]}
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
 
3
- import { NativeAudioAPIModule } from "../../specs/index.js";
4
3
  import { AudioEventEmitter } from "../../events/index.js";
4
+ import { NativeAudioAPIModule } from "../../specs/index.js";
5
5
  /// Manager for media playback notifications with controls and MediaSession integration.
6
6
  class PlaybackNotificationManager {
7
7
  notificationKey = 'playback';
8
- isRegistered = false;
9
- isShown = false;
8
+ isRegistered_ = false;
9
+ isShown_ = false;
10
10
  constructor() {
11
11
  this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
12
12
  }
13
13
 
14
14
  /// Register the playback notification (must be called before showing).
15
15
  async register() {
16
- if (this.isRegistered) {
16
+ if (this.isRegistered_) {
17
17
  console.warn('PlaybackNotification is already registered');
18
18
  return;
19
19
  }
@@ -24,12 +24,12 @@ class PlaybackNotificationManager {
24
24
  if (result.error) {
25
25
  throw new Error(result.error);
26
26
  }
27
- this.isRegistered = true;
27
+ this.isRegistered_ = true;
28
28
  }
29
29
 
30
30
  /// Show the notification with initial metadata.
31
31
  async show(info) {
32
- if (!this.isRegistered) {
32
+ if (!this.isRegistered_) {
33
33
  throw new Error('PlaybackNotification must be registered before showing. Call register() first.');
34
34
  }
35
35
  if (!NativeAudioAPIModule) {
@@ -39,12 +39,12 @@ class PlaybackNotificationManager {
39
39
  if (result.error) {
40
40
  throw new Error(result.error);
41
41
  }
42
- this.isShown = true;
42
+ this.isShown_ = true;
43
43
  }
44
44
 
45
45
  /// Update the notification with new metadata or state.
46
46
  async update(info) {
47
- if (!this.isShown) {
47
+ if (!this.isShown_) {
48
48
  console.warn('PlaybackNotification is not shown. Call show() first.');
49
49
  return;
50
50
  }
@@ -59,7 +59,7 @@ class PlaybackNotificationManager {
59
59
 
60
60
  /// Hide the notification (can be shown again later).
61
61
  async hide() {
62
- if (!this.isShown) {
62
+ if (!this.isShown_) {
63
63
  return;
64
64
  }
65
65
  if (!NativeAudioAPIModule) {
@@ -69,15 +69,15 @@ class PlaybackNotificationManager {
69
69
  if (result.error) {
70
70
  throw new Error(result.error);
71
71
  }
72
- this.isShown = false;
72
+ this.isShown_ = false;
73
73
  }
74
74
 
75
75
  /// Unregister the notification (must register again to use).
76
76
  async unregister() {
77
- if (!this.isRegistered) {
77
+ if (!this.isRegistered_) {
78
78
  return;
79
79
  }
80
- if (this.isShown) {
80
+ if (this.isShown_) {
81
81
  await this.hide();
82
82
  }
83
83
  if (!NativeAudioAPIModule) {
@@ -87,12 +87,12 @@ class PlaybackNotificationManager {
87
87
  if (result.error) {
88
88
  throw new Error(result.error);
89
89
  }
90
- this.isRegistered = false;
90
+ this.isRegistered_ = false;
91
91
  }
92
92
 
93
93
  /// Enable or disable a specific playback control.
94
94
  async enableControl(control, enabled) {
95
- if (!this.isRegistered) {
95
+ if (!this.isRegistered_) {
96
96
  console.warn('PlaybackNotification is not registered');
97
97
  return;
98
98
  }
@@ -116,6 +116,9 @@ class PlaybackNotificationManager {
116
116
  }
117
117
  return await NativeAudioAPIModule.isNotificationActive(this.notificationKey);
118
118
  }
119
+ isRegistered() {
120
+ return this.isRegistered_;
121
+ }
119
122
 
120
123
  /// Add an event listener for notification actions.
121
124
  addEventListener(eventName, callback) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeAudioAPIModule","AudioEventEmitter","PlaybackNotificationManager","notificationKey","isRegistered","isShown","constructor","audioEventEmitter","global","register","console","warn","Error","result","registerNotification","error","show","info","showNotification","update","updateNotification","hide","hideNotification","unregister","unregisterNotification","enableControl","control","enabled","params","isActive","isNotificationActive","addEventListener","eventName","callback","addAudioEventListener","removeEventListener","subscription","remove"],"sourceRoot":"../../../../src","sources":["system/notification/PlaybackNotificationManager.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,sBAAa;AAClD,SAASC,iBAAiB,QAAgC,uBAAc;AASxE;AACA,MAAMC,2BAA2B,CAOjC;EACUC,eAAe,GAAG,UAAU;EAC5BC,YAAY,GAAG,KAAK;EACpBC,OAAO,GAAG,KAAK;EAGvBC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIN,iBAAiB,CAACO,MAAM,CAACP,iBAAiB,CAAC;EAC1E;;EAEA;EACA,MAAMQ,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAACL,YAAY,EAAE;MACrBM,OAAO,CAACC,IAAI,CAAC,4CAA4C,CAAC;MAC1D;IACF;IAEA,IAAI,CAACX,oBAAoB,EAAE;MACzB,MAAM,IAAIY,KAAK,CAAC,uCAAuC,CAAC;IAC1D;IAEA,MAAMC,MAAM,GAAG,MAAMb,oBAAoB,CAACc,oBAAoB,CAC5D,UAAU,EACV,IAAI,CAACX,eACP,CAAC;IAED,IAAIU,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,KAAK,CAACC,MAAM,CAACE,KAAK,CAAC;IAC/B;IAEA,IAAI,CAACX,YAAY,GAAG,IAAI;EAC1B;;EAEA;EACA,MAAMY,IAAIA,CAACC,IAA8B,EAAiB;IACxD,IAAI,CAAC,IAAI,CAACb,YAAY,EA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xB;IACxB,OAAO,IAAI,CAAC1B,iBAAiB,CAAC2B,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;;EAEA;EACAE,mBAAmBA,CAACC,YAAoC,EAAQ;IAC9DA,YAAY,CAACC,MAAM,CAAC,CAAC;EACvB;AACF;AAEA,eAAe,IAAInC,2BAA2B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AudioEventEmitter","NativeAudioAPIModule","PlaybackNotificationManager","notificationKey","isRegistered_","isShown_","constructor","audioEventEmitter","global","register","console","warn","Error","result","registerNotification","error","show","info","showNotification","update","updateNotification","hide","hideNotification","unregister","unregisterNotification","enableControl","control","enabled","params","isActive","isNotificationActive","isRegistered","addEventListener","eventName","callback","addAudioEventListener","removeEventListener","subscription","remove"],"sourceRoot":"../../../../src","sources":["system/notification/PlaybackNotificationManager.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAgC,uBAAc;AACxE,SAASC,oBAAoB,QAAQ,sBAAa;AASlD;AACA,MAAMC,2BAA2B,CAOjC;EACUC,eAAe,GAAG,UAAU;EAC5BC,aAAa,GAAG,KAAK;EACrBC,QAAQ,GAAG,KAAK;EAGxBC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIP,iBAAiB,CAACQ,MAAM,CAACR,iBAAiB,CAAC;EAC1E;;EAEA;EACA,MAAMS,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAACL,aAAa,EAAE;MACtBM,OAAO,CAACC,IAAI,CAAC,4CAA4C,CAAC;MAC1D;IACF;IAEA,IAAI,CAACV,oBAAoB,EAAE;MACzB,MAAM,IAAIW,KAAK,CAAC,uCAAuC,CAAC;IAC1D;IAEA,MAAMC,MAAM,GAAG,MAAMZ,oBAAoB,CAACa,oBAAoB,CAC5D,UAAU,EACV,IAAI,CAACX,eACP,CAAC;IAED,IAAIU,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,KAAK,CAACC,MAAM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AAoB,EAAE;MACzB,OAAO,KAAK;IACd;IAEA,OAAO,MAAMA,oBAAoB,CAAC6B,oBAAoB,CACpD,IAAI,CAAC3B,eACP,CAAC;EACH;EAEA4B,YAAYA,CAAA,EAAY;IACtB,OAAO,IAAI,CAAC3B,aAAa;EAC3B;;EAEA;EACA4B,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB,OAAO,IAAI,CAAC3B,iBAAiB,CAAC4B,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;;EAEA;EACAE,mBAAmBA,CAACC,YAAoC,EAAQ;IAC9DA,YAAY,CAACC,MAAM,CAAC,CAAC;EACvB;AACF;AAEA,eAAe,IAAIpC,2BAA2B,CAAC,CAAC","ignoreList":[]}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import { Platform } from 'react-native';
4
- import { NativeAudioAPIModule } from "../../specs/index.js";
5
4
  import { AudioEventEmitter } from "../../events/index.js";
5
+ import { NativeAudioAPIModule } from "../../specs/index.js";
6
6
  /// Manager for recording notifications with controls.
7
7
  class RecordingNotificationManager {
8
+ isRegistered_ = false;
9
+ isShown_ = false;
8
10
  notificationKey = 'recording';
9
- isRegistered = false;
10
- isShown = false;
11
11
  isIOS = Platform.OS === 'ios';
12
12
  constructor() {
13
13
  this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
@@ -15,14 +15,14 @@ class RecordingNotificationManager {
15
15
 
16
16
  /// Register the recording notification (must be called before showing).
17
17
  async register() {
18
- if (this.isRegistered) {
18
+ if (this.isRegistered_) {
19
19
  console.warn('RecordingNotification is already registered');
20
20
  return;
21
21
  }
22
22
 
23
23
  // Recording notifications are only supported on Android
24
24
  if (this.isIOS) {
25
- this.isRegistered = true;
25
+ this.isRegistered_ = true;
26
26
  return;
27
27
  }
28
28
  if (!NativeAudioAPIModule) {
@@ -32,18 +32,18 @@ class RecordingNotificationManager {
32
32
  if (result.error) {
33
33
  throw new Error(result.error);
34
34
  }
35
- this.isRegistered = true;
35
+ this.isRegistered_ = true;
36
36
  }
37
37
 
38
38
  /// Show the notification with initial metadata.
39
39
  async show(info) {
40
- if (!this.isRegistered) {
40
+ if (!this.isRegistered_) {
41
41
  throw new Error('RecordingNotification must be registered before showing. Call register() first.');
42
42
  }
43
43
 
44
44
  // Recording notifications are only supported on Android
45
45
  if (this.isIOS) {
46
- this.isShown = true;
46
+ this.isShown_ = true;
47
47
  return;
48
48
  }
49
49
  if (!NativeAudioAPIModule) {
@@ -53,12 +53,12 @@ class RecordingNotificationManager {
53
53
  if (result.error) {
54
54
  throw new Error(result.error);
55
55
  }
56
- this.isShown = true;
56
+ this.isShown_ = true;
57
57
  }
58
58
 
59
59
  /// Update the notification with new metadata or state.
60
60
  async update(info) {
61
- if (!this.isShown) {
61
+ if (!this.isShown_) {
62
62
  console.warn('RecordingNotification is not shown. Call show() first.');
63
63
  return;
64
64
  }
@@ -78,13 +78,13 @@ class RecordingNotificationManager {
78
78
 
79
79
  /// Hide the notification (can be shown again later).
80
80
  async hide() {
81
- if (!this.isShown) {
81
+ if (!this.isShown_) {
82
82
  return;
83
83
  }
84
84
 
85
85
  // Recording notifications are only supported on Android
86
86
  if (this.isIOS) {
87
- this.isShown = false;
87
+ this.isShown_ = false;
88
88
  return;
89
89
  }
90
90
  if (!NativeAudioAPIModule) {
@@ -94,21 +94,21 @@ class RecordingNotificationManager {
94
94
  if (result.error) {
95
95
  throw new Error(result.error);
96
96
  }
97
- this.isShown = false;
97
+ this.isShown_ = false;
98
98
  }
99
99
 
100
100
  /// Unregister the notification (must register again to use).
101
101
  async unregister() {
102
- if (!this.isRegistered) {
102
+ if (!this.isRegistered_) {
103
103
  return;
104
104
  }
105
- if (this.isShown) {
105
+ if (this.isShown_) {
106
106
  await this.hide();
107
107
  }
108
108
 
109
109
  // Recording notifications are only supported on Android
110
110
  if (this.isIOS) {
111
- this.isRegistered = false;
111
+ this.isRegistered_ = false;
112
112
  return;
113
113
  }
114
114
  if (!NativeAudioAPIModule) {
@@ -118,12 +118,12 @@ class RecordingNotificationManager {
118
118
  if (result.error) {
119
119
  throw new Error(result.error);
120
120
  }
121
- this.isRegistered = false;
121
+ this.isRegistered_ = false;
122
122
  }
123
123
 
124
124
  /// Enable or disable a specific recording control.
125
125
  async enableControl(control, enabled) {
126
- if (!this.isRegistered) {
126
+ if (!this.isRegistered_) {
127
127
  console.warn('RecordingNotification is not registered');
128
128
  return;
129
129
  }
@@ -149,13 +149,16 @@ class RecordingNotificationManager {
149
149
  async isActive() {
150
150
  // Recording notifications are only supported on Android
151
151
  if (this.isIOS) {
152
- return this.isShown;
152
+ return this.isShown_;
153
153
  }
154
154
  if (!NativeAudioAPIModule) {
155
155
  return false;
156
156
  }
157
157
  return await NativeAudioAPIModule.isNotificationActive(this.notificationKey);
158
158
  }
159
+ isRegistered() {
160
+ return this.isRegistered_;
161
+ }
159
162
 
160
163
  /// Add an event listener for notification actions.
161
164
  addEventListener(eventName, callback) {
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","NativeAudioAPIModule","AudioEventEmitter","RecordingNotificationManager","notificationKey","isRegistered","isShown","isIOS","OS","constructor","audioEventEmitter","global","register","console","warn","Error","result","registerNotification","error","show","info","showNotification","update","updateNotification","hide","hideNotification","unregister","unregisterNotification","enableControl","control","enabled","params","isActive","isNotificationActive","addEventListener","eventName","callback","remove","addAudioEventListener","removeEventListener","subscription"],"sourceRoot":"../../../../src","sources":["system/notification/RecordingNotificationManager.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,QAAQ,sBAAa;AAClD,SAASC,iBAAiB,QAAgC,uBAAc;AASxE;AACA,MAAMC,4BAA4B,CAOlC;EACUC,eAAe,GAAG,WAAW;EAC7BC,YAAY,GAAG,KAAK;EACpBC,OAAO,GAAG,KAAK;EAEfC,KAAK,GAAGP,QAAQ,CAACQ,EAAE,KAAK,KAAK;EAErCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAAC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EAAEA,CAAA,KAAM,CAAC;MACjB,CAAC;IACH;IAEA,OAAO,IAAI,CAAC3B,iBAAiB,CAAC4B,qBAAqB,CAACH,SAAS,EAAEC,QAAQ,CAAC;EAC1E;;EAEA;EACAG,mBAAmBA,CAACC,YAAoC,EAAQ;IAC9DA,YAAY,CAACH,MAAM,CAAC,CAAC;EACvB;AACF;AAEA,eAAe,IAAIlC,4BAA4B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","AudioEventEmitter","NativeAudioAPIModule","RecordingNotificationManager","isRegistered_","isShown_","notificationKey","isIOS","OS","constructor","audioEventEmitter","global","register","console","warn","Error","result","registerNotification","error","show","info","showNotification","update","updateNotification","hide","hideNotification","unregister","unregisterNotification","enableControl","control","enabled","params","isActive","isNotificationActive","isRegistered","addEventListener","eventName","callback","remove","addAudioEventListener","removeEventListener","subscription"],"sourceRoot":"../../../../src","sources":["system/notification/RecordingNotificationManager.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,iBAAiB,QAAgC,uBAAc;AACxE,SAASC,oBAAoB,QAAQ,sBAAa;AASlD;AACA,MAAMC,4BAA4B,CAOlC;EACUC,aAAa,GAAG,KAAK;EACrBC,QAAQ,GAAG,KAAK;EAEhBC,eAAe,GAAG,WAAW;EAE7BC,KAAK,GAAGP,QAAQ,CAACQ,EAAE,KAAK,KAAK;EAErCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIT,iBAAiB,CAACU,MAAM,CAACV,iBAAiB,CAAC;EAC1E;;EAEA;EACA,MAAMW,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAACR,aAAa,EAAE;MACtBS,OAAO,CAACC,IAAI,CAAC,6CAA6C,CAAC;MAC3D;IACF;;IAEA;IACA,IAAI,IAAI,CAACP,KAAK,EAAE;MACd,IAAI,CAACH,aAAa,GAAG,IAAI;MACzB;IACF;IAEA,IAAI,CAACF,oBAAoB,EAAE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C,CAAC","ignoreList":[]}
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
 
3
- import { NativeAudioAPIModule } from "../../specs/index.js";
4
3
  import { AudioEventEmitter } from "../../events/index.js";
4
+ import { NativeAudioAPIModule } from "../../specs/index.js";
5
5
  /// Simple notification manager for basic notifications with title and text.
6
6
  /// Implements the generic NotificationManager interface.
7
7
  // It is only a showcase
8
8
  class SimpleNotificationManager {
9
+ isRegistered_ = false;
10
+ isShown_ = false;
9
11
  notificationKey = 'simple';
10
- isRegistered = false;
11
- isShown = false;
12
12
  constructor() {
13
13
  this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
14
14
  }
15
15
 
16
16
  /// Register the simple notification (must be called before showing).
17
17
  async register() {
18
- if (this.isRegistered) {
18
+ if (this.isRegistered_) {
19
19
  console.warn('SimpleNotification is already registered');
20
20
  return;
21
21
  }
@@ -26,12 +26,12 @@ class SimpleNotificationManager {
26
26
  if (result.error) {
27
27
  throw new Error(result.error);
28
28
  }
29
- this.isRegistered = true;
29
+ this.isRegistered_ = true;
30
30
  }
31
31
 
32
32
  /// Show the notification with initial options.
33
33
  async show(options) {
34
- if (!this.isRegistered) {
34
+ if (!this.isRegistered_) {
35
35
  throw new Error('SimpleNotification must be registered before showing. Call register() first.');
36
36
  }
37
37
  if (!NativeAudioAPIModule) {
@@ -41,12 +41,12 @@ class SimpleNotificationManager {
41
41
  if (result.error) {
42
42
  throw new Error(result.error);
43
43
  }
44
- this.isShown = true;
44
+ this.isShown_ = true;
45
45
  }
46
46
 
47
47
  /// Update the notification with new options.
48
48
  async update(options) {
49
- if (!this.isShown) {
49
+ if (!this.isShown_) {
50
50
  console.warn('SimpleNotification is not shown. Call show() first.');
51
51
  return;
52
52
  }
@@ -61,7 +61,7 @@ class SimpleNotificationManager {
61
61
 
62
62
  /// Hide the notification (can be shown again later).
63
63
  async hide() {
64
- if (!this.isShown) {
64
+ if (!this.isShown_) {
65
65
  return;
66
66
  }
67
67
  if (!NativeAudioAPIModule) {
@@ -71,15 +71,15 @@ class SimpleNotificationManager {
71
71
  if (result.error) {
72
72
  throw new Error(result.error);
73
73
  }
74
- this.isShown = false;
74
+ this.isShown_ = false;
75
75
  }
76
76
 
77
77
  /// Unregister the notification (must register again to use).
78
78
  async unregister() {
79
- if (!this.isRegistered) {
79
+ if (!this.isRegistered_) {
80
80
  return;
81
81
  }
82
- if (this.isShown) {
82
+ if (this.isShown_) {
83
83
  await this.hide();
84
84
  }
85
85
  if (!NativeAudioAPIModule) {
@@ -89,7 +89,7 @@ class SimpleNotificationManager {
89
89
  if (result.error) {
90
90
  throw new Error(result.error);
91
91
  }
92
- this.isRegistered = false;
92
+ this.isRegistered_ = false;
93
93
  }
94
94
 
95
95
  /// Check if the notification is currently active.
@@ -99,6 +99,9 @@ class SimpleNotificationManager {
99
99
  }
100
100
  return await NativeAudioAPIModule.isNotificationActive(this.notificationKey);
101
101
  }
102
+ isRegistered() {
103
+ return this.isRegistered_;
104
+ }
102
105
 
103
106
  /// Add an event listener (SimpleNotification doesn't emit events).
104
107
  addEventListener(_eventName, _callback) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeAudioAPIModule","AudioEventEmitter","SimpleNotificationManager","notificationKey","isRegistered","isShown","constructor","audioEventEmitter","global","register","console","warn","Error","result","registerNotification","error","show","options","showNotification","update","updateNotification","hide","hideNotification","unregister","unregisterNotification","isActive","isNotificationActive","addEventListener","_eventName","_callback","addAudioEventListener","removeEventListener","subscription","remove"],"sourceRoot":"../../../../src","sources":["system/notification/SimpleNotificationManager.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,sBAAa;AAClD,SAASC,iBAAiB,QAAgC,uBAAc;AAGxE;AACA;AACA;AACA,MAAMC,yBAAyB,CAO/B;EACUC,eAAe,GAAG,QAAQ;EAC1BC,YAAY,GAAG,KAAK;EACpBC,OAAO,GAAG,KAAK;EAGvBC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIN,iB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AAI,CAACvB,eACP,CAAC;EACH;;EAEA;EACAwB,gBAAgBA,CACdC,UAAa,EACbC,SAAiC,EACT;IACxB;IACAnB,OAAO,CAACC,IAAI,CAAC,qDAAqD,CAAC;IACnE,OAAO,IAAI,CAACJ,iBAAiB,CAACuB,qBAAqB;IACjD;IACA,0BAA0B,EAC1B,MAAM,CAAC,CACT,CAAC;EACH;;EAEA;EACAC,mBAAmBA,CAACC,YAAoC,EAAQ;IAC9DA,YAAY,CAACC,MAAM,CAAC,CAAC;EACvB;AACF;AAEA,eAAe,IAAI/B,yBAAyB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AudioEventEmitter","NativeAudioAPIModule","SimpleNotificationManager","isRegistered_","isShown_","notificationKey","constructor","audioEventEmitter","global","register","console","warn","Error","result","registerNotification","error","show","options","showNotification","update","updateNotification","hide","hideNotification","unregister","unregisterNotification","isActive","isNotificationActive","isRegistered","addEventListener","_eventName","_callback","addAudioEventListener","removeEventListener","subscription","remove"],"sourceRoot":"../../../../src","sources":["system/notification/SimpleNotificationManager.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAgC,uBAAc;AACxE,SAASC,oBAAoB,QAAQ,sBAAa;AAGlD;AACA;AACA;AACA,MAAMC,yBAAyB,CAO/B;EACUC,aAAa,GAAG,KAAK;EACrBC,QAAQ,GAAG,KAAK;EAEhBC,eAAe,GAAG,QAAQ;EAGlCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIP,iBAAiB,CAACQ,MAAM,CAACR,iBAAiB,CAAC;EAC1E;;EAEA;EACA,MAAMS,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAACN,aAAa,EAAE;MACtBO,OAAO,CAACC,IAAI,CAAC,0CAA0C,CAAC;MACxD;IACF;IAEA,IAAI,CAACV,oBAAoB,EAAE;MACzB,MAAM,IAAIW,KAAK,CAAC,uCAAuC,CAAC;IAC1D;IAEA,MAAMC,MAAM,GAAG,MAAMZ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