#pragma mark -
#pragma mark - audio session config
- (void)setAudioSessionConfig
{
NSError *error;
AVAudioSession *session = [AVAudioSession sharedInstance];
_originalAudioSessionCategory = session.category;
if (![session setCategory:AVAudioSessionCategorySoloAmbient error:&error]) {
QZLOG_ERROR(@"%@, setCategory failed, error: %@!!!", NSStringFromSelector(_cmd), error);
}
if (![session setActive:YES error:&error]) {
QZLOG_ERROR(@"%@, setActive failed!!!", NSStringFromSelector(_cmd));
}
}
- (void)resetAudioSessionConfig
{
if (!(_originalAudioSessionCategory.length > 0)) {
return;
}
NSError *error;
if (![[AVAudioSession sharedInstance] setCategory:_originalAudioSessionCategory error:&error]) {
QZLOG_ERROR(@"%@, setCategory failed, error: %@!!!", NSStringFromSelector(_cmd), error);
}
}