Commit 48539ae9 by ludi

Merge branch 'feature/私讯+座驾体系' of http://git.yabolive.net:88/pidan/FuSiLive into feature/私讯+座驾体系

parents c28584b6 f6352692
......@@ -485,6 +485,15 @@
[self.engine.camera resumeCameraCapture];
}
- (void)fus_pauseAudioCapture {
[self.engine stopAudioCapture];
}
- (void)fus_resumeAudioCapture {
[self.engine startAudioCapture];
}
/**
获取实时统计信息
......
......@@ -141,6 +141,10 @@ typedef NS_ENUM(NSUInteger, FUSLiveCoreNetworkQuality) {
- (void)fus_resumeCapture;
- (void)fus_pauseAudioCapture;
- (void)fus_resumeAudioCapture;
/// 重置推流的帧率
- (void)fus_setFPS:(NSInteger)fps;
......
......@@ -117,6 +117,14 @@
}
- (void)fus_pauseAudioCapture {
}
- (void)fus_resumeAudioCapture {
}
/**
获取实时统计信息
......
......@@ -577,30 +577,32 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
- (void)delayUpdateToSpeakerPlay {
AVAudioSessionCategoryOptions currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
[self.agoraEngine setEnableSpeakerphone:YES];
currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
AVAudioSessionCategory currentCategory = [AVAudioSession sharedInstance].category;
AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP;
NSError *error;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:categoryOptions error:&error];
AVAudioSessionRouteDescription *currentRoute = [AVAudioSession sharedInstance].currentRoute;
BOOL needForceToSpeaker = NO;
for (AVAudioSessionPortDescription *port in currentRoute.outputs) {
/// 连麦不通过听筒播放
if (port.portType == AVAudioSessionPortBuiltInReceiver) {
needForceToSpeaker = YES;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
AVAudioSessionCategoryOptions currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
[self->_agoraEngine setEnableSpeakerphone:YES];
AVAudioSessionCategoryOptions categoryOptions = 43;
NSError *error;
if (currentCategoryOptions < categoryOptions) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:categoryOptions error:&error];
}
}
if (needForceToSpeaker) {
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
}
[[AVAudioSession sharedInstance] setActive:YES error:nil];
currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
AVAudioSessionRouteDescription *currentRoute = [AVAudioSession sharedInstance].currentRoute;
BOOL needForceToSpeaker = NO;
for (AVAudioSessionPortDescription *port in currentRoute.outputs) {
/// 连麦不通过听筒播放
if (port.portType == AVAudioSessionPortBuiltInReceiver) {
needForceToSpeaker = YES;
}
}
if (needForceToSpeaker) {
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
}
[[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 &&
......
......@@ -910,7 +910,9 @@
return;
}
[FUSLinkMicroHttpHelper fus_replyLinkedMicroWithChannelId:self.channelId roomId:self.roomId status:buttonIndex success:nil failure:^(NSString * _Nonnull msg, int code) {
[FUSLinkMicroHttpHelper fus_replyLinkedMicroWithChannelId:self.channelId roomId:self.roomId status:buttonIndex success:^{
[self fus_anchorAllowLinkMicOrYouAcceptLinkMic];
} failure:^(NSString * _Nonnull msg, int code) {
[FUSDialogView fus_showDialog:msg];
}];
}];
......@@ -1049,7 +1051,7 @@
[FUSDialogView fus_showDialog:[NSString fus_localString:@"连麦成功"]];
[self.linkMicAgoraHelper fus_openMicro];
}
[self fus_anchorAllowLinkMicOrYouAcceptLinkMic];
}else{
[FUSDialogView fus_showDialog:[NSString fus_localString:@"主播拒绝了上麦申请,请稍后再试"]];
[self.linkMicAgoraHelper fus_closeMicro];
......@@ -1176,24 +1178,6 @@
} failure:nil];
}
[FUSLinkMicroHttpHelper fus_startReportLinkedMicroWithChannelId:self.channelId roomId:self.roomId status:@"1" success:^{
if (FUSConfig.sharedInstanced.devConfigs.enableTestCode) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[FUSDialogView fus_showDialog:@"测试:上报同意连麦,连麦成功!"];
});
}else{
[FUSDialogView fus_showDialog:[NSString fus_localString:@"连麦成功"]];
}
if (!weakSelf.selfCloseMic) {
// 这里如果不先关掉再打开,他声网就会有问题,你说他辣鸡不辣鸡
[weakSelf.linkMicAgoraHelper switchLocalMic:NO];
[weakSelf.linkMicAgoraHelper switchLocalMic:YES];
}
} failure:^(NSString * _Nonnull msg, int code) {
[FUSDialogView fus_showDialog:msg];
}];
}else{
// 后台说:没有移除中的状态,主播点了移除不管对方是否有真正退出频道成功,都算已经移除
// [FUSLinkMicroHttpHelper fus_stopLinkedMicroWithChannelId:self.channelId roomId:self.roomId type:@"1" success:^{
......@@ -1207,6 +1191,31 @@
[self fus_updateHeaderViewSizeWithModels:_models remove:YES];
}
/// 主播同意了你的连麦申请
/// 或者
/// 你接受了主播的连麦申请
- (void)fus_anchorAllowLinkMicOrYouAcceptLinkMic {
__weak typeof(self) weakSelf = self;
[FUSLinkMicroHttpHelper fus_startReportLinkedMicroWithChannelId:self.channelId roomId:self.roomId status:@"1" success:^{
if (FUSConfig.sharedInstanced.devConfigs.enableTestCode) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[FUSDialogView fus_showDialog:@"测试:上报同意连麦,连麦成功!"];
});
}else{
[FUSDialogView fus_showDialog:[NSString fus_localString:@"连麦成功"]];
}
if (!weakSelf.selfCloseMic) {
// 这里如果不先关掉再打开,他声网就会有问题,你说他辣鸡不辣鸡
[weakSelf.linkMicAgoraHelper switchLocalMic:NO];
[weakSelf.linkMicAgoraHelper switchLocalMic:YES];
}
} failure:^(NSString * _Nonnull msg, int code) {
[FUSDialogView fus_showDialog:msg];
}];
}
/// 麦位变化
- (void)receiveUserLinkMicChangeResult:(NSNotification *)noti{
......
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