react-native-audio-api 0.11.0-nightly-c743c16-20260115 → 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 (27) hide show
  1. package/android/src/main/java/com/swmansion/audioapi/system/notification/NotificationRegistry.kt +5 -1
  2. package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +0 -1
  3. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotification.kt +34 -7
  4. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +1 -0
  5. package/android/src/oldarch/NativeAudioAPIModuleSpec.java +1 -13
  6. package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +1 -1
  7. package/lib/commonjs/system/notification/PlaybackNotificationManager.js +31 -13
  8. package/lib/commonjs/system/notification/PlaybackNotificationManager.js.map +1 -1
  9. package/lib/commonjs/system/notification/RecordingNotificationManager.ios.js +51 -0
  10. package/lib/commonjs/system/notification/RecordingNotificationManager.ios.js.map +1 -0
  11. package/lib/commonjs/system/notification/RecordingNotificationManager.js +1 -1
  12. package/lib/module/system/notification/PlaybackNotificationManager.js +31 -14
  13. package/lib/module/system/notification/PlaybackNotificationManager.js.map +1 -1
  14. package/lib/module/system/notification/RecordingNotificationManager.ios.js +47 -0
  15. package/lib/module/system/notification/RecordingNotificationManager.ios.js.map +1 -0
  16. package/lib/module/system/notification/RecordingNotificationManager.js +1 -1
  17. package/lib/module/system/notification/index.js +1 -1
  18. package/lib/module/system/notification/index.js.map +1 -1
  19. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts +31 -1
  20. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts.map +1 -1
  21. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts +1 -1
  22. package/lib/typescript/system/notification/RecordingNotificationManager.ios.d.ts +36 -0
  23. package/lib/typescript/system/notification/RecordingNotificationManager.ios.d.ts.map +1 -0
  24. package/package.json +1 -1
  25. package/src/system/notification/PlaybackNotificationManager.ts +31 -13
  26. package/src/system/notification/RecordingNotificationManager.ios.ts +65 -0
  27. package/src/system/notification/RecordingNotificationManager.ts +1 -1
@@ -125,6 +125,7 @@ class NotificationRegistry(
125
125
  "audio_playback",
126
126
  )
127
127
  }
128
+
128
129
  "recording" -> {
129
130
  RecordingNotification(
130
131
  reactContext,
@@ -133,7 +134,10 @@ class NotificationRegistry(
133
134
  "audio_recording4",
134
135
  )
135
136
  }
136
- else -> throw IllegalArgumentException("Unknown notification type: $type")
137
+
138
+ else -> {
139
+ throw IllegalArgumentException("Unknown notification type: $type")
140
+ }
137
141
  }
138
142
 
139
143
  notifications[key] = notification
@@ -13,7 +13,6 @@ import android.support.v4.media.session.MediaSessionCompat
13
13
  import android.support.v4.media.session.PlaybackStateCompat
14
14
  import android.view.KeyEvent
15
15
  import androidx.core.app.NotificationCompat
16
- import androidx.core.graphics.drawable.IconCompat
17
16
  import androidx.media.app.NotificationCompat.MediaStyle
18
17
  import com.facebook.react.bridge.ReactApplicationContext
19
18
  import com.facebook.react.bridge.ReadableMap
@@ -239,19 +239,46 @@ class RecordingNotification(
239
239
  }
240
240
 
241
241
  private fun parseMapFromRN(options: ReadableMap?) {
242
- state.title = if (options?.hasKey("title") == true) options.getString("title") else "Recording Audio"
242
+ state.title = if (options?.hasKey("title") == true) options.getString("title") else state.title ?: "Recording Audio"
243
243
  state.contentText =
244
244
  if (options?.hasKey("contentText") == true) {
245
245
  options.getString("contentText")
246
246
  } else {
247
- "Audio recording is in progress/paused"
247
+ state.contentText ?: "Audio recording is in progress/paused"
248
+ }
249
+ state.smallIconResourceName =
250
+ if (options?.hasKey("smallIconResourceName") ==
251
+ true
252
+ ) {
253
+ options.getString("smallIconResourceName")
254
+ } else {
255
+ state.smallIconResourceName ?: null
256
+ }
257
+ state.largeIconResourceName =
258
+ if (options?.hasKey("largeIconResourceName") ==
259
+ true
260
+ ) {
261
+ options.getString("largeIconResourceName")
262
+ } else {
263
+ state.largeIconResourceName ?: null
264
+ }
265
+ state.pauseIconResourceName =
266
+ if (options?.hasKey("pauseIconResourceName") ==
267
+ true
268
+ ) {
269
+ options.getString("pauseIconResourceName")
270
+ } else {
271
+ state.pauseIconResourceName ?: null
248
272
  }
249
- state.smallIconResourceName = if (options?.hasKey("smallIconResourceName") == true) options.getString("smallIconResourceName") else null
250
- state.largeIconResourceName = if (options?.hasKey("largeIconResourceName") == true) options.getString("largeIconResourceName") else null
251
- state.pauseIconResourceName = if (options?.hasKey("pauseIconResourceName") == true) options.getString("pauseIconResourceName") else null
252
273
  state.resumeIconResourceName =
253
- if (options?.hasKey("resumeIconResourceName") == true) options.getString("resumeIconResourceName") else null
254
- state.backgroundColor = if (options?.hasKey("color") == true) options.getInt("color") else null
274
+ if (options?.hasKey("resumeIconResourceName") ==
275
+ true
276
+ ) {
277
+ options.getString("resumeIconResourceName")
278
+ } else {
279
+ state.resumeIconResourceName ?: null
280
+ }
281
+ state.backgroundColor = if (options?.hasKey("color") == true) options.getInt("color") else state.backgroundColor ?: null
255
282
  state.paused = if (options?.hasKey("paused") == true) options.getBoolean("paused") else false
256
283
  }
257
284
 
@@ -24,6 +24,7 @@ class RecordingNotificationReceiver(
24
24
  Log.d(TAG, "Recording stopped via notification")
25
25
  module.invokeHandlerWithEventNameAndEventBody("recordingNotificationPause", mapOf())
26
26
  }
27
+
27
28
  NOTIFICATION_RECORDING_RESUMED -> {
28
29
  Log.d(TAG, "Recording resumed via notification")
29
30
  module.invokeHandlerWithEventNameAndEventBody("recordingNotificationResume", mapOf())
@@ -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);
@@ -7,15 +7,19 @@ exports.default = void 0;
7
7
  var _events = require("../../events");
8
8
  var _specs = require("../../specs");
9
9
  var _errors = require("../../errors");
10
- /// Manager for media playback notifications with controls and MediaSession integration.
11
10
  class PlaybackNotificationManager {
12
11
  notificationKey = 'playback';
13
12
  constructor() {
14
13
  this.audioEventEmitter = new _events.AudioEventEmitter(global.AudioEventEmitter);
15
14
  }
16
15
 
17
- /// Show the notification with metadata or update if already visible.
18
- /// Automatically creates the notification on first call.
16
+ /**
17
+ * Show the notification with metadata or update if already visible.
18
+ * Automatically creates the notification on first call.
19
+ *
20
+ * @param info - The info to be displayed.
21
+ * @returns Promise that resolves after creating notification.
22
+ */
19
23
  async show(info) {
20
24
  if (!_specs.NativeAudioAPIModule) {
21
25
  throw new _errors.AudioApiError('NativeAudioAPIModule is not available');
@@ -26,13 +30,11 @@ class PlaybackNotificationManager {
26
30
  }
27
31
  }
28
32
 
29
- /// Update the notification with new metadata or state.
30
- /// This is an alias for show() since show handles both initial display and updates.
31
- async update(info) {
32
- return this.show(info);
33
- }
34
-
35
- /// Hide the notification.
33
+ /**
34
+ * Hide the notification.
35
+ *
36
+ * @returns Promise that resolves after hiding notification.
37
+ */
36
38
  async hide() {
37
39
  if (!_specs.NativeAudioAPIModule) {
38
40
  throw new _errors.AudioApiError('NativeAudioAPIModule is not available');
@@ -43,7 +45,13 @@ class PlaybackNotificationManager {
43
45
  }
44
46
  }
45
47
 
46
- /// Enable or disable a specific playback control.
48
+ /**
49
+ * Enable or disable a specific playback control.
50
+ *
51
+ * @param control - The control to enable or disable on the notification.
52
+ * @param enabled - Whether to enable (true) or disable (false) the control.
53
+ * @returns Promise that resolves after showing modified notification.
54
+ */
47
55
  async enableControl(control, enabled) {
48
56
  if (!_specs.NativeAudioAPIModule) {
49
57
  throw new _errors.AudioApiError('NativeAudioAPIModule is not available');
@@ -58,7 +66,11 @@ class PlaybackNotificationManager {
58
66
  }
59
67
  }
60
68
 
61
- /// Check if the notification is currently active.
69
+ /**
70
+ * Check if the notification is currently active.
71
+ *
72
+ * @returns Promise that resolves to whether notification is active.
73
+ */
62
74
  async isActive() {
63
75
  if (!_specs.NativeAudioAPIModule) {
64
76
  return false;
@@ -66,7 +78,13 @@ class PlaybackNotificationManager {
66
78
  return await _specs.NativeAudioAPIModule.isNotificationActive(this.notificationKey);
67
79
  }
68
80
 
69
- /// Add an event listener for notification actions.
81
+ /**
82
+ * Add an event listener for notification actions.
83
+ *
84
+ * @param eventName - The event name to listen for.
85
+ * @param callback - The callback to invoke on event.
86
+ * @returns Class that represents the subscription.
87
+ */
70
88
  addEventListener(eventName, callback) {
71
89
  return this.audioEventEmitter.addAudioEventListener(eventName, callback);
72
90
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_events","require","_specs","_errors","PlaybackNotificationManager","notificationKey","constructor","audioEventEmitter","AudioEventEmitter","global","show","info","NativeAudioAPIModule","AudioApiError","result","showNotification","error","update","hide","hideNotification","enableControl","control","enabled","params","isActive","isNotificationActive","addEventListener","eventName","callback","addAudioEventListener","_default","exports","default"],"sourceRoot":"../../../../src","sources":["system/notification/PlaybackNotificationManager.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,2BAA2B,CAGjC;EACUC,eAAe,GAAG,UAAU;EAGpCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAiB,CAACC,MAAM,CAACD,iBAAiB,CAAC;EAC1E;;EAEA;EACA;EACA,MAAME,IAAIA,CAACC,IAA8B,EAAiB;IACxD,IAAI,CAACC,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMC,MAAM,GAAG,MAAMF,2BAAoB,CAACG,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACV,eAAe,EACpBM,IACF,CAAC;IAED,IAAIG,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,qBAAa,CAACC,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;EACA;EACA,MAAMC,MAAMA,CAACN,IAA8B,EAAiB;IAC1D,OAAO,IAAI,CAACD,IAAI,CAACC,IAAI,CAAC;EACxB;;EAEA;EACA,MAAMO,IAAIA,CAAA,EAAkB;IAC1B,IAAI,CAACN,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMC,MAAM,GAAG,MAAMF,2BAAoB,CAACO,gBAAgB,CACxD,IAAI,CAACd,eACP,CAAC;IAED,IAAIS,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,qBAAa,CAACC,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;EACA,MAAMI,aAAaA,CACjBC,OAA4B,EAC5BC,OAAgB,EACD;IACf,IAAI,CAACV,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMU,MAAM,GAAG;MAAEF,OAAO;MAAEC;IAAQ,CAAC;IACnC,MAAMR,MAAM,GAAG,MAAMF,2BAAoB,CAACG,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACV,eAAe,EACpBkB,MACF,CAAC;IAED,IAAIT,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,qBAAa,CAACC,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;EACA,MAAMQ,QAAQA,CAAA,EAAqB;IACjC,IAAI,CAACZ,2BAAoB,EAAE;MACzB,OAAO,KAAK;IACd;IAEA,OAAO,MAAMA,2BAAoB,CAACa,oBAAoB,CACpD,IAAI,CAACpB,eACP,CAAC;EACH;;EAEA;EACAqB,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB,OAAO,IAAI,CAACrB,iBAAiB,CAACsB,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAI5B,2BAA2B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_events","require","_specs","_errors","PlaybackNotificationManager","notificationKey","constructor","audioEventEmitter","AudioEventEmitter","global","show","info","NativeAudioAPIModule","AudioApiError","result","showNotification","error","hide","hideNotification","enableControl","control","enabled","params","isActive","isNotificationActive","addEventListener","eventName","callback","addAudioEventListener","_default","exports","default"],"sourceRoot":"../../../../src","sources":["system/notification/PlaybackNotificationManager.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,OAAA,GAAAF,OAAA;AAEA,MAAMG,2BAA2B,CAGjC;EACUC,eAAe,GAAG,UAAU;EAGpCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAiB,CAACC,MAAM,CAACD,iBAAiB,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAME,IAAIA,CAACC,IAA8B,EAAiB;IACxD,IAAI,CAACC,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMC,MAAM,GAAG,MAAMF,2BAAoB,CAACG,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACV,eAAe,EACpBM,IACF,CAAC;IAED,IAAIG,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,qBAAa,CAACC,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,IAAI,CAACL,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMC,MAAM,GAAG,MAAMF,2BAAoB,CAACM,gBAAgB,CACxD,IAAI,CAACb,eACP,CAAC;IAED,IAAIS,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,qBAAa,CAACC,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMG,aAAaA,CACjBC,OAA4B,EAC5BC,OAAgB,EACD;IACf,IAAI,CAACT,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMS,MAAM,GAAG;MAAEF,OAAO;MAAEC;IAAQ,CAAC;IACnC,MAAMP,MAAM,GAAG,MAAMF,2BAAoB,CAACG,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACV,eAAe,EACpBiB,MACF,CAAC;IAED,IAAIR,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIH,qBAAa,CAACC,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAMO,QAAQA,CAAA,EAAqB;IACjC,IAAI,CAACX,2BAAoB,EAAE;MACzB,OAAO,KAAK;IACd;IAEA,OAAO,MAAMA,2BAAoB,CAACY,oBAAoB,CACpD,IAAI,CAACnB,eACP,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEoB,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB,OAAO,IAAI,CAACpB,iBAAiB,CAACqB,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAI3B,2BAA2B,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _events = require("../../events");
8
+ class RecordingNotificationManager {
9
+ constructor() {
10
+ this.audioEventEmitter = new _events.AudioEventEmitter(global.AudioEventEmitter);
11
+ console.warn('RecordingNotificationManager is not implemented on iOS. Any calls to it will be no-ops.');
12
+ }
13
+
14
+ /**
15
+ * Show the notification with metadata or update if already visible.
16
+ *
17
+ * @param info - The info to be displayed.
18
+ * @returns Promise that resolves after creating notification.
19
+ */
20
+ async show(_info) {}
21
+
22
+ /**
23
+ * Hide the notification.
24
+ *
25
+ * @returns Promise that resolves after hiding notification.
26
+ */
27
+ async hide() {}
28
+
29
+ /**
30
+ * Check if the notification is currently active.
31
+ *
32
+ * @returns Promise that resolves to whether notification is active.
33
+ */
34
+ // eslint-disable-next-line @typescript-eslint/require-await
35
+ async isActive() {
36
+ return false;
37
+ }
38
+
39
+ /**
40
+ * Add an event listener for notification actions.
41
+ *
42
+ * @param eventName - The event name to listen for.
43
+ * @param callback - The callback to invoke on event.
44
+ * @returns Promise that resolves to whether notification is active.
45
+ */
46
+ addEventListener(eventName, callback) {
47
+ return this.audioEventEmitter.addAudioEventListener(eventName, callback);
48
+ }
49
+ }
50
+ var _default = exports.default = new RecordingNotificationManager();
51
+ //# sourceMappingURL=RecordingNotificationManager.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_events","require","RecordingNotificationManager","constructor","audioEventEmitter","AudioEventEmitter","global","console","warn","show","_info","hide","isActive","addEventListener","eventName","callback","addAudioEventListener","_default","exports","default"],"sourceRoot":"../../../../src","sources":["system/notification/RecordingNotificationManager.ios.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAQA,MAAMC,4BAA4B,CAMlC;EAGEC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAiB,CAACC,MAAM,CAACD,iBAAiB,CAAC;IACxEE,OAAO,CAACC,IAAI,CACV,yFACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAACC,KAAgC,EAAiB,CAAC;;EAE7D;AACF;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB,CAAC;;EAE7B;AACF;AACA;AACA;AACA;EACE;EACA,MAAMC,QAAQA,CAAA,EAAqB;IACjC,OAAO,KAAK;EACd;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,gBAAgBA,CACdC,SAAY,EACZC,QAAwD,EAChC;IACxB,OAAO,IAAI,CAACX,iBAAiB,CAACY,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAIjB,4BAA4B,CAAC,CAAC","ignoreList":[]}
@@ -61,7 +61,7 @@ class RecordingNotificationManager {
61
61
  *
62
62
  * @param eventName - The event name to listen for.
63
63
  * @param callback - The callback to invoke on event.
64
- * @returns Promise that resolves to whether notification is active.
64
+ * @returns Class that represents the subscription.
65
65
  */
66
66
  addEventListener(eventName, callback) {
67
67
  return this.audioEventEmitter.addAudioEventListener(eventName, callback);
@@ -3,16 +3,19 @@
3
3
  import { AudioEventEmitter } from "../../events/index.js";
4
4
  import { NativeAudioAPIModule } from "../../specs/index.js";
5
5
  import { AudioApiError } from "../../errors/index.js";
6
-
7
- /// Manager for media playback notifications with controls and MediaSession integration.
8
6
  class PlaybackNotificationManager {
9
7
  notificationKey = 'playback';
10
8
  constructor() {
11
9
  this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
12
10
  }
13
11
 
14
- /// Show the notification with metadata or update if already visible.
15
- /// Automatically creates the notification on first call.
12
+ /**
13
+ * Show the notification with metadata or update if already visible.
14
+ * Automatically creates the notification on first call.
15
+ *
16
+ * @param info - The info to be displayed.
17
+ * @returns Promise that resolves after creating notification.
18
+ */
16
19
  async show(info) {
17
20
  if (!NativeAudioAPIModule) {
18
21
  throw new AudioApiError('NativeAudioAPIModule is not available');
@@ -23,13 +26,11 @@ class PlaybackNotificationManager {
23
26
  }
24
27
  }
25
28
 
26
- /// Update the notification with new metadata or state.
27
- /// This is an alias for show() since show handles both initial display and updates.
28
- async update(info) {
29
- return this.show(info);
30
- }
31
-
32
- /// Hide the notification.
29
+ /**
30
+ * Hide the notification.
31
+ *
32
+ * @returns Promise that resolves after hiding notification.
33
+ */
33
34
  async hide() {
34
35
  if (!NativeAudioAPIModule) {
35
36
  throw new AudioApiError('NativeAudioAPIModule is not available');
@@ -40,7 +41,13 @@ class PlaybackNotificationManager {
40
41
  }
41
42
  }
42
43
 
43
- /// Enable or disable a specific playback control.
44
+ /**
45
+ * Enable or disable a specific playback control.
46
+ *
47
+ * @param control - The control to enable or disable on the notification.
48
+ * @param enabled - Whether to enable (true) or disable (false) the control.
49
+ * @returns Promise that resolves after showing modified notification.
50
+ */
44
51
  async enableControl(control, enabled) {
45
52
  if (!NativeAudioAPIModule) {
46
53
  throw new AudioApiError('NativeAudioAPIModule is not available');
@@ -55,7 +62,11 @@ class PlaybackNotificationManager {
55
62
  }
56
63
  }
57
64
 
58
- /// Check if the notification is currently active.
65
+ /**
66
+ * Check if the notification is currently active.
67
+ *
68
+ * @returns Promise that resolves to whether notification is active.
69
+ */
59
70
  async isActive() {
60
71
  if (!NativeAudioAPIModule) {
61
72
  return false;
@@ -63,7 +74,13 @@ class PlaybackNotificationManager {
63
74
  return await NativeAudioAPIModule.isNotificationActive(this.notificationKey);
64
75
  }
65
76
 
66
- /// Add an event listener for notification actions.
77
+ /**
78
+ * Add an event listener for notification actions.
79
+ *
80
+ * @param eventName - The event name to listen for.
81
+ * @param callback - The callback to invoke on event.
82
+ * @returns Class that represents the subscription.
83
+ */
67
84
  addEventListener(eventName, callback) {
68
85
  return this.audioEventEmitter.addAudioEventListener(eventName, callback);
69
86
  }
@@ -1 +1 @@
1
- {"version":3,"names":["AudioEventEmitter","NativeAudioAPIModule","AudioApiError","PlaybackNotificationManager","notificationKey","constructor","audioEventEmitter","global","show","info","result","showNotification","error","update","hide","hideNotification","enableControl","control","enabled","params","isActive","isNotificationActive","addEventListener","eventName","callback","addAudioEventListener"],"sourceRoot":"../../../../src","sources":["system/notification/PlaybackNotificationManager.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAgC,uBAAc;AACxE,SAASC,oBAAoB,QAAQ,sBAAa;AAQlD,SAASC,aAAa,QAAQ,uBAAc;;AAE5C;AACA,MAAMC,2BAA2B,CAGjC;EACUC,eAAe,GAAG,UAAU;EAGpCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIN,iBAAiB,CAACO,MAAM,CAACP,iBAAiB,CAAC;EAC1E;;EAEA;EACA;EACA,MAAMQ,IAAIA,CAACC,IAA8B,EAAiB;IACxD,IAAI,CAACR,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMQ,MAAM,GAAG,MAAMT,oBAAoB,CAACU,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACP,eAAe,EACpBK,IACF,CAAC;IAED,IAAIC,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIV,aAAa,CAACQ,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;EACA;EACA,MAAMC,MAAMA,CAACJ,IAA8B,EAAiB;IAC1D,OAAO,IAAI,CAACD,IAAI,CAACC,IAAI,CAAC;EACxB;;EAEA;EACA,MAAMK,IAAIA,CAAA,EAAkB;IAC1B,IAAI,CAACb,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMQ,MAAM,GAAG,MAAMT,oBAAoB,CAACc,gBAAgB,CACxD,IAAI,CAACX,eACP,CAAC;IAED,IAAIM,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIV,aAAa,CAACQ,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;EACA,MAAMI,aAAaA,CACjBC,OAA4B,EAC5BC,OAAgB,EACD;IACf,IAAI,CAACjB,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMiB,MAAM,GAAG;MAAEF,OAAO;MAAEC;IAAQ,CAAC;IACnC,MAAMR,MAAM,GAAG,MAAMT,oBAAoB,CAACU,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACP,eAAe,EACpBe,MACF,CAAC;IAED,IAAIT,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIV,aAAa,CAACQ,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;EACA,MAAMQ,QAAQA,CAAA,EAAqB;IACjC,IAAI,CAACnB,oBAAoB,EAAE;MACzB,OAAO,KAAK;IACd;IAEA,OAAO,MAAMA,oBAAoB,CAACoB,oBAAoB,CACpD,IAAI,CAACjB,eACP,CAAC;EACH;;EAEA;EACAkB,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB,OAAO,IAAI,CAAClB,iBAAiB,CAACmB,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAEA,eAAe,IAAIrB,2BAA2B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AudioEventEmitter","NativeAudioAPIModule","AudioApiError","PlaybackNotificationManager","notificationKey","constructor","audioEventEmitter","global","show","info","result","showNotification","error","hide","hideNotification","enableControl","control","enabled","params","isActive","isNotificationActive","addEventListener","eventName","callback","addAudioEventListener"],"sourceRoot":"../../../../src","sources":["system/notification/PlaybackNotificationManager.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAgC,uBAAc;AACxE,SAASC,oBAAoB,QAAQ,sBAAa;AAQlD,SAASC,aAAa,QAAQ,uBAAc;AAE5C,MAAMC,2BAA2B,CAGjC;EACUC,eAAe,GAAG,UAAU;EAGpCC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIN,iBAAiB,CAACO,MAAM,CAACP,iBAAiB,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMQ,IAAIA,CAACC,IAA8B,EAAiB;IACxD,IAAI,CAACR,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMQ,MAAM,GAAG,MAAMT,oBAAoB,CAACU,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACP,eAAe,EACpBK,IACF,CAAC;IAED,IAAIC,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIV,aAAa,CAACQ,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,IAAI,CAACZ,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMQ,MAAM,GAAG,MAAMT,oBAAoB,CAACa,gBAAgB,CACxD,IAAI,CAACV,eACP,CAAC;IAED,IAAIM,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIV,aAAa,CAACQ,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMG,aAAaA,CACjBC,OAA4B,EAC5BC,OAAgB,EACD;IACf,IAAI,CAAChB,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMgB,MAAM,GAAG;MAAEF,OAAO;MAAEC;IAAQ,CAAC;IACnC,MAAMP,MAAM,GAAG,MAAMT,oBAAoB,CAACU,gBAAgB,CACxD,UAAU,EACV,IAAI,CAACP,eAAe,EACpBc,MACF,CAAC;IAED,IAAIR,MAAM,CAACE,KAAK,EAAE;MAChB,MAAM,IAAIV,aAAa,CAACQ,MAAM,CAACE,KAAK,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAMO,QAAQA,CAAA,EAAqB;IACjC,IAAI,CAAClB,oBAAoB,EAAE;MACzB,OAAO,KAAK;IACd;IAEA,OAAO,MAAMA,oBAAoB,CAACmB,oBAAoB,CACpD,IAAI,CAAChB,eACP,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEiB,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB,OAAO,IAAI,CAACjB,iBAAiB,CAACkB,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAEA,eAAe,IAAIpB,2BAA2B,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ import { AudioEventEmitter } from "../../events/index.js";
4
+ class RecordingNotificationManager {
5
+ constructor() {
6
+ this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
7
+ console.warn('RecordingNotificationManager is not implemented on iOS. Any calls to it will be no-ops.');
8
+ }
9
+
10
+ /**
11
+ * Show the notification with metadata or update if already visible.
12
+ *
13
+ * @param info - The info to be displayed.
14
+ * @returns Promise that resolves after creating notification.
15
+ */
16
+ async show(_info) {}
17
+
18
+ /**
19
+ * Hide the notification.
20
+ *
21
+ * @returns Promise that resolves after hiding notification.
22
+ */
23
+ async hide() {}
24
+
25
+ /**
26
+ * Check if the notification is currently active.
27
+ *
28
+ * @returns Promise that resolves to whether notification is active.
29
+ */
30
+ // eslint-disable-next-line @typescript-eslint/require-await
31
+ async isActive() {
32
+ return false;
33
+ }
34
+
35
+ /**
36
+ * Add an event listener for notification actions.
37
+ *
38
+ * @param eventName - The event name to listen for.
39
+ * @param callback - The callback to invoke on event.
40
+ * @returns Promise that resolves to whether notification is active.
41
+ */
42
+ addEventListener(eventName, callback) {
43
+ return this.audioEventEmitter.addAudioEventListener(eventName, callback);
44
+ }
45
+ }
46
+ export default new RecordingNotificationManager();
47
+ //# sourceMappingURL=RecordingNotificationManager.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AudioEventEmitter","RecordingNotificationManager","constructor","audioEventEmitter","global","console","warn","show","_info","hide","isActive","addEventListener","eventName","callback","addAudioEventListener"],"sourceRoot":"../../../../src","sources":["system/notification/RecordingNotificationManager.ios.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAgC,uBAAc;AAQxE,MAAMC,4BAA4B,CAMlC;EAGEC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIH,iBAAiB,CAACI,MAAM,CAACJ,iBAAiB,CAAC;IACxEK,OAAO,CAACC,IAAI,CACV,yFACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAACC,KAAgC,EAAiB,CAAC;;EAE7D;AACF;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB,CAAC;;EAE7B;AACF;AACA;AACA;AACA;EACE;EACA,MAAMC,QAAQA,CAAA,EAAqB;IACjC,OAAO,KAAK;EACd;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,gBAAgBA,CACdC,SAAY,EACZC,QAAwD,EAChC;IACxB,OAAO,IAAI,CAACV,iBAAiB,CAACW,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAEA,eAAe,IAAIZ,4BAA4B,CAAC,CAAC","ignoreList":[]}
@@ -57,7 +57,7 @@ class RecordingNotificationManager {
57
57
  *
58
58
  * @param eventName - The event name to listen for.
59
59
  * @param callback - The callback to invoke on event.
60
- * @returns Promise that resolves to whether notification is active.
60
+ * @returns Class that represents the subscription.
61
61
  */
62
62
  addEventListener(eventName, callback) {
63
63
  return this.audioEventEmitter.addAudioEventListener(eventName, callback);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  export { default as PlaybackNotificationManager } from "./PlaybackNotificationManager.js";
4
- export { default as RecordingNotificationManager } from "./RecordingNotificationManager.js";
4
+ export { default as RecordingNotificationManager } from './RecordingNotificationManager';
5
5
  export * from "./types.js";
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","PlaybackNotificationManager","RecordingNotificationManager"],"sourceRoot":"../../../../src","sources":["system/notification/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,2BAA2B,QAAQ,kCAA+B;AACtF,SAASD,OAAO,IAAIE,4BAA4B,QAAQ,mCAAgC;AACxF,cAAc,YAAS","ignoreList":[]}
1
+ {"version":3,"names":["default","PlaybackNotificationManager","RecordingNotificationManager"],"sourceRoot":"../../../../src","sources":["system/notification/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,2BAA2B,QAAQ,kCAA+B;AACtF,SAASD,OAAO,IAAIE,4BAA4B,QAAQ,gCAAgC;AACxF,cAAc,YAAS","ignoreList":[]}
@@ -4,11 +4,41 @@ declare class PlaybackNotificationManager implements NotificationManager<Playbac
4
4
  private notificationKey;
5
5
  private audioEventEmitter;
6
6
  constructor();
7
+ /**
8
+ * Show the notification with metadata or update if already visible.
9
+ * Automatically creates the notification on first call.
10
+ *
11
+ * @param info - The info to be displayed.
12
+ * @returns Promise that resolves after creating notification.
13
+ */
7
14
  show(info: PlaybackNotificationInfo): Promise<void>;
8
- update(info: PlaybackNotificationInfo): Promise<void>;
15
+ /**
16
+ * Hide the notification.
17
+ *
18
+ * @returns Promise that resolves after hiding notification.
19
+ */
9
20
  hide(): Promise<void>;
21
+ /**
22
+ * Enable or disable a specific playback control.
23
+ *
24
+ * @param control - The control to enable or disable on the notification.
25
+ * @param enabled - Whether to enable (true) or disable (false) the control.
26
+ * @returns Promise that resolves after showing modified notification.
27
+ */
10
28
  enableControl(control: PlaybackControlName, enabled: boolean): Promise<void>;
29
+ /**
30
+ * Check if the notification is currently active.
31
+ *
32
+ * @returns Promise that resolves to whether notification is active.
33
+ */
11
34
  isActive(): Promise<boolean>;
35
+ /**
36
+ * Add an event listener for notification actions.
37
+ *
38
+ * @param eventName - The event name to listen for.
39
+ * @param callback - The callback to invoke on event.
40
+ * @returns Class that represents the subscription.
41
+ */
12
42
  addEventListener<T extends PlaybackNotificationEventName>(eventName: T, callback: (event: NotificationEvents[T]) => void): AudioEventSubscription;
13
43
  }
14
44
  declare const _default: PlaybackNotificationManager;
@@ -1 +1 @@
1
- {"version":3,"file":"PlaybackNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/PlaybackNotificationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAIjB,cAAM,2BACJ,YACE,mBAAmB,CAAC,wBAAwB,EAAE,6BAA6B,CAAC;IAE9E,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,iBAAiB,CAAoB;;IAQvC,IAAI,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBnD,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAerB,aAAa,CACjB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAkBV,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAWlC,gBAAgB,CAAC,CAAC,SAAS,6BAA6B,EACtD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,sBAAsB;CAG1B;;AAED,wBAAiD"}
1
+ {"version":3,"file":"PlaybackNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/PlaybackNotificationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAGjB,cAAM,2BACJ,YACE,mBAAmB,CAAC,wBAAwB,EAAE,6BAA6B,CAAC;IAE9E,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,iBAAiB,CAAoB;;IAM7C;;;;;;OAMG;IACG,IAAI,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzD;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B;;;;;;OAMG;IACG,aAAa,CACjB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAiBhB;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAUlC;;;;;;OAMG;IACH,gBAAgB,CAAC,CAAC,SAAS,6BAA6B,EACtD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,sBAAsB;CAG1B;;AAED,wBAAiD"}
@@ -28,7 +28,7 @@ declare class RecordingNotificationManager implements NotificationManager<Record
28
28
  *
29
29
  * @param eventName - The event name to listen for.
30
30
  * @param callback - The callback to invoke on event.
31
- * @returns Promise that resolves to whether notification is active.
31
+ * @returns Class that represents the subscription.
32
32
  */
33
33
  addEventListener<T extends RecordingNotificationEventName>(eventName: T, callback: (event: RecordingNotificationEvent[T]) => void): AudioEventSubscription;
34
34
  }
@@ -0,0 +1,36 @@
1
+ import { AudioEventSubscription } from '../../events';
2
+ import type { NotificationManager, RecordingNotificationEvent, RecordingNotificationEventName, RecordingNotificationInfo } from './types';
3
+ declare class RecordingNotificationManager implements NotificationManager<RecordingNotificationInfo, RecordingNotificationEventName> {
4
+ private audioEventEmitter;
5
+ constructor();
6
+ /**
7
+ * Show the notification with metadata or update if already visible.
8
+ *
9
+ * @param info - The info to be displayed.
10
+ * @returns Promise that resolves after creating notification.
11
+ */
12
+ show(_info: RecordingNotificationInfo): Promise<void>;
13
+ /**
14
+ * Hide the notification.
15
+ *
16
+ * @returns Promise that resolves after hiding notification.
17
+ */
18
+ hide(): Promise<void>;
19
+ /**
20
+ * Check if the notification is currently active.
21
+ *
22
+ * @returns Promise that resolves to whether notification is active.
23
+ */
24
+ isActive(): Promise<boolean>;
25
+ /**
26
+ * Add an event listener for notification actions.
27
+ *
28
+ * @param eventName - The event name to listen for.
29
+ * @param callback - The callback to invoke on event.
30
+ * @returns Promise that resolves to whether notification is active.
31
+ */
32
+ addEventListener<T extends RecordingNotificationEventName>(eventName: T, callback: (event: RecordingNotificationEvent[T]) => void): AudioEventSubscription;
33
+ }
34
+ declare const _default: RecordingNotificationManager;
35
+ export default _default;
36
+ //# sourceMappingURL=RecordingNotificationManager.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordingNotificationManager.ios.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/RecordingNotificationManager.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB,cAAM,4BACJ,YACE,mBAAmB,CACjB,yBAAyB,EACzB,8BAA8B,CAC/B;IAEH,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C;;;;;OAKG;IACG,IAAI,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3D;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B;;;;OAIG;IAEG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC;;;;;;OAMG;IACH,gBAAgB,CAAC,CAAC,SAAS,8BAA8B,EACvD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC,CAAC,KAAK,IAAI,GACvD,sBAAsB;CAG1B;;AAED,wBAAkD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-audio-api",
3
- "version": "0.11.0-nightly-c743c16-20260115",
3
+ "version": "0.11.0",
4
4
  "description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
5
5
  "bin": {
6
6
  "setup-rn-audio-api-web": "./scripts/setup-rn-audio-api-web.js"
@@ -9,7 +9,6 @@ import type {
9
9
  } from './types';
10
10
  import { AudioApiError } from '../../errors';
11
11
 
12
- /// Manager for media playback notifications with controls and MediaSession integration.
13
12
  class PlaybackNotificationManager
14
13
  implements
15
14
  NotificationManager<PlaybackNotificationInfo, PlaybackNotificationEventName>
@@ -21,8 +20,13 @@ class PlaybackNotificationManager
21
20
  this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
22
21
  }
23
22
 
24
- /// Show the notification with metadata or update if already visible.
25
- /// Automatically creates the notification on first call.
23
+ /**
24
+ * Show the notification with metadata or update if already visible.
25
+ * Automatically creates the notification on first call.
26
+ *
27
+ * @param info - The info to be displayed.
28
+ * @returns Promise that resolves after creating notification.
29
+ */
26
30
  async show(info: PlaybackNotificationInfo): Promise<void> {
27
31
  if (!NativeAudioAPIModule) {
28
32
  throw new AudioApiError('NativeAudioAPIModule is not available');
@@ -39,13 +43,11 @@ class PlaybackNotificationManager
39
43
  }
40
44
  }
41
45
 
42
- /// Update the notification with new metadata or state.
43
- /// This is an alias for show() since show handles both initial display and updates.
44
- async update(info: PlaybackNotificationInfo): Promise<void> {
45
- return this.show(info);
46
- }
47
-
48
- /// Hide the notification.
46
+ /**
47
+ * Hide the notification.
48
+ *
49
+ * @returns Promise that resolves after hiding notification.
50
+ */
49
51
  async hide(): Promise<void> {
50
52
  if (!NativeAudioAPIModule) {
51
53
  throw new AudioApiError('NativeAudioAPIModule is not available');
@@ -60,7 +62,13 @@ class PlaybackNotificationManager
60
62
  }
61
63
  }
62
64
 
63
- /// Enable or disable a specific playback control.
65
+ /**
66
+ * Enable or disable a specific playback control.
67
+ *
68
+ * @param control - The control to enable or disable on the notification.
69
+ * @param enabled - Whether to enable (true) or disable (false) the control.
70
+ * @returns Promise that resolves after showing modified notification.
71
+ */
64
72
  async enableControl(
65
73
  control: PlaybackControlName,
66
74
  enabled: boolean
@@ -81,7 +89,11 @@ class PlaybackNotificationManager
81
89
  }
82
90
  }
83
91
 
84
- /// Check if the notification is currently active.
92
+ /**
93
+ * Check if the notification is currently active.
94
+ *
95
+ * @returns Promise that resolves to whether notification is active.
96
+ */
85
97
  async isActive(): Promise<boolean> {
86
98
  if (!NativeAudioAPIModule) {
87
99
  return false;
@@ -92,7 +104,13 @@ class PlaybackNotificationManager
92
104
  );
93
105
  }
94
106
 
95
- /// Add an event listener for notification actions.
107
+ /**
108
+ * Add an event listener for notification actions.
109
+ *
110
+ * @param eventName - The event name to listen for.
111
+ * @param callback - The callback to invoke on event.
112
+ * @returns Class that represents the subscription.
113
+ */
96
114
  addEventListener<T extends PlaybackNotificationEventName>(
97
115
  eventName: T,
98
116
  callback: (event: NotificationEvents[T]) => void
@@ -0,0 +1,65 @@
1
+ import { AudioEventEmitter, AudioEventSubscription } from '../../events';
2
+ import type {
3
+ NotificationManager,
4
+ RecordingNotificationEvent,
5
+ RecordingNotificationEventName,
6
+ RecordingNotificationInfo,
7
+ } from './types';
8
+
9
+ class RecordingNotificationManager
10
+ implements
11
+ NotificationManager<
12
+ RecordingNotificationInfo,
13
+ RecordingNotificationEventName
14
+ >
15
+ {
16
+ private audioEventEmitter: AudioEventEmitter;
17
+
18
+ constructor() {
19
+ this.audioEventEmitter = new AudioEventEmitter(global.AudioEventEmitter);
20
+ console.warn(
21
+ 'RecordingNotificationManager is not implemented on iOS. Any calls to it will be no-ops.'
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Show the notification with metadata or update if already visible.
27
+ *
28
+ * @param info - The info to be displayed.
29
+ * @returns Promise that resolves after creating notification.
30
+ */
31
+ async show(_info: RecordingNotificationInfo): Promise<void> {}
32
+
33
+ /**
34
+ * Hide the notification.
35
+ *
36
+ * @returns Promise that resolves after hiding notification.
37
+ */
38
+ async hide(): Promise<void> {}
39
+
40
+ /**
41
+ * Check if the notification is currently active.
42
+ *
43
+ * @returns Promise that resolves to whether notification is active.
44
+ */
45
+ // eslint-disable-next-line @typescript-eslint/require-await
46
+ async isActive(): Promise<boolean> {
47
+ return false;
48
+ }
49
+
50
+ /**
51
+ * Add an event listener for notification actions.
52
+ *
53
+ * @param eventName - The event name to listen for.
54
+ * @param callback - The callback to invoke on event.
55
+ * @returns Promise that resolves to whether notification is active.
56
+ */
57
+ addEventListener<T extends RecordingNotificationEventName>(
58
+ eventName: T,
59
+ callback: (event: RecordingNotificationEvent[T]) => void
60
+ ): AudioEventSubscription {
61
+ return this.audioEventEmitter.addAudioEventListener(eventName, callback);
62
+ }
63
+ }
64
+
65
+ export default new RecordingNotificationManager();
@@ -84,7 +84,7 @@ class RecordingNotificationManager
84
84
  *
85
85
  * @param eventName - The event name to listen for.
86
86
  * @param callback - The callback to invoke on event.
87
- * @returns Promise that resolves to whether notification is active.
87
+ * @returns Class that represents the subscription.
88
88
  */
89
89
  addEventListener<T extends RecordingNotificationEventName>(
90
90
  eventName: T,