Commit 7643ea27 by ludi

Merge branch 'feature/UI修改版本' of http://git.yabolive.net:88/pidan/FuSiLive into feature/UI修改版本

parents b6089def 6964fdbc
......@@ -225,7 +225,7 @@
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled];
self.layer.cornerRadius = self.height / 2.0f;
self.layer.masksToBounds = YES;
self.backgroundColor = [UIColor fus_diamondBlue];
self.backgroundColor = [UIColor fus_appMainColor];
}
break;
case FUSButtonStyleBlueBorder:
......
......@@ -107,10 +107,14 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
if (reason == AVAudioSessionRouteChangeReasonCategoryChange) {
AVAudioSessionCategoryOptions currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
AVAudioSessionCategory currentCategory = [AVAudioSession sharedInstance].category;
//在需要进行对audioSession进行修正的场景下(RTC直播),修改category时options未包含mixWithOther,则给options追加mixWithOther
if (!(currentCategoryOptions & AVAudioSessionCategoryOptionMixWithOthers)) {
[[AVAudioSession sharedInstance] setCategory:currentCategory withOptions:currentCategoryOptions | AVAudioSessionCategoryOptionMixWithOthers error:nil];
// //在需要进行对audioSession进行修正的场景下(RTC直播),修改category时options未包含mixWithOther,则给options追加mixWithOther
AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP;
if (currentCategoryOptions != categoryOptions) {
[[AVAudioSession sharedInstance] setCategory:currentCategory withOptions:categoryOptions error:nil];
}
//
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];
}
}
......@@ -155,7 +159,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
success:(void(^)(void))success
failure:(void(^)(void))failure
{
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
[self delayUpdateToSpeakerPlay];
_joinChannelSuccessBlock = success;
FUSLogVerbose(@"连麦:开始加入频道");
_uid = uid;
......@@ -226,7 +230,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
_myselfIsOnMic = YES;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
[self delayUpdateToSpeakerPlay];
FUSLogDebug(@"pp===准备进入频道 %@", channelId);
__weak typeof(self) weakSelf = self;
int code = [self.agoraEngine joinChannelByToken:nil channelId:channelId info:@"" uid:uid joinSuccess:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
......@@ -243,10 +248,10 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
FUSLogDebug(@"pp===准备进入成功 %@", channel);
[self updateToSpeakerPlay];
if (TEST_CODE) {
[FUSDialogView fus_showDialog:[NSString stringWithFormat:@"测试:加入频道成功 %@", channel]];
}
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
if (success) {
success();
......@@ -392,12 +397,14 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[_agoraEngine enableLocalVideo:NO];
}
[_agoraEngine enableLocalAudio:YES];
[self updateToSpeakerPlay];
}
- (void)fus_closeMicro{
[self fus_switchRole:AgoraClientRoleAudience];
[_agoraEngine muteLocalAudioStream:YES];
[_agoraEngine enableLocalAudio:NO];
[self updateToSpeakerPlay];
}
- (void)switchLocalMic:(BOOL)open{
......@@ -459,13 +466,12 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[_agoraEngine enableLocalAudio:YES];
[_agoraEngine enableLocalVideo:YES];
_agoraEngine.delegate = self;
// [_agoraEngine setAudioSessionOperationRestriction:AgoraAudioSessionOperationRestrictionDeactivateSession];
// [_agoraEngine setEnableSpeakerphone:YES];
// [_agoraEngine setAudioSessionOperationRestriction:AgoraAudioSessionOperationRestrictionConfigureSession];
// [_agoraEngine disableExternalAudioSource];
// 这个scenario只能是AgoraAudioScenarioGameStreaming,设置为别的会有回音
[_agoraEngine setAudioProfile:AgoraAudioProfileDefault];
[_agoraEngine setAudioScenario:AgoraAudioScenarioGameStreaming];
[_agoraEngine setAudioScenario:AgoraAudioScenarioChatRoom];
/// 开启硬编码
[_agoraEngine setParameters:@"{\"che.hardware_encoding\": 1}"];
// 设置开启后台解码。
......@@ -479,6 +485,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
_agoraOtherPreview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenH)];
_agoraOtherPreview.translatesAutoresizingMaskIntoConstraints = NO;
_agoraOtherPreview.clipsToBounds = YES;
[self updateToSpeakerPlay];
}
return _agoraEngine;
}
......@@ -587,6 +594,38 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
return _role;
}
- (void)updateToSpeakerPlay {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayUpdateToSpeakerPlay) object:nil];
[self performSelector:@selector(delayUpdateToSpeakerPlay) afterDelay:2];
}
- (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;
}
}
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 &&
......@@ -655,6 +694,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[delegate fus_agoraHelper:self didJoinedOfUid:uid];
}
}
[self updateToSpeakerPlay];
}
/**
......@@ -686,6 +727,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[delegate fus_agoraHelper:self didJoinedOfUid:uid];
}
}
[self updateToSpeakerPlay];
}
- (void)rtcEngine:(AgoraRtcEngineKit *)engine didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole newRoleOptions:(AgoraClientRoleOptions *)newRoleOptions {
......@@ -888,7 +931,6 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
*/
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality
{
FUSLogVerbose(@"%s",__func__);
}
......@@ -973,6 +1015,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
}
FUSLogVerbose(@"FUSStreamPushView:第一帧来了");
[self updateToSpeakerPlay];
}
/** The remote video stream state has changed.
......
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