react-native-audio-api 0.7.0-nightly-74078ac-20250729 → 0.7.0-nightly-cec6d21-20250731
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/AudioDecoder.cpp +4 -2
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +14 -4
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.h +4 -2
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +4 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +4 -0
- package/android/src/oldarch/NativeAudioAPIModuleSpec.java +4 -0
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.h +0 -10
- package/common/cpp/audioapi/core/AudioContext.cpp +17 -10
- package/common/cpp/audioapi/core/AudioContext.h +3 -0
- package/common/cpp/audioapi/core/AudioParam.cpp +4 -5
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +11 -3
- package/common/cpp/audioapi/core/BaseAudioContext.h +2 -0
- package/common/cpp/audioapi/core/OfflineAudioContext.cpp +4 -0
- package/common/cpp/audioapi/core/OfflineAudioContext.h +2 -0
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +0 -1
- package/ios/audioapi/ios/AudioAPIModule.mm +13 -11
- package/ios/audioapi/ios/core/IOSAudioPlayer.h +5 -2
- package/ios/audioapi/ios/core/IOSAudioPlayer.mm +20 -10
- package/ios/audioapi/ios/core/NativeAudioPlayer.h +2 -2
- package/ios/audioapi/ios/core/NativeAudioPlayer.m +7 -2
- package/ios/audioapi/ios/core/NativeAudioRecorder.m +2 -0
- package/ios/audioapi/ios/system/AudioEngine.h +13 -2
- package/ios/audioapi/ios/system/AudioEngine.mm +108 -32
- package/ios/audioapi/ios/system/AudioSessionManager.h +1 -0
- package/ios/audioapi/ios/system/AudioSessionManager.mm +6 -0
- package/ios/audioapi/ios/system/NotificationManager.h +3 -0
- package/ios/audioapi/ios/system/NotificationManager.mm +145 -41
- package/lib/commonjs/core/AudioContext.js +3 -3
- package/lib/commonjs/core/AudioContext.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/system/AudioManager.js +17 -0
- package/lib/commonjs/system/AudioManager.js.map +1 -1
- package/lib/module/core/AudioContext.js +3 -3
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/system/AudioManager.js +17 -0
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts +3 -3
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +3 -3
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +1 -0
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts +14 -0
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/AudioContext.ts +6 -6
- package/src/interfaces.ts +3 -3
- package/src/specs/NativeAudioAPIModule.ts +1 -0
- package/src/system/AudioManager.ts +17 -0
|
@@ -13,6 +13,8 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
13
13
|
- (instancetype)initWithAudioSessionManager:(AudioSessionManager *)sessionManager
|
|
14
14
|
{
|
|
15
15
|
if (self = [super init]) {
|
|
16
|
+
self.isInterrupted = false;
|
|
17
|
+
self.isSupposedToBeRunning = true;
|
|
16
18
|
self.audioEngine = [[AVAudioEngine alloc] init];
|
|
17
19
|
self.inputNode = nil;
|
|
18
20
|
|
|
@@ -45,12 +47,8 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
45
47
|
self.sessionManager = nil;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
- (
|
|
50
|
+
- (void)rebuildAudioEngine
|
|
49
51
|
{
|
|
50
|
-
if ([self.audioEngine isRunning]) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
52
|
for (id sourceNodeId in self.sourceNodes) {
|
|
55
53
|
AVAudioSourceNode *sourceNode = [self.sourceNodes valueForKey:sourceNodeId];
|
|
56
54
|
AVAudioFormat *format = [self.sourceFormats valueForKey:sourceNodeId];
|
|
@@ -63,10 +61,12 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
63
61
|
[self.audioEngine attachNode:self.inputNode];
|
|
64
62
|
[self.audioEngine connect:self.audioEngine.inputNode to:self.inputNode format:nil];
|
|
65
63
|
}
|
|
64
|
+
}
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
- (bool)rebuildAudioEngineAndStartIfNecessary
|
|
67
|
+
{
|
|
68
|
+
[self rebuildAudioEngine];
|
|
69
|
+
return [self startIfNecessary];
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
- (bool)restartAudioEngine
|
|
@@ -74,25 +74,45 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
74
74
|
if ([self.audioEngine isRunning]) {
|
|
75
75
|
[self.audioEngine stop];
|
|
76
76
|
}
|
|
77
|
+
|
|
77
78
|
self.audioEngine = [[AVAudioEngine alloc] init];
|
|
78
|
-
return [self
|
|
79
|
+
return [self rebuildAudioEngineAndStartIfNecessary];
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
- (
|
|
82
|
+
- (bool)startEngine
|
|
82
83
|
{
|
|
83
84
|
NSLog(@"[AudioEngine] startEngine");
|
|
84
85
|
NSError *error = nil;
|
|
86
|
+
self.isSupposedToBeRunning = true;
|
|
85
87
|
|
|
86
|
-
if ([self.audioEngine isRunning]) {
|
|
87
|
-
|
|
88
|
+
if ([self.audioEngine isRunning] && ![self isInterrupted]) {
|
|
89
|
+
NSLog(@"[AudioEngine] Engine is already running");
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (![self.sessionManager setActive:true]) {
|
|
94
|
+
return false;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
[self
|
|
97
|
+
if ([self isInterrupted]) {
|
|
98
|
+
NSLog(@"[AudioEngine] rebuilding after interruption");
|
|
99
|
+
[self.audioEngine stop];
|
|
100
|
+
[self.audioEngine reset];
|
|
101
|
+
|
|
102
|
+
[self rebuildAudioEngine];
|
|
103
|
+
|
|
104
|
+
self.isInterrupted = false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[self.audioEngine prepare];
|
|
91
108
|
[self.audioEngine startAndReturnError:&error];
|
|
92
109
|
|
|
93
110
|
if (error != nil) {
|
|
94
111
|
NSLog(@"Error while starting the audio engine: %@", [error debugDescription]);
|
|
112
|
+
return false;
|
|
95
113
|
}
|
|
114
|
+
|
|
115
|
+
return true;
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
- (void)stopEngine
|
|
@@ -102,11 +122,15 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
102
122
|
return;
|
|
103
123
|
}
|
|
104
124
|
|
|
125
|
+
self.isSupposedToBeRunning = false;
|
|
105
126
|
[self.audioEngine stop];
|
|
106
127
|
}
|
|
107
128
|
|
|
108
129
|
- (void)pauseEngine:(NSString *)sourceNodeId
|
|
109
130
|
{
|
|
131
|
+
NSLog(@"[AudioEngine] pauseEngine");
|
|
132
|
+
self.isSupposedToBeRunning = false;
|
|
133
|
+
|
|
110
134
|
if (![self.audioEngine isRunning]) {
|
|
111
135
|
return;
|
|
112
136
|
}
|
|
@@ -117,7 +141,18 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
117
141
|
|
|
118
142
|
- (bool)isRunning
|
|
119
143
|
{
|
|
120
|
-
return [self.audioEngine isRunning];
|
|
144
|
+
return [self.audioEngine isRunning] && !self.isInterrupted;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
- (void)markAsInterrupted
|
|
148
|
+
{
|
|
149
|
+
self.isInterrupted = true;
|
|
150
|
+
self.isSupposedToBeRunning = false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
- (void)unmarkAsInterrupted
|
|
154
|
+
{
|
|
155
|
+
self.isInterrupted = false;
|
|
121
156
|
}
|
|
122
157
|
|
|
123
158
|
- (NSString *)attachSourceNode:(AVAudioSourceNode *)sourceNode format:(AVAudioFormat *)format
|
|
@@ -132,7 +167,6 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
132
167
|
[self.audioEngine attachNode:sourceNode];
|
|
133
168
|
[self.audioEngine connect:sourceNode to:self.audioEngine.mainMixerNode format:format];
|
|
134
169
|
|
|
135
|
-
[self startIfNecessary];
|
|
136
170
|
return sourceNodeId;
|
|
137
171
|
}
|
|
138
172
|
|
|
@@ -142,15 +176,16 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
142
176
|
|
|
143
177
|
AVAudioSourceNode *sourceNode = [self.sourceNodes valueForKey:sourceNodeId];
|
|
144
178
|
|
|
145
|
-
if (sourceNode
|
|
146
|
-
[
|
|
147
|
-
|
|
148
|
-
[self.sourceNodes removeObjectForKey:sourceNodeId];
|
|
149
|
-
[self.sourceFormats removeObjectForKey:sourceNodeId];
|
|
150
|
-
[self.sourceStates removeObjectForKey:sourceNodeId];
|
|
179
|
+
if (sourceNode == nil) {
|
|
180
|
+
NSLog(@"[AudioEngine] No source node found with ID: %@", sourceNodeId);
|
|
181
|
+
return;
|
|
151
182
|
}
|
|
152
183
|
|
|
153
|
-
[self
|
|
184
|
+
[self.audioEngine detachNode:sourceNode];
|
|
185
|
+
|
|
186
|
+
[self.sourceNodes removeObjectForKey:sourceNodeId];
|
|
187
|
+
[self.sourceFormats removeObjectForKey:sourceNodeId];
|
|
188
|
+
[self.sourceStates removeObjectForKey:sourceNodeId];
|
|
154
189
|
}
|
|
155
190
|
|
|
156
191
|
- (void)attachInputNode:(AVAudioSinkNode *)inputNode
|
|
@@ -159,29 +194,29 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
159
194
|
|
|
160
195
|
[self.audioEngine attachNode:inputNode];
|
|
161
196
|
[self.audioEngine connect:self.audioEngine.inputNode to:inputNode format:nil];
|
|
162
|
-
|
|
163
|
-
[self startIfNecessary];
|
|
164
197
|
}
|
|
165
198
|
|
|
166
199
|
- (void)detachInputNode
|
|
167
200
|
{
|
|
168
|
-
if (self.inputNode
|
|
169
|
-
|
|
170
|
-
self.inputNode = nil;
|
|
201
|
+
if (self.inputNode == nil) {
|
|
202
|
+
return;
|
|
171
203
|
}
|
|
172
204
|
|
|
173
|
-
[self
|
|
205
|
+
[self.audioEngine detachNode:self.inputNode];
|
|
206
|
+
self.inputNode = nil;
|
|
174
207
|
}
|
|
175
208
|
|
|
176
|
-
- (
|
|
209
|
+
- (bool)startIfNecessary
|
|
177
210
|
{
|
|
178
211
|
if ([self isRunning]) {
|
|
179
|
-
return;
|
|
212
|
+
return true;
|
|
180
213
|
}
|
|
181
214
|
|
|
182
215
|
if ([self.sourceNodes count] > 0 || self.inputNode != nil) {
|
|
183
|
-
[self startEngine];
|
|
216
|
+
return [self startEngine];
|
|
184
217
|
}
|
|
218
|
+
|
|
219
|
+
return false;
|
|
185
220
|
}
|
|
186
221
|
|
|
187
222
|
- (void)stopIfNecessary
|
|
@@ -203,7 +238,7 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
203
238
|
|
|
204
239
|
for (NSString *sourceId in self.sourceStates) {
|
|
205
240
|
if ([self.sourceStates[sourceId] boolValue]) {
|
|
206
|
-
NSLog(@"state
|
|
241
|
+
NSLog(@"state %@", self.sourceStates[sourceId]);
|
|
207
242
|
return;
|
|
208
243
|
}
|
|
209
244
|
}
|
|
@@ -212,4 +247,45 @@ static AudioEngine *_sharedInstance = nil;
|
|
|
212
247
|
[self.audioEngine pause];
|
|
213
248
|
}
|
|
214
249
|
|
|
250
|
+
- (void)logAudioEngineState
|
|
251
|
+
{
|
|
252
|
+
AVAudioSession *session = [AVAudioSession sharedInstance];
|
|
253
|
+
|
|
254
|
+
NSLog(@"================ 🎧 AVAudioEngine STATE ================");
|
|
255
|
+
|
|
256
|
+
// AVAudioEngine state
|
|
257
|
+
NSLog(@"➡️ engine.isRunning: %@", self.audioEngine.isRunning ? @"YES" : @"NO");
|
|
258
|
+
NSLog(@"➡️ engine.isInManualRenderingMode: %@", self.audioEngine.isInManualRenderingMode ? @"YES" : @"NO");
|
|
259
|
+
|
|
260
|
+
// Session state
|
|
261
|
+
NSLog(@"🎚️ Session category: %@", session.category);
|
|
262
|
+
NSLog(@"🎚️ Session mode: %@", session.mode);
|
|
263
|
+
NSLog(@"🎚️ Session sampleRate: %f Hz", session.sampleRate);
|
|
264
|
+
NSLog(@"🎚️ Session IO buffer duration: %f s", session.IOBufferDuration);
|
|
265
|
+
|
|
266
|
+
// Current route
|
|
267
|
+
AVAudioSessionRouteDescription *route = session.currentRoute;
|
|
268
|
+
|
|
269
|
+
NSLog(@"🔊 Current audio route outputs:");
|
|
270
|
+
for (AVAudioSessionPortDescription *output in route.outputs) {
|
|
271
|
+
NSLog(@" Output: %@ (%@)", output.portType, output.portName);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
NSLog(@"🎤 Current audio route inputs:");
|
|
275
|
+
for (AVAudioSessionPortDescription *input in route.inputs) {
|
|
276
|
+
NSLog(@" Input: %@ (%@)", input.portType, input.portName);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Output node format
|
|
280
|
+
AVAudioFormat *format = [self.audioEngine.outputNode inputFormatForBus:0];
|
|
281
|
+
NSLog(@"📐 Engine output format: %.0f Hz, %u channels", format.sampleRate, format.channelCount);
|
|
282
|
+
|
|
283
|
+
NSLog(@"=======================================================");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
- (bool)isSupposedToRun
|
|
287
|
+
{
|
|
288
|
+
return self.isSupposedToBeRunning;
|
|
289
|
+
}
|
|
290
|
+
|
|
215
291
|
@end
|
|
@@ -205,6 +205,12 @@
|
|
|
205
205
|
return true;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
- (void)markSettingsAsDirty
|
|
209
|
+
{
|
|
210
|
+
self.hasDirtySettings = true;
|
|
211
|
+
self.isActive = false;
|
|
212
|
+
}
|
|
213
|
+
|
|
208
214
|
- (void)requestRecordingPermissions:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
209
215
|
{
|
|
210
216
|
if (@available(iOS 17, *)) {
|
|
@@ -11,14 +11,17 @@
|
|
|
11
11
|
@property (nonatomic, weak) NSNotificationCenter *notificationCenter;
|
|
12
12
|
|
|
13
13
|
@property (nonatomic, assign) bool isInterrupted;
|
|
14
|
+
@property (nonatomic, strong) NSTimer *hintPollingTimer;
|
|
14
15
|
@property (nonatomic, assign) bool hadConfigurationChange;
|
|
15
16
|
@property (nonatomic, assign) bool audioInterruptionsObserved;
|
|
16
17
|
@property (nonatomic, assign) bool volumeChangesObserved;
|
|
18
|
+
@property (nonatomic, assign) bool wasOtherAudioPlaying;
|
|
17
19
|
|
|
18
20
|
- (instancetype)initWithAudioAPIModule:(AudioAPIModule *)audioAPIModule;
|
|
19
21
|
- (void)cleanup;
|
|
20
22
|
|
|
21
23
|
- (void)observeAudioInterruptions:(BOOL)enabled;
|
|
24
|
+
- (void)activelyReclaimSession:(BOOL)enabled;
|
|
22
25
|
- (void)observeVolumeChanges:(BOOL)enabled;
|
|
23
26
|
- (void)observeValueForKeyPath:(NSString *)keyPath
|
|
24
27
|
ofObject:(id)object
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
@implementation NotificationManager
|
|
7
7
|
|
|
8
|
-
static NSString *
|
|
8
|
+
static NSString *NotificationManagerContext = @"NotificationManagerContext";
|
|
9
9
|
|
|
10
10
|
- (instancetype)initWithAudioAPIModule:(AudioAPIModule *)audioAPIModule
|
|
11
11
|
{
|
|
@@ -16,6 +16,7 @@ static NSString *VolumeObservationContext = @"VolumeObservationContext";
|
|
|
16
16
|
|
|
17
17
|
[self configureNotifications];
|
|
18
18
|
}
|
|
19
|
+
|
|
19
20
|
return self;
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -28,20 +29,24 @@ static NSString *VolumeObservationContext = @"VolumeObservationContext";
|
|
|
28
29
|
|
|
29
30
|
- (void)observeAudioInterruptions:(BOOL)enabled
|
|
30
31
|
{
|
|
31
|
-
|
|
32
|
+
self.audioInterruptionsObserved = enabled;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (void)activelyReclaimSession:(BOOL)enabled
|
|
36
|
+
{
|
|
37
|
+
if (!enabled) {
|
|
38
|
+
[self stopPollingSecondaryAudioHint];
|
|
39
|
+
|
|
40
|
+
[self.notificationCenter removeObserver:self name:AVAudioSessionSilenceSecondaryAudioHintNotification object:nil];
|
|
32
41
|
return;
|
|
33
42
|
}
|
|
34
43
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
object:nil];
|
|
40
|
-
} else {
|
|
41
|
-
[self.notificationCenter removeObserver:self name:AVAudioSessionInterruptionNotification object:nil];
|
|
42
|
-
}
|
|
44
|
+
[self.notificationCenter addObserver:self
|
|
45
|
+
selector:@selector(handleSecondaryAudio:)
|
|
46
|
+
name:AVAudioSessionSilenceSecondaryAudioHintNotification
|
|
47
|
+
object:nil];
|
|
43
48
|
|
|
44
|
-
self
|
|
49
|
+
[self startPollingSecondaryAudioHint];
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
// WARNING: this does not work in a simulator environment, test it on a real device
|
|
@@ -55,23 +60,12 @@ static NSString *VolumeObservationContext = @"VolumeObservationContext";
|
|
|
55
60
|
[[AVAudioSession sharedInstance] addObserver:self
|
|
56
61
|
forKeyPath:@"outputVolume"
|
|
57
62
|
options:NSKeyValueObservingOptionNew
|
|
58
|
-
context:(void *)&
|
|
63
|
+
context:(void *)&NotificationManagerContext];
|
|
59
64
|
} else {
|
|
60
65
|
[[AVAudioSession sharedInstance] removeObserver:self forKeyPath:@"outputVolume" context:nil];
|
|
61
66
|
}
|
|
62
|
-
self.volumeChangesObserved = enabled;
|
|
63
|
-
}
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
ofObject:(id)object
|
|
67
|
-
change:(NSDictionary *)change
|
|
68
|
-
context:(void *)context
|
|
69
|
-
{
|
|
70
|
-
if ([keyPath isEqualToString:@"outputVolume"] && context == &VolumeObservationContext) {
|
|
71
|
-
NSDictionary *body = @{@"value" : [NSNumber numberWithFloat:[change[@"new"] floatValue]]};
|
|
72
|
-
|
|
73
|
-
[self.audioAPIModule invokeHandlerWithEventName:@"volumeChange" eventBody:body];
|
|
74
|
-
}
|
|
68
|
+
self.volumeChangesObserved = enabled;
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
- (void)configureNotifications
|
|
@@ -88,34 +82,96 @@ static NSString *VolumeObservationContext = @"VolumeObservationContext";
|
|
|
88
82
|
selector:@selector(handleEngineConfigurationChange:)
|
|
89
83
|
name:AVAudioEngineConfigurationChangeNotification
|
|
90
84
|
object:nil];
|
|
85
|
+
[self.notificationCenter addObserver:self
|
|
86
|
+
selector:@selector(handleInterruption:)
|
|
87
|
+
name:AVAudioSessionInterruptionNotification
|
|
88
|
+
object:nil];
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
- (void)
|
|
91
|
+
- (void)observeValueForKeyPath:(NSString *)keyPath
|
|
92
|
+
ofObject:(id)object
|
|
93
|
+
change:(NSDictionary *)change
|
|
94
|
+
context:(void *)context
|
|
94
95
|
{
|
|
95
|
-
if (
|
|
96
|
+
if (context != &NotificationManagerContext) {
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
if ([keyPath isEqualToString:@"outputVolume"]) {
|
|
101
|
+
NSDictionary *body = @{@"value" : [NSNumber numberWithFloat:[change[@"new"] floatValue]]};
|
|
102
|
+
if (self.volumeChangesObserved) {
|
|
103
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"volumeChange" eventBody:body];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void)handleInterruption:(NSNotification *)notification
|
|
109
|
+
{
|
|
110
|
+
AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
|
|
99
111
|
NSInteger interruptionType = [notification.userInfo[AVAudioSessionInterruptionTypeKey] integerValue];
|
|
100
112
|
NSInteger interruptionOption = [notification.userInfo[AVAudioSessionInterruptionOptionKey] integerValue];
|
|
101
113
|
|
|
102
114
|
if (interruptionType == AVAudioSessionInterruptionTypeBegan) {
|
|
103
|
-
|
|
115
|
+
[audioEngine markAsInterrupted];
|
|
116
|
+
|
|
117
|
+
if (self.audioInterruptionsObserved) {
|
|
118
|
+
NSDictionary *body = @{@"type" : @"began", @"shouldResume" : @false};
|
|
119
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
120
|
+
}
|
|
104
121
|
|
|
105
|
-
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
106
122
|
return;
|
|
107
123
|
}
|
|
108
124
|
|
|
109
125
|
if (interruptionOption == AVAudioSessionInterruptionOptionShouldResume) {
|
|
110
|
-
|
|
126
|
+
[audioEngine unmarkAsInterrupted];
|
|
127
|
+
|
|
128
|
+
if (self.audioInterruptionsObserved) {
|
|
129
|
+
NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @true};
|
|
130
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
111
135
|
|
|
136
|
+
if (self.audioInterruptionsObserved) {
|
|
137
|
+
NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @false};
|
|
112
138
|
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
- (void)handleSecondaryAudio:(NSNotification *)notification
|
|
143
|
+
{
|
|
144
|
+
AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
|
|
145
|
+
NSInteger secondaryAudioType = [notification.userInfo[AVAudioSessionSilenceSecondaryAudioHintTypeKey] integerValue];
|
|
146
|
+
|
|
147
|
+
NSLog(@"handleSecondaryAudio");
|
|
148
|
+
|
|
149
|
+
if (secondaryAudioType == AVAudioSessionSilenceSecondaryAudioHintTypeBegin) {
|
|
150
|
+
[audioEngine markAsInterrupted];
|
|
151
|
+
|
|
152
|
+
if (self.audioInterruptionsObserved) {
|
|
153
|
+
NSDictionary *body = @{@"type" : @"began", @"shouldResume" : @false};
|
|
154
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
155
|
+
}
|
|
156
|
+
|
|
113
157
|
return;
|
|
114
158
|
}
|
|
115
159
|
|
|
116
|
-
|
|
160
|
+
if (secondaryAudioType == AVAudioSessionSilenceSecondaryAudioHintTypeEnd) {
|
|
161
|
+
[audioEngine unmarkAsInterrupted];
|
|
162
|
+
|
|
163
|
+
if (self.audioInterruptionsObserved) {
|
|
164
|
+
NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @true};
|
|
165
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
117
170
|
|
|
118
|
-
|
|
171
|
+
if (self.audioInterruptionsObserved) {
|
|
172
|
+
NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @false};
|
|
173
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
174
|
+
}
|
|
119
175
|
}
|
|
120
176
|
|
|
121
177
|
- (void)handleRouteChange:(NSNotification *)notification
|
|
@@ -171,23 +227,71 @@ static NSString *VolumeObservationContext = @"VolumeObservationContext";
|
|
|
171
227
|
- (void)handleEngineConfigurationChange:(NSNotification *)notification
|
|
172
228
|
{
|
|
173
229
|
AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
|
|
230
|
+
AudioSessionManager *sessionManager = self.audioAPIModule.audioSessionManager;
|
|
174
231
|
|
|
175
|
-
if (![audioEngine
|
|
176
|
-
NSLog(
|
|
177
|
-
|
|
178
|
-
self.hadConfigurationChange = true;
|
|
232
|
+
if (![audioEngine isSupposedToBeRunning]) {
|
|
233
|
+
NSLog(@"[NotificationManager] detected engine configuration change when engine is not running");
|
|
234
|
+
[sessionManager markSettingsAsDirty];
|
|
179
235
|
return;
|
|
180
236
|
}
|
|
181
237
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
238
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
239
|
+
[sessionManager markSettingsAsDirty];
|
|
240
|
+
[audioEngine rebuildAudioEngineAndStartIfNecessary];
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
- (void)startPollingSecondaryAudioHint
|
|
245
|
+
{
|
|
246
|
+
if (self.hintPollingTimer) {
|
|
247
|
+
[self.hintPollingTimer invalidate];
|
|
248
|
+
self.hintPollingTimer = nil;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
self.wasOtherAudioPlaying = false;
|
|
252
|
+
self.hintPollingTimer = [NSTimer scheduledTimerWithTimeInterval:0.5
|
|
253
|
+
target:self
|
|
254
|
+
selector:@selector(checkSecondaryAudioHint)
|
|
255
|
+
userInfo:nil
|
|
256
|
+
repeats:YES];
|
|
257
|
+
|
|
258
|
+
[[NSRunLoop mainRunLoop] addTimer:self.hintPollingTimer forMode:NSRunLoopCommonModes];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
- (void)stopPollingSecondaryAudioHint
|
|
262
|
+
{
|
|
263
|
+
[self.hintPollingTimer invalidate];
|
|
264
|
+
self.hintPollingTimer = nil;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
- (void)checkSecondaryAudioHint
|
|
268
|
+
{
|
|
269
|
+
BOOL shouldSilence = [AVAudioSession sharedInstance].secondaryAudioShouldBeSilencedHint;
|
|
270
|
+
|
|
271
|
+
if (shouldSilence == self.wasOtherAudioPlaying) {
|
|
185
272
|
return;
|
|
186
273
|
}
|
|
187
274
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
275
|
+
AudioEngine *audioEngine = self.audioAPIModule.audioEngine;
|
|
276
|
+
self.wasOtherAudioPlaying = shouldSilence;
|
|
277
|
+
|
|
278
|
+
if (shouldSilence) {
|
|
279
|
+
[audioEngine markAsInterrupted];
|
|
280
|
+
NSDictionary *body = @{@"type" : @"began", @"shouldResume" : @false};
|
|
281
|
+
|
|
282
|
+
if (self.audioInterruptionsObserved) {
|
|
283
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
[audioEngine unmarkAsInterrupted];
|
|
290
|
+
NSDictionary *body = @{@"type" : @"ended", @"shouldResume" : @true};
|
|
291
|
+
|
|
292
|
+
if (self.audioInterruptionsObserved) {
|
|
293
|
+
[self.audioAPIModule invokeHandlerWithEventName:@"interruption" eventBody:body];
|
|
294
|
+
}
|
|
191
295
|
}
|
|
192
296
|
|
|
193
297
|
@end
|
|
@@ -16,13 +16,13 @@ class AudioContext extends _BaseAudioContext.default {
|
|
|
16
16
|
super(global.createAudioContext(options?.sampleRate || _system.default.getDevicePreferredSampleRate(), options?.initSuspended || false));
|
|
17
17
|
}
|
|
18
18
|
async close() {
|
|
19
|
-
|
|
19
|
+
return this.context.close();
|
|
20
20
|
}
|
|
21
21
|
async resume() {
|
|
22
|
-
|
|
22
|
+
return this.context.resume();
|
|
23
23
|
}
|
|
24
24
|
async suspend() {
|
|
25
|
-
|
|
25
|
+
return this.context.suspend();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.default = AudioContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_BaseAudioContext","_interopRequireDefault","require","_system","_errors","e","__esModule","default","AudioContext","BaseAudioContext","constructor","options","sampleRate","NotSupportedError","global","createAudioContext","AudioManager","getDevicePreferredSampleRate","initSuspended","close","context","resume","suspend","exports"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAA8C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/B,MAAMG,YAAY,SAASC,yBAAgB,CAAC;EACzDC,WAAWA,CAACC,OAA6B,EAAE;IACzC,IACEA,OAAO,IACPA,OAAO,CAACC,UAAU,KACjBD,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EACzD;MACA,MAAM,IAAIC,yBAAiB,CACzB,6CAA6CF,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IAEA,KAAK,CACHE,MAAM,CAACC,kBAAkB,CACvBJ,OAAO,EAAEC,UAAU,IAAII,eAAY,CAACC,4BAA4B,CAAC,CAAC,EAClEN,OAAO,EAAEO,aAAa,IAAI,KAC5B,CACF,CAAC;EACH;EAEA,MAAMC,KAAKA,CAAA,
|
|
1
|
+
{"version":3,"names":["_BaseAudioContext","_interopRequireDefault","require","_system","_errors","e","__esModule","default","AudioContext","BaseAudioContext","constructor","options","sampleRate","NotSupportedError","global","createAudioContext","AudioManager","getDevicePreferredSampleRate","initSuspended","close","context","resume","suspend","exports"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAA8C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/B,MAAMG,YAAY,SAASC,yBAAgB,CAAC;EACzDC,WAAWA,CAACC,OAA6B,EAAE;IACzC,IACEA,OAAO,IACPA,OAAO,CAACC,UAAU,KACjBD,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EACzD;MACA,MAAM,IAAIC,yBAAiB,CACzB,6CAA6CF,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IAEA,KAAK,CACHE,MAAM,CAACC,kBAAkB,CACvBJ,OAAO,EAAEC,UAAU,IAAII,eAAY,CAACC,4BAA4B,CAAC,CAAC,EAClEN,OAAO,EAAEO,aAAa,IAAI,KAC5B,CACF,CAAC;EACH;EAEA,MAAMC,KAAKA,CAAA,EAAqB;IAC9B,OAAQ,IAAI,CAACC,OAAO,CAAmBD,KAAK,CAAC,CAAC;EAChD;EAEA,MAAME,MAAMA,CAAA,EAAqB;IAC/B,OAAQ,IAAI,CAACD,OAAO,CAAmBC,MAAM,CAAC,CAAC;EACjD;EAEA,MAAMC,OAAOA,CAAA,EAAqB;IAChC,OAAQ,IAAI,CAACF,OAAO,CAAmBE,OAAO,CAAC,CAAC;EAClD;AACF;AAACC,OAAA,CAAAhB,OAAA,GAAAC,YAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Object","defineProperty","exports","value","NativeAudioAPIModule","_reactNative","require","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,oBAAA;AACb,IAAAC,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["Object","defineProperty","exports","value","NativeAudioAPIModule","_reactNative","require","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,oBAAA;AACb,IAAAC,YAAA,GAAAC,OAAA;AAqCA,MAAMF,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAAGG,gCAAmB,CAACC,GAAG,CAAO,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -34,6 +34,23 @@ class AudioManager {
|
|
|
34
34
|
observeAudioInterruptions(enabled) {
|
|
35
35
|
_specs.NativeAudioAPIModule.observeAudioInterruptions(enabled);
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param enabled - Whether to actively reclaim the session or not
|
|
40
|
+
* @experimental more aggressively try to reactivate the audio session during interruptions.
|
|
41
|
+
* It is subject to change in the future and might be removed.
|
|
42
|
+
*
|
|
43
|
+
* In some cases (depends on app session settings and other apps using audio) system may never
|
|
44
|
+
* send the `interruption ended` event. This method will check if any other audio is playing
|
|
45
|
+
* and try to reactivate the audio session, as soon as there is "silence".
|
|
46
|
+
* Although this might change the expected behavior.
|
|
47
|
+
*
|
|
48
|
+
* Internally method uses `AVAudioSessionSilenceSecondaryAudioHintNotification` as well as
|
|
49
|
+
* interval polling to check if other audio is playing.
|
|
50
|
+
*/
|
|
51
|
+
activelyReclaimSession(enabled) {
|
|
52
|
+
_specs.NativeAudioAPIModule.activelyReclaimSession(enabled);
|
|
53
|
+
}
|
|
37
54
|
observeVolumeChanges(enabled) {
|
|
38
55
|
_specs.NativeAudioAPIModule.observeVolumeChanges(enabled);
|
|
39
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_specs","require","_events","global","AudioEventEmitter","NativeAudioAPIModule","Error","install","AudioManager","constructor","audioEventEmitter","getDevicePreferredSampleRate","setAudioSessionActivity","enabled","setAudioSessionOptions","options","iosCategory","iosMode","iosOptions","iosAllowHaptics","setLockScreenInfo","info","resetLockScreenInfo","observeAudioInterruptions","observeVolumeChanges","enableRemoteCommand","name","addSystemEventListener","callback","addAudioEventListener","requestRecordingPermissions","checkRecordingPermissions","getDevicesInfo","_default","exports","default"],"sourceRoot":"../../../src","sources":["system/AudioManager.ts"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAIE,MAAM,CAACC,iBAAiB,IAAI,IAAI,EAAE;EACpC,IAAI,CAACC,2BAAoB,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,iFACF,CAAC;EACH;EAEAD,2BAAoB,CAACE,OAAO,CAAC,CAAC;AAChC;AAEA,MAAMC,YAAY,CAAC;EAEjBC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIN,yBAAiB,CAACD,MAAM,CAACC,iBAAiB,CAAC;EAC1E;EAEAO,4BAA4BA,CAAA,EAAW;IACrC,OAAON,2BAAoB,CAAEM,4BAA4B,CAAC,CAAC;EAC7D;EAEAC,uBAAuBA,CAACC,OAAgB,EAAoB;IAC1D,OAAOR,2BAAoB,CAAEO,uBAAuB,CAACC,OAAO,CAAC;EAC/D;EAEAC,sBAAsBA,CAACC,OAAuB,EAAE;IAC9CV,2BAAoB,CAAES,sBAAsB,CAC1CC,OAAO,CAACC,WAAW,IAAI,EAAE,EACzBD,OAAO,CAACE,OAAO,IAAI,EAAE,EACrBF,OAAO,CAACG,UAAU,IAAI,EAAE,EACxBH,OAAO,CAACI,eAAe,IAAI,KAC7B,CAAC;EACH;EAEAC,iBAAiBA,CAACC,IAAoB,EAAE;IACtChB,2BAAoB,CAAEe,iBAAiB,CAACC,IAAI,CAAC;EAC/C;EAEAC,mBAAmBA,CAAA,EAAG;IACpBjB,2BAAoB,CAAEiB,mBAAmB,CAAC,CAAC;EAC7C;EAEAC,yBAAyBA,CAACV,OAAgB,EAAE;IAC1CR,2BAAoB,CAAEkB,yBAAyB,CAACV,OAAO,CAAC;EAC1D;
|
|
1
|
+
{"version":3,"names":["_specs","require","_events","global","AudioEventEmitter","NativeAudioAPIModule","Error","install","AudioManager","constructor","audioEventEmitter","getDevicePreferredSampleRate","setAudioSessionActivity","enabled","setAudioSessionOptions","options","iosCategory","iosMode","iosOptions","iosAllowHaptics","setLockScreenInfo","info","resetLockScreenInfo","observeAudioInterruptions","activelyReclaimSession","observeVolumeChanges","enableRemoteCommand","name","addSystemEventListener","callback","addAudioEventListener","requestRecordingPermissions","checkRecordingPermissions","getDevicesInfo","_default","exports","default"],"sourceRoot":"../../../src","sources":["system/AudioManager.ts"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAIE,MAAM,CAACC,iBAAiB,IAAI,IAAI,EAAE;EACpC,IAAI,CAACC,2BAAoB,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,iFACF,CAAC;EACH;EAEAD,2BAAoB,CAACE,OAAO,CAAC,CAAC;AAChC;AAEA,MAAMC,YAAY,CAAC;EAEjBC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,iBAAiB,GAAG,IAAIN,yBAAiB,CAACD,MAAM,CAACC,iBAAiB,CAAC;EAC1E;EAEAO,4BAA4BA,CAAA,EAAW;IACrC,OAAON,2BAAoB,CAAEM,4BAA4B,CAAC,CAAC;EAC7D;EAEAC,uBAAuBA,CAACC,OAAgB,EAAoB;IAC1D,OAAOR,2BAAoB,CAAEO,uBAAuB,CAACC,OAAO,CAAC;EAC/D;EAEAC,sBAAsBA,CAACC,OAAuB,EAAE;IAC9CV,2BAAoB,CAAES,sBAAsB,CAC1CC,OAAO,CAACC,WAAW,IAAI,EAAE,EACzBD,OAAO,CAACE,OAAO,IAAI,EAAE,EACrBF,OAAO,CAACG,UAAU,IAAI,EAAE,EACxBH,OAAO,CAACI,eAAe,IAAI,KAC7B,CAAC;EACH;EAEAC,iBAAiBA,CAACC,IAAoB,EAAE;IACtChB,2BAAoB,CAAEe,iBAAiB,CAACC,IAAI,CAAC;EAC/C;EAEAC,mBAAmBA,CAAA,EAAG;IACpBjB,2BAAoB,CAAEiB,mBAAmB,CAAC,CAAC;EAC7C;EAEAC,yBAAyBA,CAACV,OAAgB,EAAE;IAC1CR,2BAAoB,CAAEkB,yBAAyB,CAACV,OAAO,CAAC;EAC1D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEW,sBAAsBA,CAACX,OAAgB,EAAE;IACvCR,2BAAoB,CAAEmB,sBAAsB,CAACX,OAAO,CAAC;EACvD;EAEAY,oBAAoBA,CAACZ,OAAgB,EAAE;IACrCR,2BAAoB,CAAEoB,oBAAoB,CAACZ,OAAO,CAAC;EACrD;EAEAa,mBAAmBA,CAACC,IAA4B,EAAEd,OAAgB,EAAE;IAClER,2BAAoB,CAAEqB,mBAAmB,CAACC,IAAI,EAAEd,OAAO,CAAC;EAC1D;EAEAe,sBAAsBA,CACpBD,IAAU,EACVE,QAAmC,EACX;IACxB,OAAO,IAAI,CAACnB,iBAAiB,CAACoB,qBAAqB,CAACH,IAAI,EAAEE,QAAQ,CAAC;EACrE;EAEA,MAAME,2BAA2BA,CAAA,EAA8B;IAC7D,OAAO1B,2BAAoB,CAAE0B,2BAA2B,CAAC,CAAC;EAC5D;EAEA,MAAMC,yBAAyBA,CAAA,EAA8B;IAC3D,OAAO3B,2BAAoB,CAAE2B,yBAAyB,CAAC,CAAC;EAC1D;EAEA,MAAMC,cAAcA,CAAA,EAA8B;IAChD,OAAO5B,2BAAoB,CAAE4B,cAAc,CAAC,CAAC;EAC/C;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAI5B,YAAY,CAAC,CAAC","ignoreList":[]}
|
|
@@ -11,13 +11,13 @@ export default class AudioContext extends BaseAudioContext {
|
|
|
11
11
|
super(global.createAudioContext(options?.sampleRate || AudioManager.getDevicePreferredSampleRate(), options?.initSuspended || false));
|
|
12
12
|
}
|
|
13
13
|
async close() {
|
|
14
|
-
|
|
14
|
+
return this.context.close();
|
|
15
15
|
}
|
|
16
16
|
async resume() {
|
|
17
|
-
|
|
17
|
+
return this.context.resume();
|
|
18
18
|
}
|
|
19
19
|
async suspend() {
|
|
20
|
-
|
|
20
|
+
return this.context.suspend();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=AudioContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseAudioContext","AudioManager","NotSupportedError","AudioContext","constructor","options","sampleRate","global","createAudioContext","getDevicePreferredSampleRate","initSuspended","close","context","resume","suspend"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;AACA,OAAOA,gBAAgB,MAAM,uBAAoB;AACjD,OAAOC,YAAY,MAAM,oBAAW;AAEpC,SAASC,iBAAiB,QAAQ,oBAAW;AAE7C,eAAe,MAAMC,YAAY,SAASH,gBAAgB,CAAC;EACzDI,WAAWA,CAACC,OAA6B,EAAE;IACzC,IACEA,OAAO,IACPA,OAAO,CAACC,UAAU,KACjBD,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EACzD;MACA,MAAM,IAAIJ,iBAAiB,CACzB,6CAA6CG,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IAEA,KAAK,CACHC,MAAM,CAACC,kBAAkB,CACvBH,OAAO,EAAEC,UAAU,IAAIL,YAAY,CAACQ,4BAA4B,CAAC,CAAC,EAClEJ,OAAO,EAAEK,aAAa,IAAI,KAC5B,CACF,CAAC;EACH;EAEA,MAAMC,KAAKA,CAAA,
|
|
1
|
+
{"version":3,"names":["BaseAudioContext","AudioManager","NotSupportedError","AudioContext","constructor","options","sampleRate","global","createAudioContext","getDevicePreferredSampleRate","initSuspended","close","context","resume","suspend"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;AACA,OAAOA,gBAAgB,MAAM,uBAAoB;AACjD,OAAOC,YAAY,MAAM,oBAAW;AAEpC,SAASC,iBAAiB,QAAQ,oBAAW;AAE7C,eAAe,MAAMC,YAAY,SAASH,gBAAgB,CAAC;EACzDI,WAAWA,CAACC,OAA6B,EAAE;IACzC,IACEA,OAAO,IACPA,OAAO,CAACC,UAAU,KACjBD,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EACzD;MACA,MAAM,IAAIJ,iBAAiB,CACzB,6CAA6CG,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IAEA,KAAK,CACHC,MAAM,CAACC,kBAAkB,CACvBH,OAAO,EAAEC,UAAU,IAAIL,YAAY,CAACQ,4BAA4B,CAAC,CAAC,EAClEJ,OAAO,EAAEK,aAAa,IAAI,KAC5B,CACF,CAAC;EACH;EAEA,MAAMC,KAAKA,CAAA,EAAqB;IAC9B,OAAQ,IAAI,CAACC,OAAO,CAAmBD,KAAK,CAAC,CAAC;EAChD;EAEA,MAAME,MAAMA,CAAA,EAAqB;IAC/B,OAAQ,IAAI,CAACD,OAAO,CAAmBC,MAAM,CAAC,CAAC;EACjD;EAEA,MAAMC,OAAOA,CAAA,EAAqB;IAChC,OAAQ,IAAI,CAACF,OAAO,CAAmBE,OAAO,CAAC,CAAC;EAClD;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","NativeAudioAPIModule","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AACZ,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","NativeAudioAPIModule","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":"AAAA,YAAY;;AACZ,SAASA,mBAAmB,QAAQ,cAAc;AAqClD,MAAMC,oBAAoB,GAAGD,mBAAmB,CAACE,GAAG,CAAO,gBAAgB,CAAC;AAE5E,SAASD,oBAAoB","ignoreList":[]}
|