@@ -164,6 +164,8 @@ - (void)setupAndInitAudioSession
164
164
NSLog (@" Error while activating audio session: %@ " , [error debugDescription ]);
165
165
return ;
166
166
}
167
+
168
+ self.isInterrupted = false ;
167
169
}
168
170
169
171
- (void )setupAndInitNotificationHandlers
@@ -175,11 +177,11 @@ - (void)setupAndInitNotificationHandlers
175
177
[self .notificationCenter addObserver: self
176
178
selector: @selector (handleEngineConfigurationChange: )
177
179
name: AVAudioEngineConfigurationChangeNotification
178
- object: self ];
180
+ object: nil ];
179
181
[self .notificationCenter addObserver: self
180
182
selector: @selector (handleInterruption: )
181
183
name: AVAudioSessionInterruptionNotification
182
- object: self ];
184
+ object: nil ];
183
185
}
184
186
185
187
- (void )connectAudioEngine
@@ -198,6 +200,8 @@ - (void)connectAudioEngine
198
200
NSLog (@" Error starting audio engine: %@ " , [error debugDescription ]);
199
201
}
200
202
}
203
+
204
+ self.configurationChanged = false ;
201
205
}
202
206
203
207
- (void )handleEngineConfigurationChange : (NSNotification *)notification
@@ -227,12 +231,7 @@ - (void)handleInterruption:(NSNotification *)notification
227
231
return ;
228
232
}
229
233
230
- bool success = [self .audioSession setActive: true error: &error];
231
-
232
- if (!success) {
233
- NSLog (@" ERror: %@ " , [error debugDescription ]);
234
- return ;
235
- }
234
+ [self setupAndInitAudioSession ];
236
235
237
236
if (self.configurationChanged && self.isRunning ) {
238
237
dispatch_async (dispatch_get_main_queue (), ^{
0 commit comments