Commit b3c3a7c4 by ludi

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

parents 3fb98513 3b5e57c3
Showing with 119 additions and 166 deletions
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#import "FUSMainThreadLockOperation.h" #import "FUSMainThreadLockOperation.h"
#define BTN_HEIGHT 45 // 按钮的高度 #define BTN_HEIGHT 38 // 按钮的高度
#define VIEW_MARGIN 30 // 上下左右的边距 #define VIEW_MARGIN 29 // 上下左右的边距
#define TITLE_DETAIL_SPACE 0 // 标题和内容的间距 #define TITLE_DETAIL_SPACE 6 // 标题和内容的间距
#define DETAIL_BUTTON_SACE 10 // 内容到下面按钮的距离 #define DETAIL_BUTTON_SACE 25 // 内容到下面按钮的距离
@interface FUSAlertView () @interface FUSAlertView ()
...@@ -48,9 +48,6 @@ ...@@ -48,9 +48,6 @@
// 同步操作对象 // 同步操作对象
@property (nonatomic, strong) FUSMainThreadLockOperation *mainLockOperation; @property (nonatomic, strong) FUSMainThreadLockOperation *mainLockOperation;
// 是否粉色风格的弹窗
@property (nonatomic, assign) BOOL isPinkStyle;
@end @end
@implementation FUSAlertView @implementation FUSAlertView
...@@ -75,28 +72,27 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -75,28 +72,27 @@ static FUSAlertView *sharedAlertView = nil;
_bgImageView = [[UIImageView alloc] init]; _bgImageView = [[UIImageView alloc] init];
_bgImageView.contentMode = UIViewContentModeScaleToFill; _bgImageView.contentMode = UIViewContentModeScaleToFill;
_bgImageView.image = UIImage.fus_alertBg; _bgImageView.backgroundColor = UIColor.fus_appBGColor;
_bgImageView.layer.cornerRadius = 21;
_bgImageView.layer.masksToBounds = YES;
// _bgImageView.image = UIImage.fus_alertBg;
[_bgView addSubview:_bgImageView]; [_bgView addSubview:_bgImageView];
_titleLabel = [[UILabel alloc] init]; _titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold]; _titleLabel.font = [UIFont fus_themeBoldFont:19];
_titleLabel.numberOfLines = 0; _titleLabel.numberOfLines = 0;
_titleLabel.textColor = [UIColor whiteColor]; _titleLabel.textColor = UIColor.fus_textColorRich;
_titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.textAlignment = NSTextAlignmentCenter;
[_bgView addSubview:_titleLabel]; [_bgView addSubview:_titleLabel];
_detailLabel = [[UILabel alloc] init]; _detailLabel = [[UILabel alloc] init];
_detailLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular]; _detailLabel.font = [UIFont fus_themeFont:14];
_detailLabel.numberOfLines = 0; _detailLabel.numberOfLines = 0;
_detailLabel.textAlignment = NSTextAlignmentCenter; _detailLabel.textAlignment = NSTextAlignmentCenter;
_detailLabel.textColor = [UIColor colorWithHex:@"#E6E6E6"]; _detailLabel.textColor = [UIColor colorWithHex:@"333333"];
[_bgView addSubview:_detailLabel]; [_bgView addSubview:_detailLabel];
_cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem]; [self fus_resetCancelBtn];
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"#58DBD7"] forState:UIControlStateNormal];
[_cancelBtn addTarget:self action:@selector(onClickBtn:) forControlEvents:UIControlEventTouchUpInside];
_cancelBtn.tag = 0;
[_bgView addSubview:_cancelBtn]; [_bgView addSubview:_cancelBtn];
_noMoreTipBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _noMoreTipBtn = [UIButton buttonWithType:UIButtonTypeCustom];
...@@ -118,14 +114,7 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -118,14 +114,7 @@ static FUSAlertView *sharedAlertView = nil;
- (void)fus_setConfirmBtnWithArray:(NSArray *)titlesArray { - (void)fus_setConfirmBtnWithArray:(NSArray *)titlesArray {
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular]; [self fus_resetCancelBtn];
if (self.isPinkStyle) {
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"#FF668E"] forState:UIControlStateNormal];
} else {
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"#58DBD7"] forState:UIControlStateNormal];
}
[_cancelBtn addTarget:self action:@selector(onClickBtn:) forControlEvents:UIControlEventTouchUpInside];
_cancelBtn.tag = 0;
[_bgView addSubview:_cancelBtn]; [_bgView addSubview:_cancelBtn];
...@@ -146,17 +135,16 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -146,17 +135,16 @@ static FUSAlertView *sharedAlertView = nil;
// btn = self.confirmBtnArr[i]; // btn = self.confirmBtnArr[i];
// }else{ // }else{
btn = [UIButton buttonWithType:UIButtonTypeSystem]; btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightSemibold]; btn.titleLabel.font = [UIFont fus_themeMediumFont:15];
// } // }
NSString *btnTitle = titlesArray[i]; NSString *btnTitle = titlesArray[i];
[btn setTitle:btnTitle forState:UIControlStateNormal]; [btn setTitle:btnTitle forState:UIControlStateNormal];
btn.backgroundColor = UIColor.fus_appMainColor;
btn.layer.cornerRadius = BTN_HEIGHT / 2.0f;
btn.layer.masksToBounds = YES;
if (self.isPinkStyle) { [btn setTitleColor:[UIColor fus_textColorRich] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor colorWithHex:@"#FF668E"] forState:UIControlStateNormal];
} else {
[btn setTitleColor:[UIColor colorWithHex:@"#58DBD7"] forState:UIControlStateNormal];
}
[btn sizeToFit]; [btn sizeToFit];
btn.tag = i+1; btn.tag = i+1;
...@@ -179,7 +167,10 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -179,7 +167,10 @@ static FUSAlertView *sharedAlertView = nil;
CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0; CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0;
widthScale > 1.0 ? widthScale = 1.0 : widthScale; //6和6plus显示的一样 widthScale > 1.0 ? widthScale = 1.0 : widthScale; //6和6plus显示的一样
CGFloat alertViewW = ceil(270 * widthScale); CGFloat alertViewW = ceil(280 * widthScale);
CGFloat btnX = 33;
CGFloat itemSpace = 13;
self.titleLabel.y = VIEW_MARGIN; self.titleLabel.y = VIEW_MARGIN;
self.titleLabel.size = _titleStrSize; self.titleLabel.size = _titleStrSize;
...@@ -198,27 +189,30 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -198,27 +189,30 @@ static FUSAlertView *sharedAlertView = nil;
aboveBtnFrame.size.height = 20; aboveBtnFrame.size.height = 20;
self.noMoreTipBtn.frame = aboveBtnFrame; self.noMoreTipBtn.frame = aboveBtnFrame;
} else { } else {
aboveBtnFrame = self.detailLabel.frame; if (self.detailLabel.height) {
aboveBtnFrame = self.detailLabel.frame;
} else {
aboveBtnFrame = self.titleLabel.frame;
}
} }
UIView *separatorView = [[UIView alloc] initWithFrame:CGRectMake(12, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, alertViewW - 24, 0.5)]; // UIView *separatorView = [[UIView alloc] initWithFrame:CGRectMake(12, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, alertViewW - 24, 0.5)];
separatorView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09]; // separatorView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
[self.bgView addSubview:separatorView]; // [self.bgView addSubview:separatorView];
[self.separatorArr addObject:separatorView]; // [self.separatorArr addObject:separatorView];
// 只显示一行的情况 // 只显示一行的情况
CGFloat btnWholeH = BTN_HEIGHT; CGFloat btnWholeH = BTN_HEIGHT;
if ((self.confirmBtnArr.count == 1 || ([NSString isNull:self.cancelBtn.titleLabel.text]&&self.confirmBtnArr.count == 2)) if ((self.confirmBtnArr.count == 1 || ([NSString isNull:self.cancelBtn.titleLabel.text]&&self.confirmBtnArr.count == 2))
&& _maxBtnWidth < alertViewW/2.0 - 10) { && _maxBtnWidth < alertViewW/2.0) {
CGFloat btnWholeW = alertViewW - 26;
CGFloat btnW = btnWholeW/2.0;
if (![NSString isNull:self.cancelBtn.titleLabel.text]) { if (![NSString isNull:self.cancelBtn.titleLabel.text]) {
[self.confirmBtnArr insertObject:self.cancelBtn atIndex:0]; [self.confirmBtnArr insertObject:self.cancelBtn atIndex:0];
} }
CGFloat btnX = 13; CGFloat btnWholeW = alertViewW - btnX * 2 - itemSpace * (self.confirmBtnArr.count - 1);
CGFloat btnW = btnWholeW/2.0;
btnW = btnWholeW/self.confirmBtnArr.count; btnW = btnWholeW/self.confirmBtnArr.count;
for (int i = 0; i < self.confirmBtnArr.count; i++) { for (int i = 0; i < self.confirmBtnArr.count; i++) {
...@@ -226,27 +220,26 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -226,27 +220,26 @@ static FUSAlertView *sharedAlertView = nil;
btn.frame = CGRectMake(btnX, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, btnW, BTN_HEIGHT); btn.frame = CGRectMake(btnX, CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE, btnW, BTN_HEIGHT);
[self.bgView addSubview:btn]; [self.bgView addSubview:btn];
btn.tag = i; btn.tag = i;
if (i < self.confirmBtnArr.count - 1) { // if (i < self.confirmBtnArr.count - 1) {
UIView *separatorCenterView = [[UIView alloc] init]; // UIView *separatorCenterView = [[UIView alloc] init];
separatorCenterView.frame = CGRectMake(CGRectGetMaxX(btn.frame), btn.y, 0.5, btn.height); // separatorCenterView.frame = CGRectMake(CGRectGetMaxX(btn.frame), btn.y, 0.5, btn.height);
separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09]; // separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
[self.separatorArr addObject:separatorCenterView]; // [self.separatorArr addObject:separatorCenterView];
[self.bgView addSubview:separatorCenterView]; // [self.bgView addSubview:separatorCenterView];
} // }
btnX += btn.width; btnX += btn.width + itemSpace;
} }
// 按钮显示多行 // 按钮显示多行
}else{ }else{
CGFloat nextY = CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE; CGFloat nextY = CGRectGetMaxY(aboveBtnFrame) + DETAIL_BUTTON_SACE;
CGFloat btnX = 13.0; CGFloat btnW = alertViewW - btnX * 2;
CGFloat btnW = alertViewW - 26;
for (int i = 0;i < self.confirmBtnArr.count;i++) { for (int i = 0;i < self.confirmBtnArr.count;i++) {
UIButton *btn = self.confirmBtnArr[i]; UIButton *btn = self.confirmBtnArr[i];
btn.frame = CGRectMake(btnX, nextY, btnW, BTN_HEIGHT); btn.frame = CGRectMake(btnX, nextY, btnW, BTN_HEIGHT);
nextY += BTN_HEIGHT; nextY += (BTN_HEIGHT + itemSpace);
[self.bgView addSubview:btn]; [self.bgView addSubview:btn];
CGFloat separatorCenterViewY = btn.y; CGFloat separatorCenterViewY = btn.y;
...@@ -257,10 +250,10 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -257,10 +250,10 @@ static FUSAlertView *sharedAlertView = nil;
separatorCenterViewY = btn.y + btn.height; separatorCenterViewY = btn.y + btn.height;
} }
UIView *separatorCenterView = [[UIView alloc] initWithFrame:CGRectMake(separatorView.x, separatorCenterViewY, btnW +2 , 0.5)]; // UIView *separatorCenterView = [[UIView alloc] initWithFrame:CGRectMake(separatorView.x, separatorCenterViewY, btnW +2 , 0.5)];
separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09]; // separatorCenterView.backgroundColor = [[UIColor colorWithHex:@"#FFFFFF"] colorWithAlphaComponent:0.09];
[self.separatorArr addObject:separatorCenterView]; // [self.separatorArr addObject:separatorCenterView];
[self.bgView addSubview:separatorCenterView]; // [self.bgView addSubview:separatorCenterView];
} }
if (_cancelBtn.titleLabel.text.length > 0) { if (_cancelBtn.titleLabel.text.length > 0) {
...@@ -268,11 +261,17 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -268,11 +261,17 @@ static FUSAlertView *sharedAlertView = nil;
}else{ }else{
self.cancelBtn.frame = CGRectMake(btnX, nextY, btnW, 0); self.cancelBtn.frame = CGRectMake(btnX, nextY, btnW, 0);
} }
btnWholeH = BTN_HEIGHT * self.confirmBtnArr.count + self.cancelBtn.height; btnWholeH = BTN_HEIGHT * self.confirmBtnArr.count + itemSpace * (self.confirmBtnArr.count - 1) + self.cancelBtn.height;
} }
self.bgView.width = alertViewW; self.bgView.width = alertViewW;
self.bgView.height = btnWholeH + self.titleLabel.height + self.detailLabel.height + VIEW_MARGIN + TITLE_DETAIL_SPACE + DETAIL_BUTTON_SACE + 10; //10为那张图片底部的阴影渐变范围 CGFloat bgHeight = VIEW_MARGIN + self.titleLabel.height;
if (self.detailLabel.height) {
bgHeight += (TITLE_DETAIL_SPACE + self.detailLabel.height);
}
bgHeight += (DETAIL_BUTTON_SACE + btnWholeH + VIEW_MARGIN);
self.bgView.height = bgHeight;
if (!self.noMoreTipBtn.isHidden) { if (!self.noMoreTipBtn.isHidden) {
self.bgView.height += CGRectGetHeight(self.noMoreTipBtn.frame) + DETAIL_BUTTON_SACE; self.bgView.height += CGRectGetHeight(self.noMoreTipBtn.frame) + DETAIL_BUTTON_SACE;
} }
...@@ -388,7 +387,7 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -388,7 +387,7 @@ static FUSAlertView *sharedAlertView = nil;
_bgView.alpha = 0; _bgView.alpha = 0;
}]; }];
self.cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem]; [self fus_resetCancelBtn];
CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0; CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0;
widthScale > 1.0 ? widthScale = 1.0 :widthScale; //6和6plus显示的一样 widthScale > 1.0 ? widthScale = 1.0 :widthScale; //6和6plus显示的一样
...@@ -533,8 +532,8 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -533,8 +532,8 @@ static FUSAlertView *sharedAlertView = nil;
[self fus_dismissAllAlertViewWithAnimate:NO]; [self fus_dismissAllAlertViewWithAnimate:NO];
self.cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem]; [self fus_resetCancelBtn];
CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0; CGFloat widthScale = [UIScreen mainScreen].bounds.size.width/375.0;
widthScale > 1.0 ? widthScale = 1.0 : widthScale; //6和6plus显示的一样 widthScale > 1.0 ? widthScale = 1.0 : widthScale; //6和6plus显示的一样
CGFloat alertViewW = ceil(270 * widthScale); CGFloat alertViewW = ceil(270 * widthScale);
...@@ -570,6 +569,21 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -570,6 +569,21 @@ static FUSAlertView *sharedAlertView = nil;
}]; }];
} }
- (void)fus_resetCancelBtn {
if (!_cancelBtn) {
_cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
}
_cancelBtn.titleLabel.font = [UIFont fus_themeMediumFont:14];
[_cancelBtn setTitleColor:[UIColor colorWithHex:@"333333"] forState:UIControlStateNormal];
[_cancelBtn addTarget:self action:@selector(onClickBtn:) forControlEvents:UIControlEventTouchUpInside];
_cancelBtn.backgroundColor = [UIColor colorWithHex:@"#DBDAD9"];
_cancelBtn.layer.cornerRadius = BTN_HEIGHT / 2.0f;
_cancelBtn.layer.masksToBounds = YES;
_cancelBtn.tag = 0;
[_bgView addSubview:_cancelBtn];
}
+ (void)fus_dismissAllAlertViewWithAnimate:(BOOL)animate{ + (void)fus_dismissAllAlertViewWithAnimate:(BOOL)animate{
[sharedAlertView fus_dismissAllAlertViewWithAnimate:animate]; [sharedAlertView fus_dismissAllAlertViewWithAnimate:animate];
...@@ -682,15 +696,15 @@ static FUSAlertView *sharedAlertView = nil; ...@@ -682,15 +696,15 @@ static FUSAlertView *sharedAlertView = nil;
_titleLabel.text = nil; _titleLabel.text = nil;
_titleLabel.attributedText = nil; _titleLabel.attributedText = nil;
_titleLabel.textColor = [UIColor whiteColor]; _titleLabel.textColor = UIColor.fus_textColorRich;
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold]; _titleLabel.font = [UIFont fus_themeBoldFont:19];
_titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.textAlignment = NSTextAlignmentCenter;
_detailLabel.text = nil; _detailLabel.text = nil;
_detailLabel.attributedText = nil; _detailLabel.attributedText = nil;
_detailLabel.textColor = [UIColor colorWithHex:@"#E6E6E6"]; _detailLabel.textColor = [UIColor colorWithHex:@"333333"];
_detailLabel.textAlignment = NSTextAlignmentCenter; _detailLabel.textAlignment = NSTextAlignmentCenter;
_detailLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular]; _detailLabel.font = [UIFont fus_themeFont:14];
} }
@end @end
...@@ -687,9 +687,9 @@ static dispatch_queue_t get_status_queue() { ...@@ -687,9 +687,9 @@ static dispatch_queue_t get_status_queue() {
kLivePushConfigCodeModeKey:@"0", kLivePushConfigCodeModeKey:@"0",
kLivePushConfigFPSKey:@"18", kLivePushConfigFPSKey:@"18",
kLivePushConfigBeautyEnableKey:@"1", kLivePushConfigBeautyEnableKey:@"1",
kLivePushConfigMaxBitrateKey:@"1500", kLivePushConfigMaxBitrateKey:@"4000",
kLivePushConfigMinBitrateKey:@"500", kLivePushConfigMinBitrateKey:@"1000",
kLivePushConfigTargetBitrateKey:@"1000", kLivePushConfigTargetBitrateKey:@"2000",
kLivePushConfigResolutionKey:@"2", kLivePushConfigResolutionKey:@"2",
} forKey:LIVE_PUSH_CONFIG]; } forKey:LIVE_PUSH_CONFIG];
} }
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "live_room_card_invite_mic_btn@2x.png", "filename" : "上麦@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "live_room_card_invite_mic_btn@3x.png", "filename" : "上麦@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "live_room_card_invite_mic_btn_pressed@2x.png", "filename" : "上麦@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "live_room_card_invite_mic_btn_pressed@3x.png", "filename" : "上麦@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
...@@ -396,6 +396,8 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\ ...@@ -396,6 +396,8 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
_richImageView.centerX = _faceImageView.centerX; _richImageView.centerX = _faceImageView.centerX;
_richImageView.centerY = _faceImageView.bottom; _richImageView.centerY = _faceImageView.bottom;
// _richWearImageView.center = _faceImageView.center; // _richWearImageView.center = _faceImageView.center;
[_bgView addRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(16, 16)];
} }
- (void)fus_initBgView { - (void)fus_initBgView {
...@@ -775,7 +777,7 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\ ...@@ -775,7 +777,7 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
- (void)pd_setupRoomControlView { - (void)pd_setupRoomControlView {
_roomControlView = [[UIView alloc] initWithFrame:CGRectMake(0, _buttomBtnBgView.bottom, _bgView.width, ROOM_CONTROL_VIEW_HEIGHT())]; _roomControlView = [[UIView alloc] initWithFrame:CGRectMake(0, _buttomBtnBgView.bottom, _bgView.width, ROOM_CONTROL_VIEW_HEIGHT())];
_roomControlView.backgroundColor = [UIColor colorWithHex:@"#242A36"]; _roomControlView.backgroundColor = [UIColor colorWithHex:@"#F1F0F0"];
[_bgView addSubview:_roomControlView]; [_bgView addSubview:_roomControlView];
CGFloat bottonHeight = _roomControlView.height; CGFloat bottonHeight = _roomControlView.height;
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
......
...@@ -50,9 +50,6 @@ ...@@ -50,9 +50,6 @@
@end @end
@implementation FUSByteStreamCaptureHelper @implementation FUSByteStreamCaptureHelper
{
long long captureTimeCount;
}
#pragma mark - Init #pragma mark - Init
...@@ -295,6 +292,10 @@ ...@@ -295,6 +292,10 @@
{ {
videoSize = CGSizeMake(720, 1280); videoSize = CGSizeMake(720, 1280);
} }
case 4:// 1080P
{
videoSize = CGSizeMake(1080, 1920);
}
break; break;
default:// 默认 540 default:// 默认 540
videoSize = CGSizeMake(540, 960); videoSize = CGSizeMake(540, 960);
...@@ -341,9 +342,9 @@ ...@@ -341,9 +342,9 @@
// 视频帧率 // 视频帧率
_liveConfig.videoFPS = fps; _liveConfig.videoFPS = fps;
// 视频码率 // 视频码率
_liveConfig.bitrate = targetBitrate; _liveConfig.bitrate = targetBitrate * 1000;;
_liveConfig.minBitrate = minBitrate; _liveConfig.minBitrate = minBitrate * 1000;;
_liveConfig.maxBitrate = maxBitrate; _liveConfig.maxBitrate = maxBitrate * 1000;;
_liveConfig.outputSize = videoSize; _liveConfig.outputSize = videoSize;
...@@ -427,12 +428,9 @@ ...@@ -427,12 +428,9 @@
if (![FUSBeautyHelper shareInstance].beautyEngineEnable) { if (![FUSBeautyHelper shareInstance].beautyEngineEnable) {
// 没有美颜正在运行或者当前开关处于关闭状态 // 没有美颜正在运行或者当前开关处于关闭状态
// 声网采集协议正在运行 // 声网采集协议正在运行
if (self.agoraVideoSourceRuning) { // 声网采集协议正在运行
captureTimeCount += 1; if (self.videoFrameCallBackHandler) {
// 声网采集协议正在运行 self.videoFrameCallBackHandler(buffer, pts, 0);
if (self.videoFrameCallBackHandler) {
self.videoFrameCallBackHandler(buffer, pts, 0);
}
} }
[_capture pushVideoBuffer:buffer andCMTime:pts]; [_capture pushVideoBuffer:buffer andCMTime:pts];
...@@ -441,16 +439,9 @@ ...@@ -441,16 +439,9 @@
CVPixelBufferRef targetPixelBuffer = [[FUSBeautyHelper shareInstance] renderBeautyWithPixelBuffer:buffer timeStamp:(pts.value / pts.timescale)]; CVPixelBufferRef targetPixelBuffer = [[FUSBeautyHelper shareInstance] renderBeautyWithPixelBuffer:buffer timeStamp:(pts.value / pts.timescale)];
// 声网采集协议正在运行 // 声网采集协议正在运行
if (self.agoraVideoSourceRuning) { if (self.videoFrameCallBackHandler) {
captureTimeCount++; self.videoFrameCallBackHandler(buffer, pts, 0);
//CMTimeMake(captureTimeCount, 600)
// 声网采集协议正在运行
if (self.videoFrameCallBackHandler) {
self.videoFrameCallBackHandler(buffer, pts, 0);
}
} }
[_capture pushVideoBuffer:targetPixelBuffer andCMTime:pts]; [_capture pushVideoBuffer:targetPixelBuffer andCMTime:pts];
...@@ -542,8 +533,6 @@ ...@@ -542,8 +533,6 @@
/** /**
重新开始推理,不停止原来的推流 重新开始推理,不停止原来的推流
@param completion 完成回调
*/ */
- (void)fus_reloadPush - (void)fus_reloadPush
{ {
......
...@@ -57,9 +57,6 @@ typedef NS_ENUM(NSInteger, FUSStreamSessionState) ...@@ -57,9 +57,6 @@ typedef NS_ENUM(NSInteger, FUSStreamSessionState)
CMTime pts, CMTime pts,
int rotation); int rotation);
// 声网自定义视频源是否正在运行中
@property (nonatomic, assign) BOOL agoraVideoSourceRuning;
+ (FUSStreamCaptureHelper *)fus_captureHepler; + (FUSStreamCaptureHelper *)fus_captureHepler;
#pragma mark - Public Method #pragma mark - Public Method
......
...@@ -790,6 +790,23 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi ...@@ -790,6 +790,23 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi
FUSLogVerbose(@"%s",__func__); FUSLogVerbose(@"%s",__func__);
} }
- (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed {
FUSLogVerbose(@"FUSStreamPushView:%lu加入", uid);
// TODO:FUSStreamPushView:%lu加入
// [_captureHelper fus_stopStreamPush];
// [_captureHelper fus_loadlowStreamConfig];
// 创建对方图像视图
AgoraRtcVideoCanvas *otherCanvas = [[AgoraRtcVideoCanvas alloc] init];
otherCanvas.uid = uid;
otherCanvas.view = _agoraOtherPreview;
otherCanvas.renderMode = AgoraVideoRenderModeHidden;
[_agoraEngine setupRemoteVideo:otherCanvas];
_agoraOtherCanvas = otherCanvas;
}
/** The user/host has joined the channel. Same as [userJoinedBlock]([AgoraRtcEngineKit userJoinedBlock:]). /** The user/host has joined the channel. Same as [userJoinedBlock]([AgoraRtcEngineKit userJoinedBlock:]).
- Communication mode: This callback function notifies the application that another user has joined the channel. If there are other users in the channel when that user joins, the SDK also reports to the application on the existing users who are already in the channel. - Communication mode: This callback function notifies the application that another user has joined the channel. If there are other users in the channel when that user joins, the SDK also reports to the application on the existing users who are already in the channel.
...@@ -807,19 +824,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi ...@@ -807,19 +824,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi
*/ */
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed - (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed
{ {
FUSLogVerbose(@"FUSStreamPushView:%lu加入", uid);
// TODO:FUSStreamPushView:%lu加入
// [_captureHelper fus_stopStreamPush];
// [_captureHelper fus_loadlowStreamConfig];
// 创建对方图像视图
AgoraRtcVideoCanvas *otherCanvas = [[AgoraRtcVideoCanvas alloc] init];
otherCanvas.uid = uid;
otherCanvas.view = _agoraOtherPreview;
otherCanvas.renderMode = AgoraVideoRenderModeHidden;
[_agoraEngine setupRemoteVideo:otherCanvas];
_agoraOtherCanvas = otherCanvas;
FUSLogVerbose(@"%s",__func__); FUSLogVerbose(@"%s",__func__);
} }
...@@ -919,18 +923,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi ...@@ -919,18 +923,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi
FUSLogVerbose(@"%s",__func__); FUSLogVerbose(@"%s",__func__);
} }
/** The first frame of the remote user has been decoded successfully. Same as [firstRemoteVideoDecodedBlock]([AgoraRtcEngineKit firstRemoteVideoDecodedBlock:]).
@param engine AgoraRtcEngineKit object.
@param uid Remote user ID.
@param size Size of the video (width and height).
@param elapsed Time elapsed (ms) from the remote user calling [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) until this callback function is triggered.
*/
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed
{
FUSLogVerbose(@"FUSStreamPushView:第一帧解析完了");
}
/** The first remote video frame has been received and rendered. Same as [firstRemoteVideoFrameBlock]([AgoraRtcEngineKit firstRemoteVideoFrameBlock:]). /** The first remote video frame has been received and rendered. Same as [firstRemoteVideoFrameBlock]([AgoraRtcEngineKit firstRemoteVideoFrameBlock:]).
@param engine AgoraRtcEngineKit object. @param engine AgoraRtcEngineKit object.
...@@ -963,35 +955,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi ...@@ -963,35 +955,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi
FUSLogVerbose(@"%s",__func__); FUSLogVerbose(@"%s",__func__);
} }
/** Enables/disables the local video function of a specified user.
This method is only applicable to the scenario when the specified user only wants to watch the remote video without sending any video stream to the other user.
@param engine AgoraRtcEngineKit object.
@param enabled Enable or disable the local video function of a specified user:
* YES: Enabled. Other users in the channel can see the video of the specified user.
* NO: Disabled. Other users in the channel do not receive the video stream from the specified user, while the specified user can still receive the video streams from other users.
@param uid ID of the specified user.
*/
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid
{
FUSLogVerbose(@"%s",__func__);
}
/** The video size or rotation of a specified remote user has changed.
@param engine AgoraRtcEngineKit object
@param uid User ID of the remote user or local user (0) whose video size or rotation has changed
@param size New video size
@param rotation New rotation of the video (0 to 360)
*/
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation
{
FUSLogVerbose(@"%s",__func__);
}
/** The remote video stream state has changed. /** The remote video stream state has changed.
@param engine AgoraRtcEngineKit object @param engine AgoraRtcEngineKit object
...@@ -1047,18 +1010,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi ...@@ -1047,18 +1010,6 @@ NSString * const kStreamRTCDidOfflineNotification = @"kStreamRTCDidOfflineNotifi
FUSLogVerbose(@"%s",__func__); FUSLogVerbose(@"%s",__func__);
} }
/** The statistics of the uploading local video streams.
Same as [localVideoStatBlock]([AgoraRtcEngineKit localVideoStatBlock:]). This method reports the statistics of the local video streams once every two seconds.
@param engine AgoraRtcEngineKit object.
@param stats Statistics of the uploading local video streams: AgoraRtcLocalVideoStats
*/
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats
{
FUSLogVerbose(@"%s",__func__);
}
/** The statistics of the receiving remote video streams. /** The statistics of the receiving remote video streams.
The SDK updates the application on the statistics of receiving remote video streams for each user/host once every 2 seconds. The SDK updates the application on the statistics of receiving remote video streams for each user/host once every 2 seconds.
......
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