react-native-audio-api 0.11.0-nightly-010ea11-20251110 → 0.11.0-nightly-c8d92af-20251111

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 (64) hide show
  1. package/common/cpp/audioapi/AudioAPIModuleInstaller.h +1 -3
  2. package/common/cpp/audioapi/HostObjects/AudioContextHostObject.cpp +6 -2
  3. package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.cpp +3 -1
  4. package/common/cpp/audioapi/HostObjects/sources/AudioBufferBaseSourceNodeHostObject.cpp +19 -0
  5. package/common/cpp/audioapi/HostObjects/sources/AudioBufferBaseSourceNodeHostObject.h +3 -0
  6. package/common/cpp/audioapi/core/AudioContext.cpp +19 -24
  7. package/common/cpp/audioapi/core/AudioContext.h +2 -2
  8. package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +16 -0
  9. package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +2 -0
  10. package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +23 -3
  11. package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +2 -0
  12. package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +16 -3
  13. package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +5 -5
  14. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +10 -0
  15. package/common/cpp/audioapi/dsp/VectorMath.cpp +15 -15
  16. package/common/cpp/test/src/biquad/BiquadFilterTest.cpp +5 -5
  17. package/ios/audioapi/ios/AudioAPIModule.h +6 -4
  18. package/ios/audioapi/ios/AudioAPIModule.mm +62 -41
  19. package/ios/audioapi/ios/core/IOSAudioPlayer.h +1 -1
  20. package/ios/audioapi/ios/core/IOSAudioPlayer.mm +33 -24
  21. package/ios/audioapi/ios/core/IOSAudioRecorder.h +3 -2
  22. package/ios/audioapi/ios/core/IOSAudioRecorder.mm +6 -4
  23. package/ios/audioapi/ios/core/NativeAudioPlayer.m +18 -9
  24. package/ios/audioapi/ios/core/NativeAudioRecorder.h +2 -1
  25. package/ios/audioapi/ios/core/NativeAudioRecorder.m +45 -27
  26. package/ios/audioapi/ios/core/utils/AudioDecoder.mm +44 -19
  27. package/ios/audioapi/ios/system/AudioEngine.h +4 -2
  28. package/ios/audioapi/ios/system/AudioEngine.mm +22 -8
  29. package/ios/audioapi/ios/system/AudioSessionManager.h +9 -5
  30. package/ios/audioapi/ios/system/AudioSessionManager.mm +51 -21
  31. package/ios/audioapi/ios/system/LockScreenManager.mm +137 -88
  32. package/ios/audioapi/ios/system/NotificationManager.mm +79 -48
  33. package/lib/commonjs/api.js.map +1 -1
  34. package/lib/commonjs/core/AudioBufferBaseSourceNode.js +3 -0
  35. package/lib/commonjs/core/AudioBufferBaseSourceNode.js.map +1 -1
  36. package/lib/commonjs/core/AudioContext.js +1 -1
  37. package/lib/commonjs/core/AudioContext.js.map +1 -1
  38. package/lib/commonjs/web-core/AudioContext.js +1 -1
  39. package/lib/commonjs/web-core/AudioContext.js.map +1 -1
  40. package/lib/module/api.js.map +1 -1
  41. package/lib/module/core/AudioBufferBaseSourceNode.js +3 -0
  42. package/lib/module/core/AudioBufferBaseSourceNode.js.map +1 -1
  43. package/lib/module/core/AudioContext.js +1 -1
  44. package/lib/module/core/AudioContext.js.map +1 -1
  45. package/lib/module/web-core/AudioContext.js +1 -1
  46. package/lib/module/web-core/AudioContext.js.map +1 -1
  47. package/lib/typescript/api.d.ts +1 -1
  48. package/lib/typescript/api.d.ts.map +1 -1
  49. package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts +1 -0
  50. package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts.map +1 -1
  51. package/lib/typescript/core/AudioContext.d.ts.map +1 -1
  52. package/lib/typescript/interfaces.d.ts +2 -0
  53. package/lib/typescript/interfaces.d.ts.map +1 -1
  54. package/lib/typescript/types.d.ts +0 -1
  55. package/lib/typescript/types.d.ts.map +1 -1
  56. package/lib/typescript/web-core/AudioContext.d.ts +1 -1
  57. package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/src/api.ts +0 -1
  60. package/src/core/AudioBufferBaseSourceNode.ts +8 -0
  61. package/src/core/AudioContext.ts +0 -1
  62. package/src/interfaces.ts +3 -0
  63. package/src/types.ts +0 -1
  64. package/src/web-core/AudioContext.tsx +1 -1
@@ -101,11 +101,13 @@
101
101
  }
102
102
 
103
103
  if ([option isEqualToString:@"overrideMutedMicrophoneInterruption"]) {
104
- sessionOptions |= AVAudioSessionCategoryOptionOverrideMutedMicrophoneInterruption;
104
+ sessionOptions |=
105
+ AVAudioSessionCategoryOptionOverrideMutedMicrophoneInterruption;
105
106
  }
106
107
 
107
108
  if ([option isEqualToString:@"interruptSpokenAudioAndMixWithOthers"]) {
108
- sessionOptions |= AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers;
109
+ sessionOptions |=
110
+ AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers;
109
111
  }
110
112
  }
111
113
 
@@ -124,9 +126,11 @@
124
126
  self.sessionOptions = sessionOptions;
125
127
  }
126
128
 
127
- if (self.allowHapticsAndSystemSoundsDuringRecording != allowHapticsAndSystemSoundsDuringRecording) {
129
+ if (self.allowHapticsAndSystemSoundsDuringRecording !=
130
+ allowHapticsAndSystemSoundsDuringRecording) {
128
131
  self.hasDirtySettings = true;
129
- self.allowHapticsAndSystemSoundsDuringRecording = allowHapticsAndSystemSoundsDuringRecording;
132
+ self.allowHapticsAndSystemSoundsDuringRecording =
133
+ allowHapticsAndSystemSoundsDuringRecording;
130
134
  }
131
135
 
132
136
  if (self.isActive) {
@@ -156,9 +160,13 @@
156
160
  }
157
161
 
158
162
  if (error != nil) {
159
- NSLog(@"[AudioSessionManager] setting session as %@ failed", active ? @"ACTIVE" : @"INACTIVE");
163
+ NSLog(
164
+ @"[AudioSessionManager] setting session as %@ failed",
165
+ active ? @"ACTIVE" : @"INACTIVE");
160
166
  } else {
161
- NSLog(@"[AudioSessionManager] session is %@", active ? @"ACTIVE" : @"INACTIVE");
167
+ NSLog(
168
+ @"[AudioSessionManager] session is %@",
169
+ active ? @"ACTIVE" : @"INACTIVE");
162
170
  }
163
171
 
164
172
  return success;
@@ -167,7 +175,8 @@
167
175
  - (bool)configureAudioSession
168
176
  {
169
177
  if (!self.shouldManageSession) {
170
- NSLog(@"[AudioSessionManager] Skipping AVAudioSession configuration, shouldManageSession is false");
178
+ NSLog(
179
+ @"[AudioSessionManager] Skipping AVAudioSession configuration, shouldManageSession is false");
171
180
  return true;
172
181
  }
173
182
 
@@ -184,19 +193,26 @@
184
193
 
185
194
  NSError *error = nil;
186
195
 
187
- [self.audioSession setCategory:self.sessionCategory mode:self.sessionMode options:self.sessionOptions error:&error];
196
+ [self.audioSession setCategory:self.sessionCategory
197
+ mode:self.sessionMode
198
+ options:self.sessionOptions
199
+ error:&error];
188
200
 
189
201
  if (error != nil) {
190
- NSLog(@"Error while configuring audio session: %@", [error debugDescription]);
202
+ NSLog(
203
+ @"Error while configuring audio session: %@", [error debugDescription]);
191
204
  return false;
192
205
  }
193
206
 
194
207
  if (@available(iOS 13.0, *)) {
195
- [self.audioSession setAllowHapticsAndSystemSoundsDuringRecording:self.allowHapticsAndSystemSoundsDuringRecording
208
+ [self.audioSession setAllowHapticsAndSystemSoundsDuringRecording:
209
+ self.allowHapticsAndSystemSoundsDuringRecording
196
210
  error:&error];
197
211
 
198
212
  if (error != nil) {
199
- NSLog(@"Error while setting allowHapticsAndSystemSoundsDuringRecording: %@", [error debugDescription]);
213
+ NSLog(
214
+ @"Error while setting allowHapticsAndSystemSoundsDuringRecording: %@",
215
+ [error debugDescription]);
200
216
  }
201
217
  }
202
218
 
@@ -226,10 +242,13 @@
226
242
  self.hasDirtySettings = false;
227
243
  }
228
244
 
229
- - (void)requestRecordingPermissions:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
245
+ - (void)requestRecordingPermissions:(RCTPromiseResolveBlock)resolve
246
+ reject:(RCTPromiseRejectBlock)reject
230
247
  {
231
- id value = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSMicrophoneUsageDescription"];
232
- // if there is no entry NSMicrophoneUsageDescription calling requestRecordPermission will quit an app
248
+ id value = [[NSBundle mainBundle]
249
+ objectForInfoDictionaryKey:@"NSMicrophoneUsageDescription"];
250
+ // if there is no entry NSMicrophoneUsageDescription calling
251
+ // requestRecordPermission will quit an app
233
252
  if (value == nil) {
234
253
  reject(
235
254
  nil,
@@ -256,7 +275,8 @@
256
275
  }
257
276
  }
258
277
 
259
- - (void)checkRecordingPermissions:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
278
+ - (void)checkRecordingPermissions:(RCTPromiseResolveBlock)resolve
279
+ reject:(RCTPromiseRejectBlock)reject
260
280
  {
261
281
  if (@available(iOS 17, *)) {
262
282
  NSInteger res = [[AVAudioApplication sharedInstance] recordPermission];
@@ -322,19 +342,29 @@
322
342
  }
323
343
  }
324
344
 
325
- - (void)getDevicesInfo:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
345
+ - (void)getDevicesInfo:(RCTPromiseResolveBlock)resolve
346
+ reject:(RCTPromiseRejectBlock)reject
326
347
  {
327
348
  NSMutableDictionary *devicesInfo = [[NSMutableDictionary alloc] init];
328
349
 
329
- [devicesInfo setValue:[self parseDeviceList:[self.audioSession availableInputs]] forKey:@"availableInputs"];
330
- [devicesInfo setValue:[self parseDeviceList:[[self.audioSession currentRoute] inputs]] forKey:@"currentInputs"];
331
- [devicesInfo setValue:[self parseDeviceList:[[self.audioSession currentRoute] outputs]] forKey:@"availableOutputs"];
332
- [devicesInfo setValue:[self parseDeviceList:[[self.audioSession currentRoute] outputs]] forKey:@"currentOutputs"];
350
+ [devicesInfo
351
+ setValue:[self parseDeviceList:[self.audioSession availableInputs]]
352
+ forKey:@"availableInputs"];
353
+ [devicesInfo
354
+ setValue:[self parseDeviceList:[[self.audioSession currentRoute] inputs]]
355
+ forKey:@"currentInputs"];
356
+ [devicesInfo
357
+ setValue:[self parseDeviceList:[[self.audioSession currentRoute] outputs]]
358
+ forKey:@"availableOutputs"];
359
+ [devicesInfo
360
+ setValue:[self parseDeviceList:[[self.audioSession currentRoute] outputs]]
361
+ forKey:@"currentOutputs"];
333
362
 
334
363
  resolve(devicesInfo);
335
364
  }
336
365
 
337
- - (NSArray<NSDictionary *> *)parseDeviceList:(NSArray<AVAudioSessionPortDescription *> *)devices
366
+ - (NSArray<NSDictionary *> *)parseDeviceList:
367
+ (NSArray<AVAudioSessionPortDescription *> *)devices
338
368
  {
339
369
  NSMutableArray<NSDictionary *> *deviceList = [[NSMutableArray alloc] init];
340
370
 
@@ -2,13 +2,13 @@
2
2
  #import <audioapi/ios/AudioAPIModule.h>
3
3
  #import <audioapi/ios/system/LockScreenManager.h>
4
4
 
5
- #define LOCK_SCREEN_INFO \
6
- @{ \
7
- @"album" : MPMediaItemPropertyAlbumTitle, \
8
- @"artist" : MPMediaItemPropertyArtist, \
9
- @"duration" : MPMediaItemPropertyPlaybackDuration, \
10
- @"title" : MPMediaItemPropertyTitle, \
11
- @"speed" : MPNowPlayingInfoPropertyPlaybackRate, \
5
+ #define LOCK_SCREEN_INFO \
6
+ @{ \
7
+ @"album" : MPMediaItemPropertyAlbumTitle, \
8
+ @"artist" : MPMediaItemPropertyArtist, \
9
+ @"duration" : MPMediaItemPropertyPlaybackDuration, \
10
+ @"title" : MPMediaItemPropertyTitle, \
11
+ @"speed" : MPNowPlayingInfoPropertyPlaybackRate, \
12
12
  @"elapsedTime" : MPNowPlayingInfoPropertyElapsedPlaybackTime, \
13
13
  }
14
14
 
@@ -48,12 +48,14 @@
48
48
  if (self.playingInfoCenter.nowPlayingInfo == nil) {
49
49
  lockScreenInfoDict = [NSMutableDictionary dictionary];
50
50
  } else {
51
- lockScreenInfoDict = [[NSMutableDictionary alloc] initWithDictionary:self.playingInfoCenter.nowPlayingInfo];
51
+ lockScreenInfoDict = [[NSMutableDictionary alloc]
52
+ initWithDictionary:self.playingInfoCenter.nowPlayingInfo];
52
53
  }
53
54
 
54
55
  for (NSString *key in LOCK_SCREEN_INFO) {
55
56
  if ([info objectForKey:key] != nil) {
56
- [lockScreenInfoDict setValue:[info objectForKey:key] forKey:[LOCK_SCREEN_INFO objectForKey:key]];
57
+ [lockScreenInfoDict setValue:[info objectForKey:key]
58
+ forKey:[LOCK_SCREEN_INFO objectForKey:key]];
57
59
  }
58
60
  }
59
61
 
@@ -114,90 +116,119 @@
114
116
  self.artworkUrl = artworkUrl;
115
117
 
116
118
  // Custom handling of artwork in another thread, will be loaded async
117
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
118
- UIImage *image = nil;
119
-
120
- // check whether artwork path is present
121
- if ([artworkUrl isEqual:@""]) {
122
- return;
123
- }
124
-
125
- // artwork is url download from the interwebs
126
- if ([artworkUrl hasPrefix:@"http://"] || [artworkUrl hasPrefix:@"https://"]) {
127
- NSURL *imageURL = [NSURL URLWithString:artworkUrl];
128
- NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
129
- image = [UIImage imageWithData:imageData];
130
- } else {
131
- NSString *localArtworkUrl = [artworkUrl stringByReplacingOccurrencesOfString:@"file://" withString:@""];
132
- BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:localArtworkUrl];
133
- if (fileExists) {
134
- image = [UIImage imageNamed:localArtworkUrl];
135
- }
136
- }
137
-
138
- // Check if image was available otherwise don't do anything
139
- if (image == nil) {
140
- return;
141
- }
142
-
143
- // check whether image is loaded
144
- CGImageRef cgref = [image CGImage];
145
- CIImage *cim = [image CIImage];
146
-
147
- if (cim == nil && cgref == NULL) {
148
- return;
149
- }
150
-
151
- dispatch_async(dispatch_get_main_queue(), ^{
152
- // Check if URL wasn't changed in the meantime
153
- if (![artworkUrl isEqual:self.artworkUrl]) {
154
- return;
155
- }
156
-
157
- MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
158
- MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithBoundsSize:image.size
159
- requestHandler:^UIImage *_Nonnull(CGSize size) {
160
- return image;
161
- }];
162
- NSMutableDictionary *mediaDict = (center.nowPlayingInfo != nil)
163
- ? [[NSMutableDictionary alloc] initWithDictionary:center.nowPlayingInfo]
164
- : [NSMutableDictionary dictionary];
165
- [mediaDict setValue:artwork forKey:MPMediaItemPropertyArtwork];
166
- center.nowPlayingInfo = mediaDict;
167
- });
168
- });
119
+ dispatch_async(
120
+ dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
121
+ UIImage *image = nil;
122
+
123
+ // check whether artwork path is present
124
+ if ([artworkUrl isEqual:@""]) {
125
+ return;
126
+ }
127
+
128
+ // artwork is url download from the interwebs
129
+ if ([artworkUrl hasPrefix:@"http://"] ||
130
+ [artworkUrl hasPrefix:@"https://"]) {
131
+ NSURL *imageURL = [NSURL URLWithString:artworkUrl];
132
+ NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
133
+ image = [UIImage imageWithData:imageData];
134
+ } else {
135
+ NSString *localArtworkUrl =
136
+ [artworkUrl stringByReplacingOccurrencesOfString:@"file://"
137
+ withString:@""];
138
+ BOOL fileExists =
139
+ [[NSFileManager defaultManager] fileExistsAtPath:localArtworkUrl];
140
+ if (fileExists) {
141
+ image = [UIImage imageNamed:localArtworkUrl];
142
+ }
143
+ }
144
+
145
+ // Check if image was available otherwise don't do anything
146
+ if (image == nil) {
147
+ return;
148
+ }
149
+
150
+ // check whether image is loaded
151
+ CGImageRef cgref = [image CGImage];
152
+ CIImage *cim = [image CIImage];
153
+
154
+ if (cim == nil && cgref == NULL) {
155
+ return;
156
+ }
157
+
158
+ dispatch_async(dispatch_get_main_queue(), ^{
159
+ // Check if URL wasn't changed in the meantime
160
+ if (![artworkUrl isEqual:self.artworkUrl]) {
161
+ return;
162
+ }
163
+
164
+ MPNowPlayingInfoCenter *center =
165
+ [MPNowPlayingInfoCenter defaultCenter];
166
+ MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc]
167
+ initWithBoundsSize:image.size
168
+ requestHandler:^UIImage *_Nonnull(CGSize size) {
169
+ return image;
170
+ }];
171
+ NSMutableDictionary *mediaDict = (center.nowPlayingInfo != nil)
172
+ ? [[NSMutableDictionary alloc]
173
+ initWithDictionary:center.nowPlayingInfo]
174
+ : [NSMutableDictionary dictionary];
175
+ [mediaDict setValue:artwork forKey:MPMediaItemPropertyArtwork];
176
+ center.nowPlayingInfo = mediaDict;
177
+ });
178
+ });
169
179
  }
170
180
 
171
181
  - (void)enableRemoteCommand:(NSString *)name enabled:(BOOL)enabled
172
182
  {
173
- MPRemoteCommandCenter *remoteCenter = [MPRemoteCommandCenter sharedCommandCenter];
183
+ MPRemoteCommandCenter *remoteCenter =
184
+ [MPRemoteCommandCenter sharedCommandCenter];
174
185
 
175
186
  if ([name isEqual:@"remotePlay"]) {
176
- [self enableCommand:remoteCenter.playCommand withSelector:@selector(onPlay:) enabled:enabled];
187
+ [self enableCommand:remoteCenter.playCommand
188
+ withSelector:@selector(onPlay:)
189
+ enabled:enabled];
177
190
  } else if ([name isEqual:@"remotePause"]) {
178
- [self enableCommand:remoteCenter.pauseCommand withSelector:@selector(onPause:) enabled:enabled];
191
+ [self enableCommand:remoteCenter.pauseCommand
192
+ withSelector:@selector(onPause:)
193
+ enabled:enabled];
179
194
  } else if ([name isEqual:@"remoteStop"]) {
180
- [self enableCommand:remoteCenter.stopCommand withSelector:@selector(onStop:) enabled:enabled];
195
+ [self enableCommand:remoteCenter.stopCommand
196
+ withSelector:@selector(onStop:)
197
+ enabled:enabled];
181
198
  } else if ([name isEqual:@"remoteTogglePlayPause"]) {
182
- [self enableCommand:remoteCenter.togglePlayPauseCommand withSelector:@selector(onTogglePlayPause:) enabled:enabled];
199
+ [self enableCommand:remoteCenter.togglePlayPauseCommand
200
+ withSelector:@selector(onTogglePlayPause:)
201
+ enabled:enabled];
183
202
  } else if ([name isEqual:@"remoteChangePlaybackRate"]) {
184
203
  [self enableCommand:remoteCenter.changePlaybackRateCommand
185
204
  withSelector:@selector(onChangePlaybackRate:)
186
205
  enabled:enabled];
187
206
  } else if ([name isEqual:@"remoteNextTrack"]) {
188
- [self enableCommand:remoteCenter.nextTrackCommand withSelector:@selector(onNextTrack:) enabled:enabled];
207
+ [self enableCommand:remoteCenter.nextTrackCommand
208
+ withSelector:@selector(onNextTrack:)
209
+ enabled:enabled];
189
210
  } else if ([name isEqual:@"remotePreviousTrack"]) {
190
- [self enableCommand:remoteCenter.previousTrackCommand withSelector:@selector(onPreviousTrack:) enabled:enabled];
211
+ [self enableCommand:remoteCenter.previousTrackCommand
212
+ withSelector:@selector(onPreviousTrack:)
213
+ enabled:enabled];
191
214
  } else if ([name isEqual:@"remoteSkipForward"]) {
192
215
  remoteCenter.skipForwardCommand.preferredIntervals = @[ @15 ];
193
- [self enableCommand:remoteCenter.skipForwardCommand withSelector:@selector(onSkipForward:) enabled:enabled];
216
+ [self enableCommand:remoteCenter.skipForwardCommand
217
+ withSelector:@selector(onSkipForward:)
218
+ enabled:enabled];
194
219
  } else if ([name isEqual:@"remoteSkipBackward"]) {
195
220
  remoteCenter.skipBackwardCommand.preferredIntervals = @[ @15 ];
196
- [self enableCommand:remoteCenter.skipBackwardCommand withSelector:@selector(onSkipBackward:) enabled:enabled];
221
+ [self enableCommand:remoteCenter.skipBackwardCommand
222
+ withSelector:@selector(onSkipBackward:)
223
+ enabled:enabled];
197
224
  } else if ([name isEqual:@"remoteSeekForward"]) {
198
- [self enableCommand:remoteCenter.seekForwardCommand withSelector:@selector(onSeekForward:) enabled:enabled];
225
+ [self enableCommand:remoteCenter.seekForwardCommand
226
+ withSelector:@selector(onSeekForward:)
227
+ enabled:enabled];
199
228
  } else if ([name isEqual:@"remoteSeekBackward"]) {
200
- [self enableCommand:remoteCenter.seekBackwardCommand withSelector:@selector(onSeekBackward:) enabled:enabled];
229
+ [self enableCommand:remoteCenter.seekBackwardCommand
230
+ withSelector:@selector(onSeekBackward:)
231
+ enabled:enabled];
201
232
  } else if ([name isEqual:@"remoteChangePlaybackPosition"]) {
202
233
  [self enableCommand:remoteCenter.changePlaybackPositionCommand
203
234
  withSelector:@selector(onChangePlaybackPosition:)
@@ -205,7 +236,9 @@
205
236
  }
206
237
  }
207
238
 
208
- - (void)enableCommand:(MPRemoteCommand *)command withSelector:(SEL)selector enabled:(BOOL)enabled
239
+ - (void)enableCommand:(MPRemoteCommand *)command
240
+ withSelector:(SEL)selector
241
+ enabled:(BOOL)enabled
209
242
  {
210
243
  [command removeTarget:self action:selector];
211
244
  if (enabled) {
@@ -234,63 +267,79 @@
234
267
 
235
268
  - (MPRemoteCommandHandlerStatus)onTogglePlayPause:(MPRemoteCommandEvent *)event
236
269
  {
237
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteTogglePlayPause" eventBody:nil];
270
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteTogglePlayPause"
271
+ eventBody:nil];
238
272
  return MPRemoteCommandHandlerStatusSuccess;
239
273
  }
240
274
 
241
- - (MPRemoteCommandHandlerStatus)onChangePlaybackRate:(MPChangePlaybackRateCommandEvent *)event
275
+ - (MPRemoteCommandHandlerStatus)onChangePlaybackRate:
276
+ (MPChangePlaybackRateCommandEvent *)event
242
277
  {
243
- NSDictionary *body = @{@"value" : [NSNumber numberWithDouble:event.playbackRate]};
278
+ NSDictionary *body =
279
+ @{@"value" : [NSNumber numberWithDouble:event.playbackRate]};
244
280
 
245
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteChangePlaybackRate" eventBody:body];
281
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteChangePlaybackRate"
282
+ eventBody:body];
246
283
  return MPRemoteCommandHandlerStatusSuccess;
247
284
  }
248
285
 
249
286
  - (MPRemoteCommandHandlerStatus)onNextTrack:(MPRemoteCommandEvent *)event
250
287
  {
251
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteNextTrack" eventBody:nil];
288
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteNextTrack"
289
+ eventBody:nil];
252
290
  return MPRemoteCommandHandlerStatusSuccess;
253
291
  }
254
292
 
255
293
  - (MPRemoteCommandHandlerStatus)onPreviousTrack:(MPRemoteCommandEvent *)event
256
294
  {
257
- [self.audioAPIModule invokeHandlerWithEventName:@"remotePreviousTrack" eventBody:nil];
295
+ [self.audioAPIModule invokeHandlerWithEventName:@"remotePreviousTrack"
296
+ eventBody:nil];
258
297
  return MPRemoteCommandHandlerStatusSuccess;
259
298
  }
260
299
 
261
300
  - (MPRemoteCommandHandlerStatus)onSeekForward:(MPRemoteCommandEvent *)event
262
301
  {
263
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteSeekForward" eventBody:nil];
302
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteSeekForward"
303
+ eventBody:nil];
264
304
  return MPRemoteCommandHandlerStatusSuccess;
265
305
  }
266
306
 
267
307
  - (MPRemoteCommandHandlerStatus)onSeekBackward:(MPRemoteCommandEvent *)event
268
308
  {
269
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteSeekBackward" eventBody:nil];
309
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteSeekBackward"
310
+ eventBody:nil];
270
311
  return MPRemoteCommandHandlerStatusSuccess;
271
312
  }
272
313
 
273
- - (MPRemoteCommandHandlerStatus)onSkipForward:(MPSkipIntervalCommandEvent *)event
314
+ - (MPRemoteCommandHandlerStatus)onSkipForward:
315
+ (MPSkipIntervalCommandEvent *)event
274
316
  {
275
317
  NSDictionary *body = @{@"value" : [NSNumber numberWithDouble:event.interval]};
276
318
 
277
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteSkipForward" eventBody:body];
319
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteSkipForward"
320
+ eventBody:body];
278
321
  return MPRemoteCommandHandlerStatusSuccess;
279
322
  }
280
323
 
281
- - (MPRemoteCommandHandlerStatus)onSkipBackward:(MPSkipIntervalCommandEvent *)event
324
+ - (MPRemoteCommandHandlerStatus)onSkipBackward:
325
+ (MPSkipIntervalCommandEvent *)event
282
326
  {
283
327
  NSDictionary *body = @{@"value" : [NSNumber numberWithDouble:event.interval]};
284
328
 
285
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteSkipBackward" eventBody:body];
329
+ [self.audioAPIModule invokeHandlerWithEventName:@"remoteSkipBackward"
330
+ eventBody:body];
286
331
  return MPRemoteCommandHandlerStatusSuccess;
287
332
  }
288
333
 
289
- - (MPRemoteCommandHandlerStatus)onChangePlaybackPosition:(MPChangePlaybackPositionCommandEvent *)event
334
+ - (MPRemoteCommandHandlerStatus)onChangePlaybackPosition:
335
+ (MPChangePlaybackPositionCommandEvent *)event
290
336
  {
291
- NSDictionary *body = @{@"value" : [NSNumber numberWithDouble:event.positionTime]};
337
+ NSDictionary *body =
338
+ @{@"value" : [NSNumber numberWithDouble:event.positionTime]};
292
339
 
293
- [self.audioAPIModule invokeHandlerWithEventName:@"remoteChangePlaybackPosition" eventBody:body];
340
+ [self.audioAPIModule
341
+ invokeHandlerWithEventName:@"remoteChangePlaybackPosition"
342
+ eventBody:body];
294
343
  return MPRemoteCommandHandlerStatusSuccess;
295
344
  }
296
345