react-native-audio-api 0.11.0-nightly-b30bac9-20260114 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +3 -10
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +0 -4
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +4 -83
- package/android/src/main/java/com/swmansion/audioapi/system/CentralizedForegroundService.kt +14 -29
- package/android/src/main/java/com/swmansion/audioapi/system/ForegroundServiceManager.kt +10 -9
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +10 -51
- package/android/src/main/java/com/swmansion/audioapi/system/notification/BaseNotification.kt +6 -14
- package/android/src/main/java/com/swmansion/audioapi/system/notification/NotificationRegistry.kt +79 -60
- package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +249 -411
- package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotificationReceiver.kt +8 -3
- package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotification.kt +240 -222
- package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +11 -22
- package/android/src/main/java/com/swmansion/audioapi/system/notification/state/RecordingNotificationState.kt +24 -0
- package/android/src/main/res/layout/btn_round_ripple.xml +9 -0
- package/android/src/main/res/layout/notification_collapsed.xml +45 -0
- package/android/src/main/res/layout/notification_expanded.xml +44 -0
- package/android/src/oldarch/NativeAudioAPIModuleSpec.java +1 -13
- package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +1 -1
- package/ios/audioapi/ios/AudioAPIModule.mm +5 -48
- package/ios/audioapi/ios/system/notification/BaseNotification.h +0 -7
- package/ios/audioapi/ios/system/notification/NotificationRegistry.h +5 -25
- package/ios/audioapi/ios/system/notification/NotificationRegistry.mm +19 -64
- package/ios/audioapi/ios/system/notification/PlaybackNotification.mm +4 -15
- package/lib/commonjs/AudioAPIModule/AudioAPIModule.js +2 -1
- package/lib/commonjs/AudioAPIModule/AudioAPIModule.js.map +1 -1
- package/lib/commonjs/api.js +1 -29
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/core/AudioDecoder.js +42 -16
- package/lib/commonjs/core/AudioDecoder.js.map +1 -1
- package/lib/commonjs/core/AudioRecorder.js +2 -1
- package/lib/commonjs/core/AudioRecorder.js.map +1 -1
- package/lib/commonjs/core/AudioStretcher.js +2 -1
- package/lib/commonjs/core/AudioStretcher.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +2 -5
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/errors/AudioApiError.js +14 -0
- package/lib/commonjs/errors/AudioApiError.js.map +1 -0
- package/lib/commonjs/errors/index.js +7 -0
- package/lib/commonjs/errors/index.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.web.js +0 -9
- package/lib/commonjs/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/commonjs/system/notification/PlaybackNotificationManager.js +40 -85
- package/lib/commonjs/system/notification/PlaybackNotificationManager.js.map +1 -1
- package/lib/commonjs/system/notification/RecordingNotificationManager.ios.js +51 -0
- package/lib/commonjs/system/notification/RecordingNotificationManager.ios.js.map +1 -0
- package/lib/commonjs/system/notification/RecordingNotificationManager.js +30 -144
- package/lib/commonjs/system/notification/RecordingNotificationManager.js.map +1 -1
- package/lib/commonjs/system/notification/index.js +1 -9
- package/lib/commonjs/system/notification/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +3 -2
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/paths.js +18 -0
- package/lib/commonjs/utils/paths.js.map +1 -0
- package/lib/commonjs/web-core/AudioContext.js +20 -11
- package/lib/commonjs/web-core/AudioContext.js.map +1 -1
- package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js +0 -1
- package/lib/commonjs/web-system/notification/PlaybackNotificationManager.js.map +1 -1
- package/lib/commonjs/web-system/notification/RecordingNotificationManager.js +1 -6
- package/lib/commonjs/web-system/notification/RecordingNotificationManager.js.map +1 -1
- package/lib/module/AudioAPIModule/AudioAPIModule.js +2 -1
- package/lib/module/AudioAPIModule/AudioAPIModule.js.map +1 -1
- package/lib/module/api.js +3 -2
- package/lib/module/api.js.map +1 -1
- package/lib/module/core/AudioDecoder.js +42 -16
- package/lib/module/core/AudioDecoder.js.map +1 -1
- package/lib/module/core/AudioRecorder.js +3 -1
- package/lib/module/core/AudioRecorder.js.map +1 -1
- package/lib/module/core/AudioStretcher.js +2 -1
- package/lib/module/core/AudioStretcher.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +2 -5
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/errors/AudioApiError.js +10 -0
- package/lib/module/errors/AudioApiError.js.map +1 -0
- package/lib/module/errors/index.js +1 -0
- package/lib/module/errors/index.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.web.js +0 -9
- package/lib/module/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/module/system/notification/PlaybackNotificationManager.js +40 -85
- package/lib/module/system/notification/PlaybackNotificationManager.js.map +1 -1
- package/lib/module/system/notification/RecordingNotificationManager.ios.js +47 -0
- package/lib/module/system/notification/RecordingNotificationManager.ios.js.map +1 -0
- package/lib/module/system/notification/RecordingNotificationManager.js +30 -144
- package/lib/module/system/notification/RecordingNotificationManager.js.map +1 -1
- package/lib/module/system/notification/index.js +1 -2
- package/lib/module/system/notification/index.js.map +1 -1
- package/lib/module/utils/index.js +3 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/paths.js +12 -0
- package/lib/module/utils/paths.js.map +1 -0
- package/lib/module/web-core/AudioContext.js +20 -11
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-system/notification/PlaybackNotificationManager.js +0 -1
- package/lib/module/web-system/notification/PlaybackNotificationManager.js.map +1 -1
- package/lib/module/web-system/notification/RecordingNotificationManager.js +1 -6
- package/lib/module/web-system/notification/RecordingNotificationManager.js.map +1 -1
- package/lib/typescript/AudioAPIModule/AudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/api.d.ts +3 -2
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/core/AudioDecoder.d.ts +2 -1
- package/lib/typescript/core/AudioDecoder.d.ts.map +1 -1
- package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
- package/lib/typescript/core/AudioStretcher.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +2 -2
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/errors/AudioApiError.d.ts +5 -0
- package/lib/typescript/errors/AudioApiError.d.ts.map +1 -0
- package/lib/typescript/errors/index.d.ts +1 -0
- package/lib/typescript/errors/index.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +1 -1
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +2 -5
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts +1 -4
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts.map +1 -1
- package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts +32 -9
- package/lib/typescript/system/notification/PlaybackNotificationManager.d.ts.map +1 -1
- package/lib/typescript/system/notification/RecordingNotificationManager.d.ts +26 -13
- package/lib/typescript/system/notification/RecordingNotificationManager.d.ts.map +1 -1
- package/lib/typescript/system/notification/RecordingNotificationManager.ios.d.ts +36 -0
- package/lib/typescript/system/notification/RecordingNotificationManager.ios.d.ts.map +1 -0
- package/lib/typescript/system/notification/index.d.ts +0 -1
- package/lib/typescript/system/notification/index.d.ts.map +1 -1
- package/lib/typescript/system/notification/types.d.ts +12 -22
- package/lib/typescript/system/notification/types.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +1 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/paths.d.ts +4 -0
- package/lib/typescript/utils/paths.d.ts.map +1 -0
- package/lib/typescript/web-core/AudioContext.d.ts +8 -9
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/BaseAudioContext.d.ts +6 -7
- package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts +1 -2
- package/lib/typescript/web-system/notification/PlaybackNotificationManager.d.ts.map +1 -1
- package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts +2 -7
- package/lib/typescript/web-system/notification/RecordingNotificationManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AudioAPIModule/AudioAPIModule.ts +2 -1
- package/src/api.ts +2 -8
- package/src/core/AudioDecoder.ts +91 -21
- package/src/core/AudioRecorder.ts +2 -1
- package/src/core/AudioStretcher.ts +2 -1
- package/src/core/BaseAudioContext.ts +4 -6
- package/src/errors/AudioApiError.ts +8 -0
- package/src/errors/index.ts +1 -0
- package/src/interfaces.ts +1 -1
- package/src/specs/NativeAudioAPIModule.ts +5 -15
- package/src/specs/NativeAudioAPIModule.web.ts +1 -12
- package/src/system/notification/PlaybackNotificationManager.ts +42 -117
- package/src/system/notification/RecordingNotificationManager.ios.ts +65 -0
- package/src/system/notification/RecordingNotificationManager.ts +33 -183
- package/src/system/notification/index.ts +0 -1
- package/src/system/notification/types.ts +15 -37
- package/src/types.ts +2 -0
- package/src/utils/index.ts +3 -2
- package/src/utils/paths.ts +11 -0
- package/src/web-core/AudioContext.tsx +34 -19
- package/src/web-core/BaseAudioContext.tsx +9 -7
- package/src/web-system/notification/PlaybackNotificationManager.ts +1 -7
- package/src/web-system/notification/RecordingNotificationManager.ts +1 -16
- package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioPlayer.kt +0 -26
- package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioRecorder.kt +0 -26
- package/android/src/main/java/com/swmansion/audioapi/system/notification/SimpleNotification.kt +0 -119
- package/lib/commonjs/system/notification/SimpleNotificationManager.js +0 -125
- package/lib/commonjs/system/notification/SimpleNotificationManager.js.map +0 -1
- package/lib/module/system/notification/SimpleNotificationManager.js +0 -121
- package/lib/module/system/notification/SimpleNotificationManager.js.map +0 -1
- package/lib/typescript/system/notification/SimpleNotificationManager.d.ts +0 -21
- package/lib/typescript/system/notification/SimpleNotificationManager.d.ts.map +0 -1
- package/src/system/notification/SimpleNotificationManager.ts +0 -175
|
@@ -4,182 +4,68 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
7
|
var _events = require("../../events");
|
|
9
8
|
var _specs = require("../../specs");
|
|
10
|
-
|
|
9
|
+
var _errors = require("../../errors");
|
|
11
10
|
class RecordingNotificationManager {
|
|
12
|
-
|
|
13
|
-
isShown_ = false;
|
|
14
|
-
notificationKey = 'recording';
|
|
15
|
-
isIOS = _reactNative.Platform.OS === 'ios';
|
|
11
|
+
notificationKey = 'react-native-audio-api-recording';
|
|
16
12
|
constructor() {
|
|
17
13
|
this.audioEventEmitter = new _events.AudioEventEmitter(global.AudioEventEmitter);
|
|
18
14
|
}
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Recording notifications are only supported on Android
|
|
28
|
-
if (this.isIOS) {
|
|
29
|
-
this.isRegistered_ = true;
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (!_specs.NativeAudioAPIModule) {
|
|
33
|
-
throw new Error('NativeAudioAPIModule is not available');
|
|
34
|
-
}
|
|
35
|
-
const result = await _specs.NativeAudioAPIModule.registerNotification('recording', this.notificationKey);
|
|
36
|
-
if (result.error) {
|
|
37
|
-
throw new Error(result.error);
|
|
38
|
-
}
|
|
39
|
-
this.isRegistered_ = true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/// Show the notification with initial metadata.
|
|
16
|
+
/**
|
|
17
|
+
* Show the notification with metadata or update if already visible.
|
|
18
|
+
*
|
|
19
|
+
* @param info - The info to be displayed.
|
|
20
|
+
* @returns Promise that resolves after creating notification.
|
|
21
|
+
*/
|
|
43
22
|
async show(info) {
|
|
44
|
-
if (!this.isRegistered_) {
|
|
45
|
-
throw new Error('RecordingNotification must be registered before showing. Call register() first.');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Recording notifications are only supported on Android
|
|
49
|
-
if (this.isIOS) {
|
|
50
|
-
this.isShown_ = true;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
23
|
if (!_specs.NativeAudioAPIModule) {
|
|
54
|
-
throw new
|
|
24
|
+
throw new _errors.AudioApiError('NativeAudioAPIModule is not available');
|
|
55
25
|
}
|
|
56
|
-
const result = await _specs.NativeAudioAPIModule.showNotification(this.notificationKey, info);
|
|
26
|
+
const result = await _specs.NativeAudioAPIModule.showNotification('recording', this.notificationKey, info);
|
|
57
27
|
if (result.error) {
|
|
58
|
-
throw new
|
|
28
|
+
throw new _errors.AudioApiError(result.error);
|
|
59
29
|
}
|
|
60
|
-
this.isShown_ = true;
|
|
61
30
|
}
|
|
62
31
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Recording notifications are only supported on Android
|
|
71
|
-
if (this.isIOS) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (!_specs.NativeAudioAPIModule) {
|
|
75
|
-
throw new Error('NativeAudioAPIModule is not available');
|
|
76
|
-
}
|
|
77
|
-
const result = await _specs.NativeAudioAPIModule.updateNotification(this.notificationKey, info);
|
|
78
|
-
if (result.error) {
|
|
79
|
-
throw new Error(result.error);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/// Hide the notification (can be shown again later).
|
|
32
|
+
/**
|
|
33
|
+
* Hide the notification.
|
|
34
|
+
*
|
|
35
|
+
* @returns Promise that resolves after hiding notification.
|
|
36
|
+
*/
|
|
84
37
|
async hide() {
|
|
85
|
-
if (!this.isShown_) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Recording notifications are only supported on Android
|
|
90
|
-
if (this.isIOS) {
|
|
91
|
-
this.isShown_ = false;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
38
|
if (!_specs.NativeAudioAPIModule) {
|
|
95
|
-
throw new
|
|
39
|
+
throw new _errors.AudioApiError('NativeAudioAPIModule is not available');
|
|
96
40
|
}
|
|
97
41
|
const result = await _specs.NativeAudioAPIModule.hideNotification(this.notificationKey);
|
|
98
42
|
if (result.error) {
|
|
99
|
-
throw new
|
|
43
|
+
throw new _errors.AudioApiError(result.error);
|
|
100
44
|
}
|
|
101
|
-
this.isShown_ = false;
|
|
102
45
|
}
|
|
103
46
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (this.isShown_) {
|
|
110
|
-
await this.hide();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Recording notifications are only supported on Android
|
|
114
|
-
if (this.isIOS) {
|
|
115
|
-
this.isRegistered_ = false;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (!_specs.NativeAudioAPIModule) {
|
|
119
|
-
throw new Error('NativeAudioAPIModule is not available');
|
|
120
|
-
}
|
|
121
|
-
const result = await _specs.NativeAudioAPIModule.unregisterNotification(this.notificationKey);
|
|
122
|
-
if (result.error) {
|
|
123
|
-
throw new Error(result.error);
|
|
124
|
-
}
|
|
125
|
-
this.isRegistered_ = false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/// Enable or disable a specific recording control.
|
|
129
|
-
async enableControl(control, enabled) {
|
|
130
|
-
if (!this.isRegistered_) {
|
|
131
|
-
console.warn('RecordingNotification is not registered');
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Recording notifications are only supported on Android
|
|
136
|
-
if (this.isIOS) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (!_specs.NativeAudioAPIModule) {
|
|
140
|
-
throw new Error('NativeAudioAPIModule is not available');
|
|
141
|
-
}
|
|
142
|
-
const params = {
|
|
143
|
-
control,
|
|
144
|
-
enabled
|
|
145
|
-
};
|
|
146
|
-
const result = await _specs.NativeAudioAPIModule.updateNotification(this.notificationKey, params);
|
|
147
|
-
if (result.error) {
|
|
148
|
-
throw new Error(result.error);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/// Check if the notification is currently active.
|
|
47
|
+
/**
|
|
48
|
+
* Check if the notification is currently active.
|
|
49
|
+
*
|
|
50
|
+
* @returns Promise that resolves to whether notification is active.
|
|
51
|
+
*/
|
|
153
52
|
async isActive() {
|
|
154
|
-
// Recording notifications are only supported on Android
|
|
155
|
-
if (this.isIOS) {
|
|
156
|
-
return this.isShown_;
|
|
157
|
-
}
|
|
158
53
|
if (!_specs.NativeAudioAPIModule) {
|
|
159
54
|
return false;
|
|
160
55
|
}
|
|
161
56
|
return await _specs.NativeAudioAPIModule.isNotificationActive(this.notificationKey);
|
|
162
57
|
}
|
|
163
|
-
isRegistered() {
|
|
164
|
-
return this.isRegistered_;
|
|
165
|
-
}
|
|
166
58
|
|
|
167
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Add an event listener for notification actions.
|
|
61
|
+
*
|
|
62
|
+
* @param eventName - The event name to listen for.
|
|
63
|
+
* @param callback - The callback to invoke on event.
|
|
64
|
+
* @returns Class that represents the subscription.
|
|
65
|
+
*/
|
|
168
66
|
addEventListener(eventName, callback) {
|
|
169
|
-
// Recording notifications are only supported on Android
|
|
170
|
-
if (this.isIOS) {
|
|
171
|
-
// Return a dummy subscription for iOS
|
|
172
|
-
return {
|
|
173
|
-
remove: () => {}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
67
|
return this.audioEventEmitter.addAudioEventListener(eventName, callback);
|
|
177
68
|
}
|
|
178
|
-
|
|
179
|
-
/** Remove an event listener. */
|
|
180
|
-
removeEventListener(subscription) {
|
|
181
|
-
subscription.remove();
|
|
182
|
-
}
|
|
183
69
|
}
|
|
184
70
|
var _default = exports.default = new RecordingNotificationManager();
|
|
185
71
|
//# sourceMappingURL=RecordingNotificationManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_events","require","_specs","_errors","RecordingNotificationManager","notificationKey","constructor","audioEventEmitter","AudioEventEmitter","global","show","info","NativeAudioAPIModule","AudioApiError","result","showNotification","error","hide","hideNotification","isActive","isNotificationActive","addEventListener","eventName","callback","addAudioEventListener","_default","exports","default"],"sourceRoot":"../../../../src","sources":["system/notification/RecordingNotificationManager.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,OAAA,GAAAF,OAAA;AAEA,MAAMG,4BAA4B,CAMlC;EACUC,eAAe,GAAG,kCAAkC;EAG5DC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIC,yBAAiB,CAACC,MAAM,CAACD,iBAAiB,CAAC;EAC1E;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAME,IAAIA,CAACC,IAA+B,EAAiB;IACzD,IAAI,CAACC,2BAAoB,EAAE;MACzB,MAAM,IAAIC,qBAAa,CAAC,uCAAuC,CAAC;IAClE;IAEA,MAAMC,MAAM,GAAG,MAAMF,2BAAoB,CAACG,gBAAgB,CACxD,WAAW,EACX,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;EACE,MAAMG,QAAQA,CAAA,EAAqB;IACjC,IAAI,CAACP,2BAAoB,EAAE;MACzB,OAAO,KAAK;IACd;IAEA,OAAO,MAAMA,2BAAoB,CAACQ,oBAAoB,CACpD,IAAI,CAACf,eACP,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEgB,gBAAgBA,CACdC,SAAY,EACZC,QAAwD,EAChC;IACxB,OAAO,IAAI,CAAChB,iBAAiB,CAACiB,qBAAqB,CAACF,SAAS,EAAEC,QAAQ,CAAC;EAC1E;AACF;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAIvB,4BAA4B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
PlaybackNotificationManager: true,
|
|
8
|
-
RecordingNotificationManager: true
|
|
9
|
-
SimpleNotificationManager: true
|
|
8
|
+
RecordingNotificationManager: true
|
|
10
9
|
};
|
|
11
10
|
Object.defineProperty(exports, "PlaybackNotificationManager", {
|
|
12
11
|
enumerable: true,
|
|
@@ -20,15 +19,8 @@ Object.defineProperty(exports, "RecordingNotificationManager", {
|
|
|
20
19
|
return _RecordingNotificationManager.default;
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
|
-
Object.defineProperty(exports, "SimpleNotificationManager", {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () {
|
|
26
|
-
return _SimpleNotificationManager.default;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
22
|
var _PlaybackNotificationManager = _interopRequireDefault(require("./PlaybackNotificationManager"));
|
|
30
23
|
var _RecordingNotificationManager = _interopRequireDefault(require("./RecordingNotificationManager"));
|
|
31
|
-
var _SimpleNotificationManager = _interopRequireDefault(require("./SimpleNotificationManager"));
|
|
32
24
|
var _types = require("./types");
|
|
33
25
|
Object.keys(_types).forEach(function (key) {
|
|
34
26
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_PlaybackNotificationManager","_interopRequireDefault","require","_RecordingNotificationManager","
|
|
1
|
+
{"version":3,"names":["_PlaybackNotificationManager","_interopRequireDefault","require","_RecordingNotificationManager","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["system/notification/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,4BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAAwB,SAAAP,uBAAAgB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.assertWorkletsEnabled = assertWorkletsEnabled;
|
|
7
7
|
exports.clamp = clamp;
|
|
8
8
|
var _AudioAPIModule = _interopRequireDefault(require("../AudioAPIModule"));
|
|
9
|
+
var _errors = require("../errors");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
function assertWorkletsEnabled() {
|
|
11
12
|
if (!_AudioAPIModule.default.areWorkletsAvailable) {
|
|
12
|
-
throw new
|
|
13
|
+
throw new _errors.AudioApiError('[react-native-audio-api]: Worklets are not available. Please install react-native-worklets to use this feature.');
|
|
13
14
|
}
|
|
14
15
|
if (!_AudioAPIModule.default.isWorkletsVersionSupported) {
|
|
15
|
-
throw new
|
|
16
|
+
throw new _errors.AudioApiError(`[react-native-audio-api]: Worklets version ${_AudioAPIModule.default.workletsVersion} is not supported.
|
|
16
17
|
Please install react-native-worklets of one of the following versions: [${_AudioAPIModule.default.supportedWorkletsVersion.join(', ')}] to use this feature.`);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioAPIModule","_interopRequireDefault","require","e","__esModule","default","assertWorkletsEnabled","AudioAPIModule","areWorkletsAvailable","
|
|
1
|
+
{"version":3,"names":["_AudioAPIModule","_interopRequireDefault","require","_errors","e","__esModule","default","assertWorkletsEnabled","AudioAPIModule","areWorkletsAvailable","AudioApiError","isWorkletsVersionSupported","workletsVersion","supportedWorkletsVersion","join","clamp","value","min","max","Math"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAA0C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnC,SAASG,qBAAqBA,CAAA,EAAG;EACtC,IAAI,CAACC,uBAAc,CAACC,oBAAoB,EAAE;IACxC,MAAM,IAAIC,qBAAa,CACrB,iHACF,CAAC;EACH;EAEA,IAAI,CAACF,uBAAc,CAACG,0BAA0B,EAAE;IAC9C,MAAM,IAAID,qBAAa,CACrB,8CAA8CF,uBAAc,CAACI,eAAe;AAClF,gFAAgFJ,uBAAc,CAACK,wBAAwB,CAACC,IAAI,CAAC,IAAI,CAAC,wBAC9H,CAAC;EACH;AACF;AAEO,SAASC,KAAKA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAU;EACrE,OAAOC,IAAI,CAACF,GAAG,CAACE,IAAI,CAACD,GAAG,CAACF,KAAK,EAAEC,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isBase64Source = isBase64Source;
|
|
7
|
+
exports.isDataBlobString = isDataBlobString;
|
|
8
|
+
exports.isRemoteSource = isRemoteSource;
|
|
9
|
+
function isRemoteSource(url) {
|
|
10
|
+
return url.startsWith('http://') || url.startsWith('https://');
|
|
11
|
+
}
|
|
12
|
+
function isBase64Source(data) {
|
|
13
|
+
return data.startsWith('data:audio/') && data.includes(';base64,');
|
|
14
|
+
}
|
|
15
|
+
function isDataBlobString(data) {
|
|
16
|
+
return data.startsWith('blob:');
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isRemoteSource","url","startsWith","isBase64Source","data","includes","isDataBlobString"],"sourceRoot":"../../../src","sources":["utils/paths.ts"],"mappings":";;;;;;;;AAAO,SAASA,cAAcA,CAACC,GAAW,EAAW;EACnD,OAAOA,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,UAAU,CAAC;AAChE;AAEO,SAASC,cAAcA,CAACC,IAAY,EAAW;EACpD,OAAOA,IAAI,CAACF,UAAU,CAAC,aAAa,CAAC,IAAIE,IAAI,CAACC,QAAQ,CAAC,UAAU,CAAC;AACpE;AAEO,SAASC,gBAAgBA,CAACF,IAAY,EAAW;EACtD,OAAOA,IAAI,CAACF,UAAU,CAAC,OAAO,CAAC;AACjC","ignoreList":[]}
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _errors = require("../errors");
|
|
8
8
|
var _AnalyserNode = _interopRequireDefault(require("./AnalyserNode"));
|
|
9
|
-
var _AudioDestinationNode = _interopRequireDefault(require("./AudioDestinationNode"));
|
|
10
9
|
var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
|
|
11
10
|
var _AudioBufferSourceNode = _interopRequireDefault(require("./AudioBufferSourceNode"));
|
|
11
|
+
var _AudioDestinationNode = _interopRequireDefault(require("./AudioDestinationNode"));
|
|
12
12
|
var _BiquadFilterNode = _interopRequireDefault(require("./BiquadFilterNode"));
|
|
13
|
-
var
|
|
13
|
+
var _ConvolverNode = _interopRequireDefault(require("./ConvolverNode"));
|
|
14
|
+
var _DelayNode = _interopRequireDefault(require("./DelayNode"));
|
|
14
15
|
var _GainNode = _interopRequireDefault(require("./GainNode"));
|
|
16
|
+
var _IIRFilterNode = _interopRequireDefault(require("./IIRFilterNode"));
|
|
15
17
|
var _OscillatorNode = _interopRequireDefault(require("./OscillatorNode"));
|
|
16
18
|
var _PeriodicWave = _interopRequireDefault(require("./PeriodicWave"));
|
|
17
19
|
var _StereoPannerNode = _interopRequireDefault(require("./StereoPannerNode"));
|
|
18
|
-
var _ConvolverNode = _interopRequireDefault(require("./ConvolverNode"));
|
|
19
|
-
var _DelayNode = _interopRequireDefault(require("./DelayNode"));
|
|
20
|
-
var _LoadCustomWasm = require("./custom/LoadCustomWasm");
|
|
21
20
|
var _ConstantSourceNode = _interopRequireDefault(require("./ConstantSourceNode"));
|
|
21
|
+
var _LoadCustomWasm = require("./custom/LoadCustomWasm");
|
|
22
22
|
var _WaveShaperNode = _interopRequireDefault(require("./WaveShaperNode"));
|
|
23
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
24
|
class AudioContext {
|
|
@@ -102,12 +102,21 @@ class AudioContext {
|
|
|
102
102
|
createWaveShaper() {
|
|
103
103
|
return new _WaveShaperNode.default(this, this.context.createWaveShaper());
|
|
104
104
|
}
|
|
105
|
-
async
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
async decodeAudioData(source, fetchOptions) {
|
|
106
|
+
if (source instanceof ArrayBuffer) {
|
|
107
|
+
const decodedData = await this.context.decodeAudioData(source);
|
|
108
|
+
return new _AudioBuffer.default(decodedData);
|
|
109
|
+
}
|
|
110
|
+
if (typeof source === 'string') {
|
|
111
|
+
const response = await fetch(source, fetchOptions);
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
throw new _errors.InvalidAccessError(`Failed to fetch audio data from the provided source: ${source}`);
|
|
114
|
+
}
|
|
115
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
116
|
+
const decodedData = await this.context.decodeAudioData(arrayBuffer);
|
|
117
|
+
return new _AudioBuffer.default(decodedData);
|
|
118
|
+
}
|
|
119
|
+
throw new TypeError('Unsupported source for decodeAudioData: ' + source);
|
|
111
120
|
}
|
|
112
121
|
async close() {
|
|
113
122
|
await this.context.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","_AnalyserNode","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_errors","require","_AnalyserNode","_interopRequireDefault","_AudioBuffer","_AudioBufferSourceNode","_AudioDestinationNode","_BiquadFilterNode","_ConvolverNode","_DelayNode","_GainNode","_IIRFilterNode","_OscillatorNode","_PeriodicWave","_StereoPannerNode","_ConstantSourceNode","_LoadCustomWasm","_WaveShaperNode","e","__esModule","default","AudioContext","constructor","options","sampleRate","NotSupportedError","context","window","destination","AudioDestinationNode","currentTime","state","createOscillator","OscillatorNode","createConstantSource","ConstantSourceNode","createGain","GainNode","createDelay","maxDelayTime","DelayNode","createStereoPanner","StereoPannerNode","createBiquadFilter","BiquadFilterNode","createIIRFilter","IIRFilterNode","feedforward","feedback","createConvolver","buffer","numberOfChannels","disableNormalization","ConvolverNode","createBufferSource","pitchCorrection","AudioBufferSourceNode","globalWasmPromise","wasmStretch","globalTag","createBuffer","numOfChannels","length","AudioBuffer","createPeriodicWave","real","imag","constraints","InvalidAccessError","PeriodicWave","createAnalyser","AnalyserNode","createWaveShaper","WaveShaperNode","decodeAudioData","source","fetchOptions","ArrayBuffer","decodedData","response","fetch","ok","arrayBuffer","TypeError","close","resume","suspend","exports"],"sourceRoot":"../../../src","sources":["web-core/AudioContext.tsx"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AASA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,sBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAEA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,cAAA,GAAAL,sBAAA,CAAAF,OAAA;AAEA,IAAAQ,UAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,SAAA,GAAAP,sBA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oBAAW,CAACe,WAAW,CAAC;IACrC;IAEA,MAAM,IAAIK,SAAS,CAAC,0CAA0C,GAAGR,MAAM,CAAC;EAC1E;EAEA,MAAMS,KAAKA,CAAA,EAAkB;IAC3B,MAAM,IAAI,CAAC1D,OAAO,CAAC0D,KAAK,CAAC,CAAC;EAC5B;EAEA,MAAMC,MAAMA,CAAA,EAAkB;IAC5B,MAAM,IAAI,CAAC3D,OAAO,CAAC2D,MAAM,CAAC,CAAC;EAC7B;EAEA,MAAMC,OAAOA,CAAA,EAAkB;IAC7B,MAAM,IAAI,CAAC5D,OAAO,CAAC4D,OAAO,CAAC,CAAC;EAC9B;AACF;AAACC,OAAA,CAAAnE,OAAA,GAAAC,YAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PlaybackNotificationManager","isRegistered_","isShown_","constructor","register","show","info","update","hide","unregister","enableControl","control","enabled","isActive","isRegistered","addEventListener","eventName","callback","remove","
|
|
1
|
+
{"version":3,"names":["PlaybackNotificationManager","isRegistered_","isShown_","constructor","register","show","info","update","hide","unregister","enableControl","control","enabled","isActive","isRegistered","addEventListener","eventName","callback","remove","_default","exports","default"],"sourceRoot":"../../../../src","sources":["web-system/notification/PlaybackNotificationManager.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAWA;AACA,MAAMA,2BAA2B,CAGjC;EACUC,aAAa,GAAG,KAAK;EACrBC,QAAQ,GAAG,KAAK;EAExBC,WAAWA,CAAA,EAAG,CAAC;EAEf,MAAMC,QAAQA,CAAA,EAAkB,CAAC;EAEjC,MAAMC,IAAIA,CAACC,IAA8B,EAAiB,CAAC;EAE3D,MAAMC,MAAMA,CAACD,IAA8B,EAAiB,CAAC;EAE7D,MAAME,IAAIA,CAAA,EAAkB,CAAC;EAE7B,MAAMC,UAAUA,CAAA,EAAkB,CAAC;EAEnC,MAAMC,aAAaA,CACjBC,OAA4B,EAC5BC,OAAgB,EACD,CAAC;EAElB,MAAMC,QAAQA,CAAA,EAAqB;IACjC,OAAO,IAAI,CAACX,QAAQ;EACtB;EAEAY,YAAYA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACb,aAAa;EAC3B;EAEAc,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB;IACA,OAAO;MACLC,MAAM,EAAEA,CAAA,KAAM,CAAC;IACjB,CAAC;EACH;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAIrB,2BAA2B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -8,17 +8,13 @@ exports.default = void 0;
|
|
|
8
8
|
/* eslint-disable no-useless-constructor */
|
|
9
9
|
/* eslint-disable @typescript-eslint/require-await */
|
|
10
10
|
|
|
11
|
-
/// Mock Manager for
|
|
11
|
+
/// Mock Manager for playback notifications. Does nothing.
|
|
12
12
|
class RecordingNotificationManager {
|
|
13
13
|
isRegistered_ = false;
|
|
14
14
|
isShown_ = false;
|
|
15
15
|
constructor() {}
|
|
16
|
-
async register() {}
|
|
17
16
|
async show(info) {}
|
|
18
|
-
async update(info) {}
|
|
19
17
|
async hide() {}
|
|
20
|
-
async unregister() {}
|
|
21
|
-
async enableControl(control, enabled) {}
|
|
22
18
|
async isActive() {
|
|
23
19
|
return this.isShown_;
|
|
24
20
|
}
|
|
@@ -31,7 +27,6 @@ class RecordingNotificationManager {
|
|
|
31
27
|
remove: () => {}
|
|
32
28
|
};
|
|
33
29
|
}
|
|
34
|
-
removeEventListener(subscription) {}
|
|
35
30
|
}
|
|
36
31
|
var _default = exports.default = new RecordingNotificationManager();
|
|
37
32
|
//# sourceMappingURL=RecordingNotificationManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RecordingNotificationManager","isRegistered_","isShown_","constructor","
|
|
1
|
+
{"version":3,"names":["RecordingNotificationManager","isRegistered_","isShown_","constructor","show","info","hide","isActive","isRegistered","addEventListener","eventName","callback","remove","_default","exports","default"],"sourceRoot":"../../../../src","sources":["web-system/notification/RecordingNotificationManager.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAUA;AACA,MAAMA,4BAA4B,CAMlC;EACUC,aAAa,GAAG,KAAK;EACrBC,QAAQ,GAAG,KAAK;EAExBC,WAAWA,CAAA,EAAG,CAAC;EAEf,MAAMC,IAAIA,CAACC,IAA+B,EAAiB,CAAC;EAE5D,MAAMC,IAAIA,CAAA,EAAkB,CAAC;EAE7B,MAAMC,QAAQA,CAAA,EAAqB;IACjC,OAAO,IAAI,CAACL,QAAQ;EACtB;EAEAM,YAAYA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACP,aAAa;EAC3B;EAEAQ,gBAAgBA,CACdC,SAAY,EACZC,QAAgD,EACxB;IACxB;IACA,OAAO;MACLC,MAAM,EAAEA,CAAA,KAAM,CAAC;IACjB,CAAC;EACH;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAIf,4BAA4B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { NativeAudioAPIModule } from "../specs/index.js";
|
|
4
|
+
import { AudioApiError } from "../errors/index.js";
|
|
4
5
|
class AudioAPIModule {
|
|
5
6
|
#workletsModule_ = null;
|
|
6
7
|
#canUseWorklets_ = false;
|
|
@@ -16,7 +17,7 @@ class AudioAPIModule {
|
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
if (!NativeAudioAPIModule) {
|
|
19
|
-
throw new
|
|
20
|
+
throw new AudioApiError(`Failed to install react-native-audio-api: The native module could not be found.`);
|
|
20
21
|
}
|
|
21
22
|
NativeAudioAPIModule.install();
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAudioAPIModule","AudioAPIModule","workletsModule_","canUseWorklets_","workletsVersion","workletsAvailable_","supportedWorkletsVersion","constructor","verifyWorklets","verifyInstallation","
|
|
1
|
+
{"version":3,"names":["NativeAudioAPIModule","AudioApiError","AudioAPIModule","workletsModule_","canUseWorklets_","workletsVersion","workletsAvailable_","supportedWorkletsVersion","constructor","verifyWorklets","verifyInstallation","install","#verifyWorklets","workletsPackage","require","workletsPackageJson","version","includes","#verifyInstallation","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","createAudioDecoder","createAudioStretcher","AudioEventEmitter","workletsModule","canUseWorklets","areWorkletsAvailable","isWorkletsVersionSupported","createAudioRuntime","createWorkletRuntime"],"sourceRoot":"../../../src","sources":["AudioAPIModule/AudioAPIModule.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,mBAAU;AAM/C,SAASC,aAAa,QAAQ,oBAAW;AAEzC,MAAMC,cAAc,CAA4B;EAC9C,CAACC,eAAe,GAA2B,IAAI;EAC/C,CAACC,eAAe,GAAG,KAAK;EACxB,CAACC,eAAe,GAAG,SAAS;EAC5B,CAACC,kBAAkB,GAAG,KAAK;EAEpBC,wBAAwB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;EAEtEC,WAAWA,CAAA,EAAG;IACZ;IACA;IACA;IACA,IAAI,CAAC,CAACC,cAAc,CAAC,CAAC;IAEtB,IAAI,IAAI,CAAC,CAACC,kBAAkB,CAAC,CAAC,EAAE;MAC9B;IACF;IAEA,IAAI,CAACV,oBAAoB,EAAE;MACzB,MAAM,IAAIC,aAAa,CACrB,iFACF,CAAC;IACH;IAEAD,oBAAoB,CAACW,OAAO,CAAC,CAAC;EAChC;EAEA,CAACF,cAAcG,CAAA,EAAY;IACzB,IAAI;MACF,MAAMC,eAAe,GAAGC,OAAO,CAAC,uBAAuB,CAAC;MACxD,MAAMC,mBAAmB,GAAGD,OAAO,CAAC,oCAAoC,CAAC;MACzE,IAAI,CAAC,CAACT,eAAe,GAAGU,mBAAmB,CAACC,OAAO;MACnD,IAAI,CAAC,CAACV,kBAAkB,GAAG,IAAI;MAE/B,IAAI,CAAC,CAACF,eAAe,GAAG,IA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;AACF;AAEA,eAAe,IAAI7B,cAAc,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/api.js
CHANGED
|
@@ -36,6 +36,7 @@ export * from "./types.js";
|
|
|
36
36
|
export { default as FilePreset } from "./utils/filePresets.js";
|
|
37
37
|
|
|
38
38
|
// Notification System
|
|
39
|
-
export { PlaybackNotificationManager
|
|
40
|
-
export {
|
|
39
|
+
export { PlaybackNotificationManager } from "./system/notification/index.js";
|
|
40
|
+
export { RecordingNotificationManager } from "./system/notification/index.js";
|
|
41
|
+
export { NotificationManager, PlaybackControlName, PlaybackNotificationEventName, PlaybackNotificationInfo } from "./system/notification/index.js";
|
|
41
42
|
//# sourceMappingURL=api.js.map
|
package/lib/module/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","AnalyserNode","AudioBuffer","AudioBufferQueueSourceNode","AudioBufferSourceNode","AudioContext","decodeAudioData","decodePCMInBase64","AudioDestinationNode","AudioNode","AudioParam","AudioRecorder","AudioScheduledSourceNode","changePlaybackSpeed","BaseAudioContext","BiquadFilterNode","ConstantSourceNode","ConvolverNode","DelayNode","GainNode","OfflineAudioContext","OscillatorNode","RecorderAdapterNode","StereoPannerNode","StreamerNode","WaveShaperNode","WorkletNode","WorkletProcessingNode","WorkletSourceNode","useSystemVolume","AudioManager","FilePreset","PlaybackNotificationManager","RecordingNotificationManager","NotificationManager","PlaybackControlName","PlaybackNotificationEventName","PlaybackNotificationInfo"
|
|
1
|
+
{"version":3,"names":["default","AnalyserNode","AudioBuffer","AudioBufferQueueSourceNode","AudioBufferSourceNode","AudioContext","decodeAudioData","decodePCMInBase64","AudioDestinationNode","AudioNode","AudioParam","AudioRecorder","AudioScheduledSourceNode","changePlaybackSpeed","BaseAudioContext","BiquadFilterNode","ConstantSourceNode","ConvolverNode","DelayNode","GainNode","OfflineAudioContext","OscillatorNode","RecorderAdapterNode","StereoPannerNode","StreamerNode","WaveShaperNode","WorkletNode","WorkletProcessingNode","WorkletSourceNode","useSystemVolume","AudioManager","FilePreset","PlaybackNotificationManager","RecordingNotificationManager","NotificationManager","PlaybackControlName","PlaybackNotificationEventName","PlaybackNotificationInfo"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;AAAA,OAAO,2BAAkB;AAEzB,SAASA,OAAO,IAAIC,YAAY,QAAQ,wBAAqB;AAC7D,SAASD,OAAO,IAAIE,WAAW,QAAQ,uBAAoB;AAC3D,SAASF,OAAO,IAAIG,0BAA0B,QAAQ,sCAAmC;AACzF,SAASH,OAAO,IAAII,qBAAqB,QAAQ,iCAA8B;AAC/E,SAASJ,OAAO,IAAIK,YAAY,QAAQ,wBAAqB;AAC7D,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,wBAAqB;AACxE,SAASP,OAAO,IAAIQ,oBAAoB,QAAQ,gCAA6B;AAC7E,SAASR,OAAO,IAAIS,SAAS,QAAQ,qBAAkB;AACvD,SAAST,OAAO,IAAIU,UAAU,QAAQ,sBAAmB;AACzD,SAASV,OAAO,IAAIW,aAAa,QAAQ,yBAAsB;AAC/D,SAASX,OAAO,IAAIY,wBAAwB,QAAQ,oCAAiC;AACrF,SAASZ,OAAO,IAAIa,mBAAmB,QAAQ,0BAAuB;AACtE,SAASb,OAAO,IAAIc,gBAAgB,QAAQ,4BAAyB;AACrE,SAASd,OAAO,IAAIe,gBAAgB,QAAQ,4BAAyB;AACrE,SAASf,OAAO,IAAIgB,kBAAkB,QAAQ,8BAA2B;AACzE,SAAShB,OAAO,IAAIiB,aAAa,QAAQ,yBAAsB;AAC/D,SAASjB,OAAO,IAAIkB,SAAS,QAAQ,qBAAkB;AACvD,SAASlB,OAAO,IAAImB,QAAQ,QAAQ,oBAAiB;AACrD,SAASnB,OAAO,IAAIoB,mBAAmB,QAAQ,+BAA4B;AAC3E,SAASpB,OAAO,IAAIqB,cAAc,QAAQ,0BAAuB;AACjE,SAASrB,OAAO,IAAIsB,mBAAmB,QAAQ,+BAA4B;AAC3E,SAAStB,OAAO,IAAIuB,gBAAgB,QAAQ,4BAAyB;AACrE,SAASvB,OAAO,IAAIwB,YAAY,QAAQ,wBAAqB;AAC7D,SAASxB,OAAO,IAAIyB,cAAc,QAAQ,0BAAuB;AACjE,SAASzB,OAAO,IAAI0B,WAAW,QAAQ,uBAAoB;AAC3D,SAAS1B,OAAO,IAAI2B,qBAAqB,QAAQ,iCAA8B;AAC/E,SAAS3B,OAAO,IAAI4B,iBAAiB,QAAQ,6BAA0B;AAEvE,SAAS5B,OAAO,IAAI6B,eAAe,QAAQ,4BAAyB;AACpE,SAAS7B,OAAO,IAAI8B,YAAY,QAAQ,mBAAU;AAElD,cAAc,mBAAU;AACxB,cAAc,mBAAgB;AAC9B,cAAc,YAAS;AACvB,SAAS9B,OAAO,IAAI+B,UAAU,QAAQ,wBAAqB;;AAE3D;AACA,SAASC,2BAA2B,QAAQ,gCAAuB;AACnE,SAASC,4BAA4B,QAAQ,gCAAuB;AAEpE,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,6BAA6B,EAC7BC,wBAAwB,QACnB,gCAAuB","ignoreList":[]}
|
|
@@ -1,40 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Image } from 'react-native';
|
|
4
|
+
import { isBase64Source, isDataBlobString, isRemoteSource } from "../utils/paths.js";
|
|
3
5
|
import AudioBuffer from "./AudioBuffer.js";
|
|
6
|
+
import { AudioApiError } from "../errors/index.js";
|
|
4
7
|
class AudioDecoder {
|
|
5
8
|
static instance = null;
|
|
6
9
|
constructor() {
|
|
7
10
|
this.decoder = global.createAudioDecoder();
|
|
8
11
|
}
|
|
12
|
+
async decodeAudioDataImplementation(input, sampleRate, fetchOptions) {
|
|
13
|
+
if (input instanceof ArrayBuffer) {
|
|
14
|
+
const buffer = await this.decoder.decodeWithMemoryBlock(new Uint8Array(input), sampleRate ?? 0);
|
|
15
|
+
return new AudioBuffer(buffer);
|
|
16
|
+
}
|
|
17
|
+
const stringSource = typeof input === 'number' ? Image.resolveAssetSource(input).uri : input;
|
|
18
|
+
|
|
19
|
+
// input is data:audio/...;base64,...
|
|
20
|
+
if (isBase64Source(stringSource)) {
|
|
21
|
+
throw new AudioApiError('Base64 source decoding is not currently supported, to decode raw PCM base64 strings use decodePCMInBase64 method.');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// input is blob:...
|
|
25
|
+
if (isDataBlobString(stringSource)) {
|
|
26
|
+
throw new AudioApiError('Data Blob string decoding is not currently supported.');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// input is http(s)://...
|
|
30
|
+
if (isRemoteSource(stringSource)) {
|
|
31
|
+
const arrayBuffer = await fetch(stringSource, fetchOptions).then(res => res.arrayBuffer());
|
|
32
|
+
const buffer = await this.decoder.decodeWithMemoryBlock(new Uint8Array(arrayBuffer), sampleRate ?? 0);
|
|
33
|
+
return new AudioBuffer(buffer);
|
|
34
|
+
}
|
|
35
|
+
if (!(typeof input === 'string')) {
|
|
36
|
+
throw new TypeError('Input must be a module, uri or ArrayBuffer');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Local file path
|
|
40
|
+
const filePath = stringSource.startsWith('file://') ? stringSource.replace('file://', '') : stringSource;
|
|
41
|
+
const buffer = await this.decoder.decodeWithFilePath(filePath, sampleRate ?? 0);
|
|
42
|
+
return new AudioBuffer(buffer);
|
|
43
|
+
}
|
|
9
44
|
static getInstance() {
|
|
10
45
|
if (!AudioDecoder.instance) {
|
|
11
46
|
AudioDecoder.instance = new AudioDecoder();
|
|
12
47
|
}
|
|
13
48
|
return AudioDecoder.instance;
|
|
14
49
|
}
|
|
15
|
-
async decodeAudioDataInstance(input, sampleRate) {
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
if (input.startsWith('file://')) {
|
|
20
|
-
input = input.replace('file://', '');
|
|
21
|
-
}
|
|
22
|
-
buffer = await this.decoder.decodeWithFilePath(input, sampleRate ?? 0);
|
|
23
|
-
} else if (input instanceof ArrayBuffer) {
|
|
24
|
-
buffer = await this.decoder.decodeWithMemoryBlock(new Uint8Array(input), sampleRate ?? 0);
|
|
25
|
-
}
|
|
26
|
-
if (!buffer) {
|
|
27
|
-
throw new Error('Unsupported input type or failed to decode audio');
|
|
50
|
+
async decodeAudioDataInstance(input, sampleRate, fetchOptions) {
|
|
51
|
+
const audioBuffer = await this.decodeAudioDataImplementation(input, sampleRate, fetchOptions);
|
|
52
|
+
if (!audioBuffer) {
|
|
53
|
+
throw new AudioApiError('Failed to decode audio data.');
|
|
28
54
|
}
|
|
29
|
-
return
|
|
55
|
+
return audioBuffer;
|
|
30
56
|
}
|
|
31
57
|
async decodePCMInBase64Instance(base64String, inputSampleRate, inputChannelCount, interleaved) {
|
|
32
58
|
const buffer = await this.decoder.decodeWithPCMInBase64(base64String, inputSampleRate, inputChannelCount, interleaved);
|
|
33
59
|
return new AudioBuffer(buffer);
|
|
34
60
|
}
|
|
35
61
|
}
|
|
36
|
-
export async function decodeAudioData(input, sampleRate) {
|
|
37
|
-
return AudioDecoder.getInstance().decodeAudioDataInstance(input, sampleRate);
|
|
62
|
+
export async function decodeAudioData(input, sampleRate, fetchOptions) {
|
|
63
|
+
return AudioDecoder.getInstance().decodeAudioDataInstance(input, sampleRate, fetchOptions);
|
|
38
64
|
}
|
|
39
65
|
export async function decodePCMInBase64(base64String, inputSampleRate, inputChannelCount, isInterleaved = true) {
|
|
40
66
|
return AudioDecoder.getInstance().decodePCMInBase64Instance(base64String, inputSampleRate, inputChannelCount, isInterleaved);
|