react-native-audio-api 0.11.0-alpha.3 → 0.11.0-alpha.5

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 (151) hide show
  1. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +34 -6
  2. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.cpp +4 -0
  3. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/ptrs.hpp +8 -0
  4. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/utils.cpp +4 -0
  5. package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.h +1 -0
  6. package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +164 -16
  7. package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioPlayer.kt +10 -8
  8. package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioRecorder.kt +10 -8
  9. package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +3 -4
  10. package/android/src/main/java/com/swmansion/audioapi/system/CentralizedForegroundService.kt +128 -0
  11. package/android/src/main/java/com/swmansion/audioapi/system/ForegroundServiceManager.kt +116 -0
  12. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +115 -107
  13. package/android/src/main/java/com/swmansion/audioapi/system/PermissionRequestListener.kt +2 -1
  14. package/android/src/main/java/com/swmansion/audioapi/system/notification/BaseNotification.kt +47 -0
  15. package/android/src/main/java/com/swmansion/audioapi/system/notification/NotificationRegistry.kt +191 -0
  16. package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +669 -0
  17. package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotificationReceiver.kt +33 -0
  18. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotification.kt +303 -0
  19. package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +45 -0
  20. package/android/src/main/java/com/swmansion/audioapi/system/notification/SimpleNotification.kt +119 -0
  21. package/common/cpp/audioapi/core/utils/AudioFileWriter.h +1 -0
  22. package/common/cpp/audioapi/core/utils/AudioRecorderCallback.h +1 -0
  23. package/common/cpp/audioapi/utils/AudioFileProperties.h +17 -17
  24. package/ios/audioapi/ios/AudioAPIModule.h +2 -2
  25. package/ios/audioapi/ios/AudioAPIModule.mm +108 -18
  26. package/ios/audioapi/ios/core/IOSAudioRecorder.mm +8 -7
  27. package/ios/audioapi/ios/core/NativeAudioPlayer.m +1 -1
  28. package/ios/audioapi/ios/core/NativeAudioRecorder.m +9 -2
  29. package/ios/audioapi/ios/system/AudioEngine.h +2 -0
  30. package/ios/audioapi/ios/system/AudioEngine.mm +49 -6
  31. package/ios/audioapi/ios/system/AudioSessionManager.mm +12 -9
  32. package/ios/audioapi/ios/system/NotificationManager.mm +7 -4
  33. package/ios/audioapi/ios/system/notification/BaseNotification.h +58 -0
  34. package/ios/audioapi/ios/system/notification/NotificationRegistry.h +70 -0
  35. package/ios/audioapi/ios/system/notification/NotificationRegistry.mm +172 -0
  36. package/ios/audioapi/ios/system/notification/PlaybackNotification.h +27 -0
  37. package/ios/audioapi/ios/system/notification/PlaybackNotification.mm +427 -0
  38. package/lib/commonjs/api.js +72 -1
  39. package/lib/commonjs/api.js.map +1 -1
  40. package/lib/commonjs/api.web.js +27 -14
  41. package/lib/commonjs/api.web.js.map +1 -1
  42. package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
  43. package/lib/commonjs/system/AudioManager.js +6 -9
  44. package/lib/commonjs/system/AudioManager.js.map +1 -1
  45. package/lib/commonjs/system/index.js +13 -0
  46. package/lib/commonjs/system/index.js.map +1 -1
  47. package/lib/commonjs/system/notification/PlaybackNotificationManager.js +135 -0
  48. package/lib/commonjs/system/notification/PlaybackNotificationManager.js.map +1 -0
  49. package/lib/commonjs/system/notification/RecordingNotificationManager.js +182 -0
  50. package/lib/commonjs/system/notification/RecordingNotificationManager.js.map +1 -0
  51. package/lib/commonjs/system/notification/SimpleNotificationManager.js +122 -0
  52. package/lib/commonjs/system/notification/SimpleNotificationManager.js.map +1 -0
  53. package/lib/commonjs/system/notification/index.js +45 -0
  54. package/lib/commonjs/system/notification/index.js.map +1 -0
  55. package/lib/commonjs/system/notification/types.js +6 -0
  56. package/lib/commonjs/system/notification/types.js.map +1 -0
  57. package/lib/commonjs/types.js +17 -17
  58. package/lib/commonjs/types.js.map +1 -1
  59. package/lib/commonjs/web-system/index.js +17 -0
  60. package/lib/commonjs/web-system/index.js.map +1 -0
  61. package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js +34 -0
  62. package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js.map +1 -0
  63. package/lib/commonjs/web-system/notification/RecordingNotificationManager.js +34 -0
  64. package/lib/commonjs/web-system/notification/RecordingNotificationManager.js.map +1 -0
  65. package/lib/commonjs/web-system/notification/index.js +21 -0
  66. package/lib/commonjs/web-system/notification/index.js.map +1 -0
  67. package/lib/module/api.js +4 -0
  68. package/lib/module/api.js.map +1 -1
  69. package/lib/module/api.web.js +3 -1
  70. package/lib/module/api.web.js.map +1 -1
  71. package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
  72. package/lib/module/system/AudioManager.js +6 -9
  73. package/lib/module/system/AudioManager.js.map +1 -1
  74. package/lib/module/system/index.js +1 -0
  75. package/lib/module/system/index.js.map +1 -1
  76. package/lib/module/system/notification/PlaybackNotificationManager.js +131 -0
  77. package/lib/module/system/notification/PlaybackNotificationManager.js.map +1 -0
  78. package/lib/module/system/notification/RecordingNotificationManager.js +178 -0
  79. package/lib/module/system/notification/RecordingNotificationManager.js.map +1 -0
  80. package/lib/module/system/notification/SimpleNotificationManager.js +118 -0
  81. package/lib/module/system/notification/SimpleNotificationManager.js.map +1 -0
  82. package/lib/module/system/notification/index.js +7 -0
  83. package/lib/module/system/notification/index.js.map +1 -0
  84. package/lib/module/system/notification/types.js +4 -0
  85. package/lib/module/system/notification/types.js.map +1 -0
  86. package/lib/module/types.js +17 -17
  87. package/lib/module/types.js.map +1 -1
  88. package/lib/module/web-system/index.js +4 -0
  89. package/lib/module/web-system/index.js.map +1 -0
  90. package/lib/module/web-system/notification/PlaybackNotificationManager.js +30 -0
  91. package/lib/module/web-system/notification/PlaybackNotificationManager.js.map +1 -0
  92. package/lib/module/web-system/notification/RecordingNotificationManager.js +30 -0
  93. package/lib/module/web-system/notification/RecordingNotificationManager.js.map +1 -0
  94. package/lib/module/web-system/notification/index.js +5 -0
  95. package/lib/module/web-system/notification/index.js.map +1 -0
  96. package/lib/typescript/api.d.ts +2 -0
  97. package/lib/typescript/api.d.ts.map +1 -1
  98. package/lib/typescript/api.web.d.ts +3 -1
  99. package/lib/typescript/api.web.d.ts.map +1 -1
  100. package/lib/typescript/events/types.d.ts +3 -3
  101. package/lib/typescript/events/types.d.ts.map +1 -1
  102. package/lib/typescript/specs/NativeAudioAPIModule.d.ts +16 -5
  103. package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
  104. package/lib/typescript/system/AudioManager.d.ts +4 -5
  105. package/lib/typescript/system/AudioManager.d.ts.map +1 -1
  106. package/lib/typescript/system/index.d.ts +1 -0
  107. package/lib/typescript/system/index.d.ts.map +1 -1
  108. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts +22 -0
  109. package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts.map +1 -0
  110. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts +23 -0
  111. package/lib/typescript/system/notification/RecordingNotificationManager.d.ts.map +1 -0
  112. package/lib/typescript/system/notification/SimpleNotificationManager.d.ts +20 -0
  113. package/lib/typescript/system/notification/SimpleNotificationManager.d.ts.map +1 -0
  114. package/lib/typescript/system/notification/index.d.ts +5 -0
  115. package/lib/typescript/system/notification/index.d.ts.map +1 -0
  116. package/lib/typescript/system/notification/types.d.ts +65 -0
  117. package/lib/typescript/system/notification/types.d.ts.map +1 -0
  118. package/lib/typescript/system/types.d.ts +0 -16
  119. package/lib/typescript/system/types.d.ts.map +1 -1
  120. package/lib/typescript/types.d.ts +16 -16
  121. package/lib/typescript/types.d.ts.map +1 -1
  122. package/lib/typescript/web-system/index.d.ts +2 -0
  123. package/lib/typescript/web-system/index.d.ts.map +1 -0
  124. package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts +19 -0
  125. package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts.map +1 -0
  126. package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts +19 -0
  127. package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts.map +1 -0
  128. package/lib/typescript/web-system/notification/index.d.ts +3 -0
  129. package/lib/typescript/web-system/notification/index.d.ts.map +1 -0
  130. package/package.json +1 -1
  131. package/src/api.ts +17 -0
  132. package/src/api.web.ts +7 -2
  133. package/src/events/types.ts +3 -4
  134. package/src/specs/NativeAudioAPIModule.ts +23 -7
  135. package/src/system/AudioManager.ts +10 -23
  136. package/src/system/index.ts +1 -0
  137. package/src/system/notification/PlaybackNotificationManager.ts +193 -0
  138. package/src/system/notification/RecordingNotificationManager.ts +242 -0
  139. package/src/system/notification/SimpleNotificationManager.ts +170 -0
  140. package/src/system/notification/index.ts +4 -0
  141. package/src/system/notification/types.ts +111 -0
  142. package/src/system/types.ts +0 -18
  143. package/src/types.ts +17 -17
  144. package/src/web-system/index.ts +1 -0
  145. package/src/web-system/notification/PlaybackNotificationManager.ts +60 -0
  146. package/src/web-system/notification/RecordingNotificationManager.ts +60 -0
  147. package/src/web-system/notification/index.ts +2 -0
  148. package/android/src/main/java/com/swmansion/audioapi/system/LockScreenManager.kt +0 -347
  149. package/android/src/main/java/com/swmansion/audioapi/system/MediaNotificationManager.kt +0 -273
  150. package/android/src/main/java/com/swmansion/audioapi/system/MediaReceiver.kt +0 -57
  151. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionCallback.kt +0 -61
@@ -1,6 +1,6 @@
1
+ import { SessionOptions, PermissionStatus, AudioDevicesInfo } from './types';
2
+ import { SystemEventName, SystemEventCallback } from '../events/types';
1
3
  import { AudioEventSubscription } from '../events';
2
- import { RemoteCommandEventName, SystemEventCallback, SystemEventName } from '../events/types';
3
- import { AudioDevicesInfo, LockScreenInfo, PermissionStatus, SessionOptions } from './types';
4
4
  declare class AudioManager {
5
5
  private readonly audioEventEmitter;
6
6
  constructor();
@@ -8,8 +8,6 @@ declare class AudioManager {
8
8
  setAudioSessionActivity(enabled: boolean): Promise<boolean>;
9
9
  setAudioSessionOptions(options: SessionOptions): void;
10
10
  disableSessionManagement(): void;
11
- setLockScreenInfo(info: LockScreenInfo): void;
12
- resetLockScreenInfo(): void;
13
11
  observeAudioInterruptions(enabled: boolean): void;
14
12
  /**
15
13
  * @param enabled - Whether to actively reclaim the session or not
@@ -26,10 +24,11 @@ declare class AudioManager {
26
24
  */
27
25
  activelyReclaimSession(enabled: boolean): void;
28
26
  observeVolumeChanges(enabled: boolean): void;
29
- enableRemoteCommand(name: RemoteCommandEventName, enabled: boolean): void;
30
27
  addSystemEventListener<Name extends SystemEventName>(name: Name, callback: SystemEventCallback<Name>): AudioEventSubscription;
31
28
  requestRecordingPermissions(): Promise<PermissionStatus>;
32
29
  checkRecordingPermissions(): Promise<PermissionStatus>;
30
+ requestNotificationPermissions(): Promise<PermissionStatus>;
31
+ checkNotificationPermissions(): Promise<PermissionStatus>;
33
32
  getDevicesInfo(): Promise<AudioDevicesInfo>;
34
33
  }
35
34
  declare const _default: AudioManager;
@@ -1 +1 @@
1
- {"version":3,"file":"AudioManager.d.ts","sourceRoot":"","sources":["../../../src/system/AudioManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,cAAM,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IAS9C,wBAAwB;IAIxB,yBAAyB,CAAC,OAAO,EAAE,OAAO;IAI1C;;;;;;;;;;;;OAYG;IACH,sBAAsB,CAAC,OAAO,EAAE,OAAO;IAIvC,oBAAoB,CAAC,OAAO,EAAE,OAAO;IAIrC,sBAAsB,CAAC,IAAI,SAAS,eAAe,EACjD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAClC,sBAAsB;IAInB,2BAA2B,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAIxD,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAItD,8BAA8B,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAI3D,4BAA4B,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAIzD,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAGlD;;AAED,wBAAkC"}
@@ -1,2 +1,3 @@
1
1
  export { default } from './AudioManager';
2
+ export * from './notification';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { AudioEventSubscription } from '../../events';
2
+ import type { NotificationManager, PlaybackNotificationInfo, PlaybackControlName, PlaybackNotificationEventName, NotificationEvents } from './types';
3
+ declare class PlaybackNotificationManager implements NotificationManager<PlaybackNotificationInfo, PlaybackNotificationInfo, PlaybackNotificationEventName> {
4
+ private notificationKey;
5
+ private isRegistered;
6
+ private isShown;
7
+ private audioEventEmitter;
8
+ constructor();
9
+ register(): Promise<void>;
10
+ show(info: PlaybackNotificationInfo): Promise<void>;
11
+ update(info: PlaybackNotificationInfo): Promise<void>;
12
+ hide(): Promise<void>;
13
+ unregister(): Promise<void>;
14
+ enableControl(control: PlaybackControlName, enabled: boolean): Promise<void>;
15
+ isActive(): Promise<boolean>;
16
+ addEventListener<T extends PlaybackNotificationEventName>(eventName: T, callback: (event: NotificationEvents[T]) => void): AudioEventSubscription;
17
+ /** Remove an event listener. */
18
+ removeEventListener(subscription: AudioEventSubscription): void;
19
+ }
20
+ declare const _default: PlaybackNotificationManager;
21
+ export default _default;
22
+ //# sourceMappingURL=PlaybackNotificationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaybackNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/PlaybackNotificationManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAGjB,cAAM,2BACJ,YACE,mBAAmB,CACjB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,CAC9B;IAEH,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAoB;;IAOvC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBzB,IAAI,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBnD,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBrD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBrB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB3B,aAAa,CACjB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAsBV,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;IAIzB,gCAAgC;IAChC,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;CAGhE;;AAED,wBAAiD"}
@@ -0,0 +1,23 @@
1
+ import { AudioEventSubscription } from '../../events';
2
+ import type { NotificationManager, RecordingNotificationInfo, RecordingControlName, RecordingNotificationEventName, NotificationEvents } from './types';
3
+ declare class RecordingNotificationManager implements NotificationManager<RecordingNotificationInfo, RecordingNotificationInfo, RecordingNotificationEventName> {
4
+ private notificationKey;
5
+ private isRegistered;
6
+ private isShown;
7
+ private audioEventEmitter;
8
+ private isIOS;
9
+ constructor();
10
+ register(): Promise<void>;
11
+ show(info: RecordingNotificationInfo): Promise<void>;
12
+ update(info: RecordingNotificationInfo): Promise<void>;
13
+ hide(): Promise<void>;
14
+ unregister(): Promise<void>;
15
+ enableControl(control: RecordingControlName, enabled: boolean): Promise<void>;
16
+ isActive(): Promise<boolean>;
17
+ addEventListener<T extends RecordingNotificationEventName>(eventName: T, callback: (event: NotificationEvents[T]) => void): AudioEventSubscription;
18
+ /** Remove an event listener. */
19
+ removeEventListener(subscription: AudioEventSubscription): void;
20
+ }
21
+ declare const _default: RecordingNotificationManager;
22
+ export default _default;
23
+ //# sourceMappingURL=RecordingNotificationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordingNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/RecordingNotificationManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,8BAA8B,EAC9B,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAGjB,cAAM,4BACJ,YACE,mBAAmB,CACjB,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,CAC/B;IAEH,OAAO,CAAC,eAAe,CAAe;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,KAAK,CAAyB;;IAOhC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BzB,IAAI,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BpD,MAAM,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BtD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BrB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B3B,aAAa,CACjB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IA2BV,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBlC,gBAAgB,CAAC,CAAC,SAAS,8BAA8B,EACvD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,sBAAsB;IAYzB,gCAAgC;IAChC,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;CAGhE;;AAED,wBAAkD"}
@@ -0,0 +1,20 @@
1
+ import { AudioEventSubscription } from '../../events';
2
+ import type { NotificationManager, SimpleNotificationOptions } from './types';
3
+ declare class SimpleNotificationManager implements NotificationManager<SimpleNotificationOptions, SimpleNotificationOptions, never> {
4
+ private notificationKey;
5
+ private isRegistered;
6
+ private isShown;
7
+ private audioEventEmitter;
8
+ constructor();
9
+ register(): Promise<void>;
10
+ show(options: SimpleNotificationOptions): Promise<void>;
11
+ update(options: SimpleNotificationOptions): Promise<void>;
12
+ hide(): Promise<void>;
13
+ unregister(): Promise<void>;
14
+ isActive(): Promise<boolean>;
15
+ addEventListener<T extends never>(_eventName: T, _callback: (event: never) => void): AudioEventSubscription;
16
+ removeEventListener(subscription: AudioEventSubscription): void;
17
+ }
18
+ declare const _default: SimpleNotificationManager;
19
+ export default _default;
20
+ //# sourceMappingURL=SimpleNotificationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/SimpleNotificationManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAK9E,cAAM,yBACJ,YACE,mBAAmB,CACjB,yBAAyB,EACzB,yBAAyB,EACzB,KAAK,CACN;IAEH,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAoB;;IAOvC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBzB,IAAI,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBvD,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBzD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBrB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB3B,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAWlC,gBAAgB,CAAC,CAAC,SAAS,KAAK,EAC9B,UAAU,EAAE,CAAC,EACb,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAChC,sBAAsB;IAWzB,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;CAGhE;;AAED,wBAA+C"}
@@ -0,0 +1,5 @@
1
+ export { default as PlaybackNotificationManager } from './PlaybackNotificationManager';
2
+ export { default as RecordingNotificationManager } from './RecordingNotificationManager';
3
+ export { default as SimpleNotificationManager } from './SimpleNotificationManager';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,cAAc,SAAS,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { AudioEventSubscription } from '../../events';
2
+ import { EventEmptyType, EventTypeWithValue } from '../../events/types';
3
+ export interface NotificationManager<TShowOptions, TUpdateOptions, TEventName extends NotificationEventName> {
4
+ register(): Promise<void>;
5
+ show(options: TShowOptions): Promise<void>;
6
+ update(options: TUpdateOptions): Promise<void>;
7
+ hide(): Promise<void>;
8
+ unregister(): Promise<void>;
9
+ isActive(): Promise<boolean>;
10
+ addEventListener<T extends TEventName>(eventName: T, callback: NotificationCallback<T>): AudioEventSubscription;
11
+ removeEventListener(subscription: AudioEventSubscription): void;
12
+ }
13
+ export interface PlaybackNotificationInfo {
14
+ title?: string;
15
+ artist?: string;
16
+ album?: string;
17
+ artwork?: string | {
18
+ uri: string;
19
+ };
20
+ androidSmallIcon?: string | {
21
+ uri: string;
22
+ };
23
+ duration?: number;
24
+ elapsedTime?: number;
25
+ speed?: number;
26
+ state?: 'playing' | 'paused';
27
+ }
28
+ export type PlaybackControlName = 'play' | 'pause' | 'next' | 'previous' | 'skipForward' | 'skipBackward' | 'seekTo';
29
+ interface PlaybackNotificationEvent {
30
+ playbackNotificationPlay: EventEmptyType;
31
+ playbackNotificationPause: EventEmptyType;
32
+ playbackNotificationNext: EventEmptyType;
33
+ playbackNotificationPrevious: EventEmptyType;
34
+ playbackNotificationSkipForward: EventTypeWithValue;
35
+ playbackNotificationSkipBackward: EventTypeWithValue;
36
+ playbackNotificationSeekTo: EventTypeWithValue;
37
+ playbackNotificationDismissed: EventEmptyType;
38
+ }
39
+ export type PlaybackNotificationEventName = keyof PlaybackNotificationEvent;
40
+ export interface RecordingNotificationInfo {
41
+ title?: string;
42
+ description?: string;
43
+ artwork?: string | {
44
+ uri: string;
45
+ };
46
+ state?: 'recording' | 'stopped';
47
+ control?: RecordingControlName;
48
+ enabled?: boolean;
49
+ }
50
+ export type RecordingControlName = 'start' | 'stop';
51
+ interface RecordingNotificationEvent {
52
+ recordingNotificationStart: EventEmptyType;
53
+ recordingNotificationStop: EventEmptyType;
54
+ recordingNotificationDismissed: EventEmptyType;
55
+ }
56
+ export type RecordingNotificationEventName = keyof RecordingNotificationEvent;
57
+ export type NotificationEvents = PlaybackNotificationEvent & RecordingNotificationEvent;
58
+ export type NotificationEventName = keyof NotificationEvents;
59
+ export type NotificationCallback<Name extends NotificationEventName> = (event: NotificationEvents[Name]) => void;
60
+ export interface SimpleNotificationOptions {
61
+ title?: string;
62
+ text?: string;
63
+ }
64
+ export {};
65
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/system/notification/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxE,MAAM,WAAW,mBAAmB,CAClC,YAAY,EACZ,cAAc,EACd,UAAU,SAAS,qBAAqB;IAGxC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAG1B,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG3C,MAAM,CAAC,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,6BAA6B,EAAE,cAAc,CAAC;CAC/C;AAED,MAAM,MAAM,6BAA6B,GAAG,MAAM,yBAAyB,CAAC;AAG5E,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAGD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,CAAC;AAGpD,UAAU,0BAA0B;IAClC,0BAA0B,EAAE,cAAc,CAAC;IAC3C,yBAAyB,EAAE,cAAc,CAAC;IAC1C,8BAA8B,EAAE,cAAc,CAAC;CAChD;AAED,MAAM,MAAM,8BAA8B,GAAG,MAAM,0BAA0B,CAAC;AAE9E,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,GACxD,0BAA0B,CAAC;AAE7B,MAAM,MAAM,qBAAqB,GAAG,MAAM,kBAAkB,CAAC;AAE7D,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,qBAAqB,IAAI,CACrE,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAC5B,IAAI,CAAC;AAGV,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -7,21 +7,6 @@ export interface SessionOptions {
7
7
  iosCategory?: IOSCategory;
8
8
  iosAllowHaptics?: boolean;
9
9
  }
10
- export type MediaState = 'state_playing' | 'state_paused';
11
- interface BaseLockScreenInfo {
12
- [key: string]: string | boolean | number | undefined;
13
- }
14
- export interface LockScreenInfo extends BaseLockScreenInfo {
15
- title?: string;
16
- artwork?: string;
17
- artist?: string;
18
- album?: string;
19
- duration?: number;
20
- description?: string;
21
- state?: MediaState;
22
- speed?: number;
23
- elapsedTime?: number;
24
- }
25
10
  export type PermissionStatus = 'Undetermined' | 'Denied' | 'Granted';
26
11
  export interface AudioDeviceInfo {
27
12
  name: string;
@@ -34,5 +19,4 @@ export interface AudioDevicesInfo {
34
19
  currentInputs: AudioDeviceList;
35
20
  currentOutputs: AudioDeviceList;
36
21
  }
37
- export {};
38
22
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/system/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,SAAS,GACT,UAAU,GACV,YAAY,GACZ,aAAa,GACb,eAAe,CAAC;AAEpB,MAAM,MAAM,OAAO,GACf,SAAS,GACT,UAAU,GACV,WAAW,GACX,WAAW,GACX,aAAa,GACb,aAAa,GACb,aAAa,GACb,eAAe,GACf,gBAAgB,CAAC;AAErB,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,GACpB,qCAAqC,GACrC,sCAAsC,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,cAAc,CAAC;AAE1D,UAAU,kBAAkB;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CA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BAAgB,GAAG,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,EAAE,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,eAAe,CAAC;IACjC,gBAAgB,EAAE,eAAe,CAAC;IAClC,aAAa,EAAE,eAAe,CAAC;IAC/B,cAAc,EAAE,eAAe,CAAC;CACjC"}
@@ -23,21 +23,26 @@ export interface OfflineAudioContextOptions {
23
23
  sampleRate: number;
24
24
  }
25
25
  export declare enum FileDirectory {
26
- Document = 1,
27
- Cache = 2
26
+ Document = 0,
27
+ Cache = 1
28
28
  }
29
29
  export declare enum FileFormat {
30
- Wav = 1,
31
- Caf = 2,
32
- M4A = 3,
33
- Flac = 4
30
+ Wav = 0,
31
+ Caf = 1,
32
+ M4A = 2,
33
+ Flac = 3
34
34
  }
35
35
  export declare enum IOSAudioQuality {
36
- Min = 1,
37
- Low = 2,
38
- Medium = 3,
39
- High = 4,
40
- Max = 5
36
+ Min = 0,
37
+ Low = 1,
38
+ Medium = 2,
39
+ High = 3,
40
+ Max = 4
41
+ }
42
+ export declare enum BitDepth {
43
+ Bit16 = 0,
44
+ Bit24 = 1,
45
+ Bit32 = 2
41
46
  }
42
47
  export declare enum FlacCompressionLevel {
43
48
  L0 = 0,
@@ -50,11 +55,6 @@ export declare enum FlacCompressionLevel {
50
55
  L7 = 7,
51
56
  L8 = 8
52
57
  }
53
- export declare enum BitDepth {
54
- Bit16 = 1,
55
- Bit24 = 2,
56
- Bit32 = 3
57
- }
58
58
  export interface FilePresetType {
59
59
  bitRate: number;
60
60
  sampleRate: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C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gB,GAAG,gBAAgB,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export * from './notification';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/web-system/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { AudioEventSubscription } from '../../events';
2
+ import type { NotificationManager, PlaybackNotificationInfo, PlaybackControlName, PlaybackNotificationEventName, NotificationEvents } from '../../system';
3
+ declare class PlaybackNotificationManager implements NotificationManager<PlaybackNotificationInfo, PlaybackNotificationInfo, PlaybackNotificationEventName> {
4
+ private isRegistered;
5
+ private isShown;
6
+ constructor();
7
+ register(): Promise<void>;
8
+ show(info: PlaybackNotificationInfo): Promise<void>;
9
+ update(info: PlaybackNotificationInfo): Promise<void>;
10
+ hide(): Promise<void>;
11
+ unregister(): Promise<void>;
12
+ enableControl(control: PlaybackControlName, enabled: boolean): Promise<void>;
13
+ isActive(): Promise<boolean>;
14
+ addEventListener<T extends PlaybackNotificationEventName>(eventName: T, callback: (event: NotificationEvents[T]) => void): AudioEventSubscription;
15
+ removeEventListener(subscription: AudioEventSubscription): void;
16
+ }
17
+ declare const _default: PlaybackNotificationManager;
18
+ export default _default;
19
+ //# sourceMappingURL=PlaybackNotificationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaybackNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/web-system/notification/PlaybackNotificationManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAGtB,cAAM,2BACJ,YACE,mBAAmB,CACjB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,CAC9B;IAEH,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;;IAIlB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB,IAAI,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnD,MAAM,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAErD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAErB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,aAAa,CACjB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAEV,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC,gBAAgB,CAAC,CAAC,SAAS,6BAA6B,EACtD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,sBAAsB;IAOzB,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;CAChE;;AAED,wBAAiD"}
@@ -0,0 +1,19 @@
1
+ import type { AudioEventSubscription } from '../../events';
2
+ import type { NotificationManager, RecordingNotificationInfo, RecordingControlName, RecordingNotificationEventName, NotificationEvents } from '../../system';
3
+ declare class RecordingNotificationManager implements NotificationManager<RecordingNotificationInfo, RecordingNotificationInfo, RecordingNotificationEventName> {
4
+ private isRegistered;
5
+ private isShown;
6
+ constructor();
7
+ register(): Promise<void>;
8
+ show(info: RecordingNotificationInfo): Promise<void>;
9
+ update(info: RecordingNotificationInfo): Promise<void>;
10
+ hide(): Promise<void>;
11
+ unregister(): Promise<void>;
12
+ enableControl(control: RecordingControlName, enabled: boolean): Promise<void>;
13
+ isActive(): Promise<boolean>;
14
+ addEventListener<T extends RecordingNotificationEventName>(eventName: T, callback: (event: NotificationEvents[T]) => void): AudioEventSubscription;
15
+ removeEventListener(subscription: AudioEventSubscription): void;
16
+ }
17
+ declare const _default: RecordingNotificationManager;
18
+ export default _default;
19
+ //# sourceMappingURL=RecordingNotificationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordingNotificationManager.d.ts","sourceRoot":"","sources":["../../../../src/web-system/notification/RecordingNotificationManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,8BAA8B,EAC9B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAGtB,cAAM,4BACJ,YACE,mBAAmB,CACjB,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,CAC/B;IAEH,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;;IAIlB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB,IAAI,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEpD,MAAM,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAErB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,aAAa,CACjB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAEV,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC,gBAAgB,CAAC,CAAC,SAAS,8BAA8B,EACvD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC/C,sBAAsB;IAOzB,mBAAmB,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;CAChE;;AAED,wBAAkD"}
@@ -0,0 +1,3 @@
1
+ export { default as PlaybackNotificationManager } from './PlaybackNotificationManager';
2
+ export { default as RecordingNotificationManager } from './RecordingNotificationManager';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/web-system/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-audio-api",
3
- "version": "0.11.0-alpha.3",
3
+ "version": "0.11.0-alpha.5",
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"
package/src/api.ts CHANGED
@@ -33,3 +33,20 @@ export * from './errors';
33
33
  export * from './system/types';
34
34
  export * from './types';
35
35
  export { default as FilePreset } from './utils/filePresets';
36
+
37
+ // Notification System
38
+ export {
39
+ PlaybackNotificationManager,
40
+ RecordingNotificationManager,
41
+ } from './system/notification';
42
+
43
+ export {
44
+ NotificationManager,
45
+ PlaybackControlName,
46
+ PlaybackNotificationEventName,
47
+ PlaybackNotificationInfo,
48
+ RecordingControlName,
49
+ RecordingNotificationEventName,
50
+ RecordingNotificationInfo,
51
+ SimpleNotificationOptions,
52
+ } from './system/notification';
package/src/api.web.ts CHANGED
@@ -32,11 +32,16 @@ export {
32
32
  IOSMode,
33
33
  IOSOption,
34
34
  SessionOptions,
35
- MediaState,
36
- LockScreenInfo,
37
35
  PermissionStatus,
38
36
  } from './system/types';
39
37
 
38
+ export {
39
+ PlaybackNotificationManager,
40
+ RecordingNotificationManager,
41
+ } from './web-system';
42
+
43
+ export * from './system/notification/types';
44
+
40
45
  export {
41
46
  IndexSizeError,
42
47
  InvalidAccessError,
@@ -1,4 +1,5 @@
1
1
  import AudioBuffer from '../core/AudioBuffer';
2
+ import { NotificationEvents } from '../system';
2
3
 
3
4
  export interface EventEmptyType {}
4
5
 
@@ -8,7 +9,7 @@ export interface EventTypeWithValue {
8
9
 
9
10
  interface OnInterruptionEventType {
10
11
  type: 'ended' | 'began';
11
- shouldResume: boolean;
12
+ isTransient: boolean;
12
13
  }
13
14
 
14
15
  interface OnRouteChangeEventType {
@@ -87,9 +88,7 @@ interface AudioAPIEvents {
87
88
  recorderError: OnRecorderErrorEventType;
88
89
  }
89
90
 
90
- type AudioEvents = SystemEvents & AudioAPIEvents;
91
-
92
- export type RemoteCommandEventName = keyof RemoteCommandEvents;
91
+ type AudioEvents = SystemEvents & AudioAPIEvents & NotificationEvents;
93
92
 
94
93
  export type SystemEventName = keyof SystemEvents;
95
94
  export type SystemEventCallback<Name extends SystemEventName> = (
@@ -3,6 +3,10 @@ import type { TurboModule } from 'react-native';
3
3
  import { TurboModuleRegistry } from 'react-native';
4
4
  import { AudioDevicesInfo, PermissionStatus } from '../system/types';
5
5
 
6
+ type OptionsMap = { [key: string]: string | boolean | number | undefined };
7
+ type NotificationOpResponse = { success: boolean; error?: string };
8
+ type NotificationType = 'playback' | 'recording' | 'simple';
9
+
6
10
  interface Spec extends TurboModule {
7
11
  install(): boolean;
8
12
  getDevicePreferredSampleRate(): number;
@@ -17,14 +21,7 @@ interface Spec extends TurboModule {
17
21
  ): void;
18
22
  disableSessionManagement(): void;
19
23
 
20
- // Lock Screen Info
21
- setLockScreenInfo(info: {
22
- [key: string]: string | boolean | number | undefined;
23
- }): void;
24
- resetLockScreenInfo(): void;
25
-
26
24
  // Remote commands, system events and interruptions
27
- enableRemoteCommand(name: string, enabled: boolean): void;
28
25
  observeAudioInterruptions(enabled: boolean): void;
29
26
  activelyReclaimSession(enabled: boolean): void;
30
27
  observeVolumeChanges(enabled: boolean): void;
@@ -32,9 +29,28 @@ interface Spec extends TurboModule {
32
29
  // Permissions
33
30
  requestRecordingPermissions(): Promise<PermissionStatus>;
34
31
  checkRecordingPermissions(): Promise<PermissionStatus>;
32
+ requestNotificationPermissions(): Promise<PermissionStatus>;
33
+ checkNotificationPermissions(): Promise<PermissionStatus>;
35
34
 
36
35
  // Audio devices
37
36
  getDevicesInfo(): Promise<AudioDevicesInfo>;
37
+
38
+ // New notification system
39
+ registerNotification(
40
+ type: NotificationType,
41
+ key: string
42
+ ): Promise<NotificationOpResponse>;
43
+ showNotification(
44
+ key: string,
45
+ options: OptionsMap
46
+ ): Promise<NotificationOpResponse>;
47
+ updateNotification(
48
+ key: string,
49
+ options: OptionsMap
50
+ ): Promise<NotificationOpResponse>;
51
+ hideNotification(key: string): Promise<NotificationOpResponse>;
52
+ unregisterNotification(key: string): Promise<NotificationOpResponse>;
53
+ isNotificationActive(key: string): Promise<boolean>;
38
54
  }
39
55
 
40
56
  const NativeAudioAPIModule = TurboModuleRegistry.get<Spec>('AudioAPIModule');
@@ -1,16 +1,7 @@
1
+ import { SessionOptions, PermissionStatus, AudioDevicesInfo } from './types';
2
+ import { SystemEventName, SystemEventCallback } from '../events/types';
1
3
  import { AudioEventEmitter, AudioEventSubscription } from '../events';
2
- import {
3
- RemoteCommandEventName,
4
- SystemEventCallback,
5
- SystemEventName,
6
- } from '../events/types';
7
4
  import { NativeAudioAPIModule } from '../specs';
8
- import {
9
- AudioDevicesInfo,
10
- LockScreenInfo,
11
- PermissionStatus,
12
- SessionOptions,
13
- } from './types';
14
5
 
15
6
  class AudioManager {
16
7
  private readonly audioEventEmitter: AudioEventEmitter;
@@ -39,14 +30,6 @@ class AudioManager {
39
30
  NativeAudioAPIModule!.disableSessionManagement();
40
31
  }
41
32
 
42
- setLockScreenInfo(info: LockScreenInfo) {
43
- NativeAudioAPIModule!.setLockScreenInfo(info);
44
- }
45
-
46
- resetLockScreenInfo() {
47
- NativeAudioAPIModule!.resetLockScreenInfo();
48
- }
49
-
50
33
  observeAudioInterruptions(enabled: boolean) {
51
34
  NativeAudioAPIModule!.observeAudioInterruptions(enabled);
52
35
  }
@@ -72,10 +55,6 @@ class AudioManager {
72
55
  NativeAudioAPIModule!.observeVolumeChanges(enabled);
73
56
  }
74
57
 
75
- enableRemoteCommand(name: RemoteCommandEventName, enabled: boolean) {
76
- NativeAudioAPIModule!.enableRemoteCommand(name, enabled);
77
- }
78
-
79
58
  addSystemEventListener<Name extends SystemEventName>(
80
59
  name: Name,
81
60
  callback: SystemEventCallback<Name>
@@ -91,6 +70,14 @@ class AudioManager {
91
70
  return NativeAudioAPIModule!.checkRecordingPermissions();
92
71
  }
93
72
 
73
+ async requestNotificationPermissions(): Promise<PermissionStatus> {
74
+ return NativeAudioAPIModule!.requestNotificationPermissions();
75
+ }
76
+
77
+ async checkNotificationPermissions(): Promise<PermissionStatus> {
78
+ return NativeAudioAPIModule!.checkNotificationPermissions();
79
+ }
80
+
94
81
  async getDevicesInfo(): Promise<AudioDevicesInfo> {
95
82
  return NativeAudioAPIModule!.getDevicesInfo();
96
83
  }
@@ -1 +1,2 @@
1
1
  export { default } from './AudioManager';
2
+ export * from './notification';