Commit 4c2c58f2 by pierce

修复连麦声音问题

parent 5df38f0e
......@@ -577,13 +577,15 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
- (void)delayUpdateToSpeakerPlay {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
AVAudioSessionCategoryOptions currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
[self.agoraEngine setEnableSpeakerphone:YES];
currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
AVAudioSessionCategory currentCategory = [AVAudioSession sharedInstance].category;
AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP;
[self->_agoraEngine setEnableSpeakerphone:YES];
AVAudioSessionCategoryOptions categoryOptions = 43;
NSError *error;
if (currentCategoryOptions < categoryOptions) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:categoryOptions error:&error];
}
AVAudioSessionRouteDescription *currentRoute = [AVAudioSession sharedInstance].currentRoute;
BOOL needForceToSpeaker = NO;
for (AVAudioSessionPortDescription *port in currentRoute.outputs) {
......@@ -598,9 +600,9 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
}
[[AVAudioSession sharedInstance] setActive:YES error:nil];
currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
});
}
#pragma mark - AgoraVideoFrameDelegate
- (BOOL)onRenderVideoFrame:(AgoraOutputVideoFrame *)videoFrame uid:(NSUInteger)uid channelId:(NSString *)channelId {
if (uid == FUSLiveHelper.shareInstance.roomInfoModel.roomId.integerValue &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment