Skip to content

Commit dd618a9

Browse files
authored
Update AudioPlayer.m (#370)
1 parent 5667dfd commit dd618a9

File tree

1 file changed

+7
-8
lines changed
  • packages/react-native-audio-api/ios/audioapi/ios/core

1 file changed

+7
-8
lines changed

packages/react-native-audio-api/ios/audioapi/ios/core/AudioPlayer.m

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ - (void)setupAndInitAudioSession
164164
NSLog(@"Error while activating audio session: %@", [error debugDescription]);
165165
return;
166166
}
167+
168+
self.isInterrupted = false;
167169
}
168170

169171
- (void)setupAndInitNotificationHandlers
@@ -175,11 +177,11 @@ - (void)setupAndInitNotificationHandlers
175177
[self.notificationCenter addObserver:self
176178
selector:@selector(handleEngineConfigurationChange:)
177179
name:AVAudioEngineConfigurationChangeNotification
178-
object:self];
180+
object:nil];
179181
[self.notificationCenter addObserver:self
180182
selector:@selector(handleInterruption:)
181183
name:AVAudioSessionInterruptionNotification
182-
object:self];
184+
object:nil];
183185
}
184186

185187
- (void)connectAudioEngine
@@ -198,6 +200,8 @@ - (void)connectAudioEngine
198200
NSLog(@"Error starting audio engine: %@", [error debugDescription]);
199201
}
200202
}
203+
204+
self.configurationChanged = false;
201205
}
202206

203207
- (void)handleEngineConfigurationChange:(NSNotification *)notification
@@ -227,12 +231,7 @@ - (void)handleInterruption:(NSNotification *)notification
227231
return;
228232
}
229233

230-
bool success = [self.audioSession setActive:true error:&error];
231-
232-
if (!success) {
233-
NSLog(@"ERror: %@", [error debugDescription]);
234-
return;
235-
}
234+
[self setupAndInitAudioSession];
236235

237236
if (self.configurationChanged && self.isRunning) {
238237
dispatch_async(dispatch_get_main_queue(), ^{

0 commit comments

Comments
 (0)