123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739 |
- //
- // playerSetView.m
- // 双子星云手机
- //
- // Created by xd h on 2024/6/24.
- //
- #import "playerSetView.h"
- #import "SYJUISwitch.h"
- @interface playerSetView ()
- @property(nonatomic, strong)UIView* blackBgView;
- @property(nonatomic, strong)UIView *bg0View;//1.4.4 新加分辨率
- @property(nonatomic, strong) UIButton *resolution720Button;
- @property(nonatomic, strong) UIButton *resolution1080Button;
- @property(nonatomic,strong) CAGradientLayer *glayer;
- @property(nonatomic, strong) UIView *bg1View;
- @property(nonatomic, strong) SYJUISwitch * bottomNavSwitch;//底部导航栏开关
- @property(nonatomic, strong) SYJUISwitch * fullScreenSwitch;//全面屏开关
- @property(nonatomic, strong) UIButton *TVButton;
- @property(nonatomic, strong) UILabel *TVShowLabel;
- @property(nonatomic, strong) UIButton *exitPhoneButton;
- @property(nonatomic, strong) UILabel *delayedLabel;//延时
- @property(nonatomic, strong) UILabel *PacketLossLabel;//丢包
- @property(nonatomic, strong) UILabel *speedLabel;//速度(带宽)
- @property(nonatomic, strong) UILabel *fpsLabel;
- @end
- @implementation playerSetView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneTvStatusFun:) name:getCouldPhoneTvStatusNotification object:nil];
-
- [self drawAnyView];
-
- return self;
- }
- - (void)drawAnyView{
-
- //扩大金融云机范围按钮
- UIButton *bigButton = [[UIButton alloc] init];
- bigButton.tag = 1;
- [bigButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:bigButton];
- //bigButton.backgroundColor = [UIColor greenColor];
-
- [bigButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.left.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- }];
-
- _blackBgView = [UIView new];
- _blackBgView.layer.cornerRadius = 20;
- _blackBgView.backgroundColor = [UIColor hwColor:@"#202630"];
- [self addSubview:_blackBgView];
-
- [_blackBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(260 + 50);//(256);
- make.width.mas_equalTo(320);//(245);
- make.centerX.mas_equalTo(0.f);
- make.centerY.mas_equalTo(0.f);
- }];
-
-
- /***************************顶部按钮显示*******************************************************/
-
- CGFloat laberTop = 24.0;
- CGFloat laberW = 30.0;
- CGFloat laberH = 16.0;
-
- //延迟
- // UILabel * delayedTipLabel = [[UILabel alloc] init];
- // delayedTipLabel.font = [UIFont systemFontOfSize:12.0];
- // delayedTipLabel.textColor = [UIColor whiteColor];
- // delayedTipLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
- // [_blackBgView addSubview:delayedTipLabel];
- // //delayedTipLabel.backgroundColor = [UIColor redColor];
- //
- // [delayedTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.mas_equalTo(15);
- // make.width.mas_equalTo(laberW);
- // make.height.mas_equalTo(laberH);
- // make.top.mas_equalTo(laberTop);
- // }];
-
- CGFloat fontSize = 12.0;
-
- ///获取设备当前地区的代码和APP语言环境
- NSString *languageCode = [NSLocale preferredLanguages][0];
- BOOL isForeignType = NO;
- //目前支持 中文(简体 繁体) 英文 日语
- if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
- {
- }
- else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
- {
- }
- else{
- isForeignType = YES;
- fontSize = 10.5;
- }
-
- _delayedLabel = [[UILabel alloc] init];
- _delayedLabel.font = [UIFont systemFontOfSize:fontSize];
- //_delayedLabel.textColor = [UIColor whiteColor];
- //_delayedLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
- [_blackBgView addSubview:_delayedLabel];
- //_delayedLabel.backgroundColor = [UIColor redColor];
-
- [_delayedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- //make.width.mas_equalTo(laberW+5);
- make.height.mas_equalTo(laberH);
- make.top.mas_equalTo(laberTop);
- }];
-
- //丢包
- // UILabel * PacketLossTipLabel = [[UILabel alloc] init];
- // PacketLossTipLabel.font = [UIFont systemFontOfSize:12.0];
- // PacketLossTipLabel.textColor = [UIColor whiteColor];
- // PacketLossTipLabel.text = NSLocalizedString(@"webrtc_msg_PacketLoss",nil);
- // [blackBgView addSubview:PacketLossTipLabel];
- // //delayedTipLabel.backgroundColor = [UIColor redColor];
- //
- // [PacketLossTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerX.mas_equalTo(- 1.5*laberW -10);
- // make.width.mas_equalTo(laberW);
- // make.height.mas_equalTo(laberH);
- // make.top.mas_equalTo(laberTop);
- // }];
- //
- _PacketLossLabel = [[UILabel alloc] init];
- _PacketLossLabel.font = [UIFont systemFontOfSize:fontSize];
- _PacketLossLabel.textAlignment = NSTextAlignmentCenter;
- _PacketLossLabel.textColor = [UIColor whiteColor];//[UIColor hwColor:@"#FF2855"];
- //_PacketLossLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
- [_blackBgView addSubview:_PacketLossLabel];
- //_PacketLossLabel.backgroundColor = [UIColor redColor];
-
- [_PacketLossLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- //make.left.mas_equalTo(PacketLossTipLabel.mas_right).offset(0);
- make.centerX.mas_equalTo(self.mas_centerX);
- //make.width.mas_equalTo(laberW*3.0);
- make.height.mas_equalTo(laberH);
- make.top.mas_equalTo(laberTop);
- }];
- //带宽
- // UILabel * speedLossTipLabel = [[UILabel alloc] init];
- // speedLossTipLabel.font = [UIFont systemFontOfSize:12.0];
- // speedLossTipLabel.textColor = [UIColor whiteColor];
- // speedLossTipLabel.text = NSLocalizedString(@"webrtc_msg_speed",nil);
- // [blackBgView addSubview:speedLossTipLabel];
- // //speedLossTipLabel.backgroundColor = [UIColor redColor];
- //
- // [speedLossTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.centerX.mas_equalTo(1.5*laberW -10);
- // make.width.mas_equalTo(laberW +10 );
- // make.height.mas_equalTo(laberH);
- // make.top.mas_equalTo(laberTop);
- // }];
-
- _speedLabel = [[UILabel alloc] init];
- _speedLabel.font = [UIFont systemFontOfSize:fontSize];
- _speedLabel.textColor = [UIColor whiteColor];
- _speedLabel.textAlignment = NSTextAlignmentRight;
- //_speedLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
- [_blackBgView addSubview:_speedLabel];
- //_speedLabel.backgroundColor = [UIColor redColor];
-
- [_speedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- //make.centerX.mas_equalTo(1.5*laberW);
- //make.centerX.mas_equalTo(self.mas_centerX);
- make.right.mas_equalTo(-15);
- //make.width.mas_equalTo(laberW*3.0);
- make.height.mas_equalTo(laberH);
- make.top.mas_equalTo(laberTop);
- }];
-
- //fps
- // UILabel * fpsTipLabel = [[UILabel alloc] init];
- // fpsTipLabel.font = [UIFont systemFontOfSize:12.0];
- // fpsTipLabel.textColor = [UIColor whiteColor];
- // fpsTipLabel.text = @"FPS:";
- // [blackBgView addSubview:fpsTipLabel];
- // //speedLossTipLabel.backgroundColor = [UIColor redColor];
- //
- // [fpsTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.mas_equalTo(- 15 - 0.5*laberW);
- // make.width.mas_equalTo(laberW);
- // make.height.mas_equalTo(laberH);
- // make.top.mas_equalTo(laberTop);
- // }];
-
- //_fpsLabel = [[UILabel alloc] init];
- // _fpsLabel.textAlignment = NSTextAlignmentRight;
- // _fpsLabel.font = [UIFont systemFontOfSize:12.0];
- // _fpsLabel.textColor = [UIColor whiteColor];
- // //_fpsLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
- // [_blackBgView addSubview:_fpsLabel];
- // //_fpsLabel.backgroundColor = [UIColor redColor];
- //
- // [_fpsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.mas_equalTo(-15);
- // make.width.mas_equalTo(laberW*2);
- // make.height.mas_equalTo(laberH);
- // make.top.mas_equalTo(laberTop);
- // }];
-
- [self setWebRctMsgBydelayed:0 withPacketLoss:0.0 withSpeed:@"-" withFPS:@"-"];
-
- /***************************分辨率*******************************************************/
-
- _bg0View = [UIView new];
- _bg0View.layer.cornerRadius = 8;
- _bg0View.backgroundColor = [UIColor hwColor:@"#29313D"];
- [_blackBgView addSubview:_bg0View];
-
- [_bg0View mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(36);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- //make.top.mas_equalTo(16.f);
- make.top.mas_equalTo(62.f);
- }];
-
- //分辨率
- UILabel *resolutionTipLabel = [[UILabel alloc] init];
- resolutionTipLabel.text = NSLocalizedString(@"cloudPhone_player_set_resolution",nil);
- resolutionTipLabel.textColor = [UIColor whiteColor];
- resolutionTipLabel.font = [UIFont systemFontOfSize:12.0];
- [_bg0View addSubview:resolutionTipLabel];
-
- [resolutionTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.top.equalTo(_bg0View.mas_top).offset(0);
- make.bottom.equalTo(_bg0View.mas_bottom).offset(0);
- }];
-
- _resolution720Button = [[UIButton alloc] init];
- _resolution720Button.layer.cornerRadius = 5;
- _resolution720Button.backgroundColor = [UIColor hwColor:@"#D8D8D8" alpha:0.09];
- [_resolution720Button setTitle:@"720*1280" forState:UIControlStateNormal];
- [_resolution720Button setTitleColor:[UIColor hwColor:@"#FFFFFF"] forState:UIControlStateNormal];
- _resolution720Button.titleLabel.font = [UIFont systemFontOfSize:12.0];
- _resolution720Button.layer.masksToBounds = YES;
- [_resolution720Button addTarget:self action:@selector(didClickResolution720ButFun) forControlEvents:UIControlEventTouchUpInside];
- [_bg0View addSubview:_resolution720Button];
-
- [_resolution720Button mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(80);
- make.width.mas_equalTo(93);
- make.height.mas_equalTo(26);
- make.centerY.mas_equalTo(0);
- }];
-
- _resolution1080Button = [[UIButton alloc] init];
- _resolution1080Button.layer.cornerRadius = 5;
- _resolution1080Button.backgroundColor = [UIColor hwColor:@"#D8D8D8" alpha:0.09];
- [_resolution1080Button setTitle:@"1080*1920" forState:UIControlStateNormal];
- [_resolution1080Button setTitleColor:[UIColor hwColor:@"#FFFFFF"] forState:UIControlStateNormal];
- _resolution1080Button.titleLabel.font = [UIFont systemFontOfSize:12.0];
- _resolution1080Button.layer.masksToBounds = YES;
- [_resolution1080Button addTarget:self action:@selector(didClickResolution1080ButFun) forControlEvents:UIControlEventTouchUpInside];
- [_bg0View addSubview:_resolution1080Button];
-
- [_resolution1080Button mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-12);
- make.width.mas_equalTo(93);
- make.height.mas_equalTo(26);
- make.centerY.mas_equalTo(0);
- }];
-
- // gradient
- _glayer = [CAGradientLayer layer];
- _glayer.frame = CGRectMake(0, 0, 93, 26);
- _glayer.startPoint = CGPointMake(0, 0.5);
- _glayer.endPoint = CGPointMake(0.97, 0.5);
- _glayer.colors = @[(__bridge id)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge id)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
- _glayer.locations = @[@(0), @(1.0f)];
-
- [self firstSetResolutionFun];
-
- /***************************全面屏相关*******************************************************/
- _bg1View = [UIView new];
- // bg1View.layer.cornerRadius = 12;
- // bg1View.backgroundColor = [UIColor hwColor:@"#29313D"];
- [_blackBgView addSubview:_bg1View];
-
- [_bg1View mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(42);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.top.mas_equalTo(112.f);
- //make.top.mas_equalTo(54.f);
- }];
-
- UIView *bgBottomNavView = [UIView new];
- bgBottomNavView.layer.cornerRadius = 8;
- bgBottomNavView.backgroundColor = [UIColor hwColor:@"#29313D"];
- [_blackBgView addSubview:bgBottomNavView];
-
- [bgBottomNavView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.mas_equalTo(_bg1View.mas_bottom);
- make.left.mas_equalTo(12);
- make.right.equalTo(self.mas_centerX).offset(-6);
- //make.top.mas_equalTo(16.f);
- make.top.mas_equalTo(_bg1View.mas_top);
- }];
-
- UILabel *navSwitchTipLabel = [[UILabel alloc] init];
- navSwitchTipLabel.text = NSLocalizedString(@"cloudPhone_nav_show_tip",nil);
- //navSwitchTipLabel.textAlignment = NSTextAlignmentCenter;
- navSwitchTipLabel.textColor = [UIColor whiteColor];
- navSwitchTipLabel.font = [UIFont systemFontOfSize:12.0];
- [bgBottomNavView addSubview:navSwitchTipLabel];
-
- [navSwitchTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.top.equalTo(bgBottomNavView.mas_top).offset(0);
- make.bottom.equalTo(bgBottomNavView.mas_bottom).offset(0);
- }];
-
- //底部导航栏开关
- _bottomNavSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
- _bottomNavSwitch.onTintColor = HW13B2EBColor;
- _bottomNavSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
- [_bottomNavSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
- [bgBottomNavView addSubview:_bottomNavSwitch];
- [_bottomNavSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-15.f);
- make.centerY.mas_equalTo(0.f);
- make.width.mas_equalTo(44.f);
- make.height.mas_equalTo(22.f);
- }];
-
-
- //全面屏开关
- UIView *bgFullScreenView = [UIView new];
- bgFullScreenView.layer.cornerRadius = 8;
- bgFullScreenView.backgroundColor = [UIColor hwColor:@"#29313D"];
- [_blackBgView addSubview:bgFullScreenView];
-
- [bgFullScreenView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.mas_equalTo(_bg1View.mas_bottom);
- make.right.mas_equalTo(-12);
- make.left.equalTo(self.mas_centerX).offset(6);
- //make.top.mas_equalTo(16.f);
- make.top.mas_equalTo(_bg1View.mas_top);
- }];
-
- UILabel *fullScreenTipLabel = [[UILabel alloc] init];
- fullScreenTipLabel.text = NSLocalizedString(@"cloudPhone_fullScreen_show_tip",nil);
- //fullScreenTipLabel.textAlignment = NSTextAlignmentCenter;
- fullScreenTipLabel.textColor = [UIColor whiteColor];
- fullScreenTipLabel.font = [UIFont systemFontOfSize:12.0];
- [bgFullScreenView addSubview:fullScreenTipLabel];
-
- [fullScreenTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.top.equalTo(bgFullScreenView.mas_top).offset(0);
- make.bottom.equalTo(bgFullScreenView.mas_bottom).offset(0);
- }];
-
- _fullScreenSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
- _fullScreenSwitch.onTintColor = HW13B2EBColor;
- _fullScreenSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
- [_fullScreenSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
- [bgFullScreenView addSubview:_fullScreenSwitch];
- [_fullScreenSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-15.f);
- make.centerY.mas_equalTo(0.f);
- make.width.mas_equalTo(44.f);
- make.height.mas_equalTo(22.f);
- }];
-
-
-
- KWeakSelf
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf setAllSwitchFun];
- });
-
-
- /**********************************************************************************/
- UIView *bg2View = [UIView new];
- bg2View.layer.cornerRadius = 12;
- bg2View.backgroundColor = [UIColor hwColor:@"#29313D"];
- [_blackBgView addSubview:bg2View];
-
- [bg2View mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(72);
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- make.top.equalTo(_bg1View.mas_bottom).offset(12);
- //make.top.mas_equalTo(52);
- }];
-
-
- NSArray *titleArr = @[NSLocalizedString(@"cloudPhone_set_screenshot_tip",nil),
- NSLocalizedString(@"my_set_no_TV_p2p",nil),
- //NSLocalizedString(@"my_set_no_close_TV_p2p",nil),
- NSLocalizedString(@"my_set_no_restart_phone",nil),
- //NSLocalizedString(@"cloudPhone_set_exit_tip",nil),
- ];
-
- NSArray *imageArr = @[@"cloudPhone_set_screenshot",
- @"cloudPhone_set_TV",
- @"cloudPhone_set_restart",
- //@"cloudPhone_set_exit",
- ];
-
-
- CGFloat butTopY = 15.0;
- CGFloat imageWH = 24.0;
-
- CGFloat butHeight = imageWH +20 +5;
- CGFloat butWidth = (320 -15*2)/3.0; //70.0;
- //CGFloat butWidth = (245 -12*2)/2.0; //70.0;
- CGFloat butSpace = 0.0; //(245 - butWidth*3)/3.0;
-
- for (int i=0; i<titleArr.count; i++) {
-
- UIButton *but = [[UIButton alloc] init];
- //but.tag = 10+i;
- but.tag = 200+i;
- [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [bg2View addSubview:but];
- //but.backgroundColor = [UIColor greenColor];
-
- [but mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(butSpace + (butWidth+butSpace)*(i%4));
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(butHeight);
- make.top.mas_equalTo(butTopY + (i/4)* (butHeight + 25) );
- }];
-
- UIImageView *imageV = [[UIImageView alloc] init];
- imageV.image = [UIImage imageNamed:imageArr[i]];
- [but addSubview:imageV];
-
- [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(imageWH);
- make.height.mas_equalTo(imageWH);
- make.top.mas_equalTo(0);
- }];
-
- NSString *curText = titleArr[i];
- if(isForeignType && i==2){
- curText = [curText stringByReplacingOccurrencesOfString:@" cloudPhone" withString:@""];
- }
-
- UILabel *textLabel = [[UILabel alloc] init];
- textLabel.textAlignment = NSTextAlignmentCenter;
- textLabel.font = [UIFont systemFontOfSize:12];
- textLabel.textColor = [UIColor whiteColor];
- textLabel.text = curText;
- [but addSubview:textLabel];
- //textLabel.backgroundColor = [UIColor redColor];
-
- [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(20);
- make.top.equalTo(imageV.mas_bottom).offset(0);
- }];
-
- if(i==1){
- _TVButton = but;
- _TVShowLabel = textLabel;
-
- [self getCouldPhoneTvStatusFun:nil];
- }
-
- }
-
- /**********************************************************************************/
-
- NSString *titleStr = [[NSString alloc] initWithFormat:@" %@",NSLocalizedString(@"cloudPhone_set_exit_tip",nil)];
- _exitPhoneButton = [[UIButton alloc] init];
- _exitPhoneButton.tag = 100;
- [_exitPhoneButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [_exitPhoneButton setTitle:titleStr forState:(UIControlStateNormal)];
- [_exitPhoneButton setImage:[UIImage imageNamed:@"cloudPhone_set_exit"] forState:UIControlStateNormal];
- _exitPhoneButton.layer.cornerRadius = 12;
- [_exitPhoneButton.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
- _exitPhoneButton.backgroundColor = [UIColor hwColor:@"#29313D"];
- [_blackBgView addSubview:_exitPhoneButton];
-
- // if(ksharedAppDelegate.TvStatusMod.isTVShowType){
- // _TVButton.selected = YES;
- // }
-
- [_exitPhoneButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(42);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.top.equalTo(bg2View.mas_bottom).offset(12);
- }];
-
- [self handleResolutionUIFun];
- }
- - (void)setAllSwitchFun
- {
- BOOL haveShowBottonNavType = ![HWDataManager getBoolWithKey:Consn_player_Nav_hide];
- [_bottomNavSwitch setOn:haveShowBottonNavType];
-
- BOOL fullscreenType = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
- [_fullScreenSwitch setOn:fullscreenType];
- }
- - (void)maskSwitchPressed:(SYJUISwitch *)maskSwitch{
- if(_bottomNavSwitch == maskSwitch){
- if (maskSwitch.on) {
- [HWDataManager setBoolWithKey:Consn_player_Nav_hide value:NO];
- }
- else{
- [HWDataManager setBoolWithKey:Consn_player_Nav_hide value:YES];
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:getPlayerBottomNavNotification object:nil];
- }
- else if (_fullScreenSwitch == maskSwitch){
-
- BOOL isTVShowType = ksharedAppDelegate.TvStatusMod.isTVShowType;
- if(isTVShowType){
- [[iToast makeText:NSLocalizedString(@"cloudPhone_tvShow_before_fullscreen_tip",nil)] show];
- [self removeFun];
- return;
- }
-
- if (maskSwitch.on) {
- [HWDataManager setBoolWithKey:Consn_player_full_screen_show value:YES];
- //数据埋点
- [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_on"];
- }
- else{
- [HWDataManager setBoolWithKey:Consn_player_full_screen_show value:NO];
- //数据埋点
- [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_off"];
- }
-
- [self handleResolutionUIFun];
- [[NSNotificationCenter defaultCenter] postNotificationName:setPlayerFullScreenNotification object:nil];
- }
-
- //[self removeFun];
- }
- #pragma mark 按钮事件
- - (void)didClickButtonFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
- HLog(@"%ld",tag);
-
- [self removeFun];
- if(tag == 1){
- return;
- }
-
- if(tag == 201 && but.selected){
- tag = 301;
- }
-
- if(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- - (void)removeFun
- {
- [self removeFromSuperview];
- }
- - (void)getCouldPhoneTvStatusFun:(NSNotification*)not
- {
- if(ksharedAppDelegate.TvStatusMod.isTVShowType){
- _TVButton.selected = YES;
- _TVShowLabel.text = NSLocalizedString(@"my_set_no_close_TV_p2p",nil);
- }
- else{
- _TVButton.selected = NO;
- _TVShowLabel.text = NSLocalizedString(@"my_set_no_TV_p2p",nil);
- }
- }
- - (void)setWebRctMsgBydelayed:(NSInteger)delayedMS withPacketLoss:(double)PacketLoss withSpeed:(NSString*)speedStr withFPS:(NSString*)fpsStr
- {
- //网络延迟: [0, 50ms)= 绿色 #22A082 ,[50ms, 100ms= 黄色, [100ms, ∞)= 红色 #FF2855
-
- if (delayedMS >= 100) {
- _delayedLabel.textColor = [UIColor hwColor:@"#FF2855"];
- }
- else if (delayedMS >= 50){
- _delayedLabel.textColor = [UIColor yellowColor];
- }
- else{
- _delayedLabel.textColor = [UIColor hwColor:@"22A082"];
- }
-
- if(delayedMS >= 1000){
- _delayedLabel.text = [[NSString alloc] initWithFormat:@"%lds",delayedMS/1000];
- }
- else{
- _delayedLabel.text = [[NSString alloc] initWithFormat:@"%ldms",delayedMS];
- }
-
- NSString * delayedStr = @"";
- if(delayedMS >= 1000){
- delayedStr = [[NSString alloc] initWithFormat:@"%lds",delayedMS/1000];
- }
- else{
- delayedStr = [[NSString alloc] initWithFormat:@"%ldms",delayedMS];
- }
-
- NSString*leftStr = NSLocalizedString(@"webrtc_msg_delayed",nil);
-
- NSString *fullTitle = [[NSString alloc] initWithFormat:@"%@%@",leftStr,delayedStr];
- NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:fullTitle];
- NSRange leftRange = NSMakeRange([fullTitle rangeOfString:leftStr].location, [fullTitle rangeOfString:leftStr].length);
- [attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:leftRange];
- _delayedLabel.attributedText = attrStr;
-
- NSString*LossleftStr = NSLocalizedString(@"webrtc_msg_PacketLoss",nil);
- NSString*LossRightStr = [[NSString alloc] initWithFormat:@"%.02f%%",PacketLoss];
- NSString *LossfullTitle = [[NSString alloc] initWithFormat:@"%@%@",LossleftStr,LossRightStr];
- NSMutableAttributedString *attrStr2 = [[NSMutableAttributedString alloc] initWithString:LossfullTitle];
- NSRange rightRange = NSMakeRange([LossfullTitle rangeOfString:LossRightStr].location, LossRightStr.length);
- UIColor *rightColor = [UIColor hwColor:@"22A082"];
- if(PacketLoss >= 5 && PacketLoss < 10){
- rightColor = [UIColor yellowColor];
- }
- else if(PacketLoss >= 10){
- rightColor = [UIColor hwColor:@"#FF2855"];
- }
-
- [attrStr2 addAttribute:NSForegroundColorAttributeName value:rightColor range:rightRange];
- _PacketLossLabel.attributedText = attrStr2;
-
- _speedLabel.text = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"webrtc_msg_speed",nil),speedStr];
- //_fpsLabel.text = [[NSString alloc] initWithFormat:@"FPS:%@",fpsStr];
- }
- #pragma mark 设置分辨率
- - (void)firstSetResolutionFun
- {
- NSInteger curResolution = [HWDataManager getIntegerWithKey:Const_cloudPhone_cur_resolution];
- if(curResolution == 0 || curResolution == 1){
- _resolution720Button.selected = YES;
- [_resolution720Button.layer insertSublayer:_glayer atIndex:0];
- }
- else{
- _resolution1080Button.selected = YES;
- [_resolution1080Button.layer insertSublayer:_glayer atIndex:0];
- }
- }
- #pragma mark 是否要显示设置分辨率(全面屏要隐藏)
- - (void)handleResolutionUIFun
- {
- BOOL isHide = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
- if (isHide) {
- [_blackBgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(260);//(256);
- }];
-
- _bg0View.hidden = YES;
-
- [_bg1View mas_updateConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(62);
- }];
- }
- else{
-
- [_blackBgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(260 + 50);//(256);
- }];
-
- _bg0View.hidden = NO;
-
- [_bg1View mas_updateConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(112);
- }];
- }
- }
- #pragma mark 点击了分辨率720
- - (void)didClickResolution720ButFun
- {
- if(_resolution720Button.selected){
- return;
- }
-
- _resolution1080Button.selected = NO;
- _resolution720Button.selected = YES;
- [_resolution720Button.layer insertSublayer:_glayer atIndex:0];
-
- if(_didClickButtonFun){
- _didClickButtonFun(1);
- }
-
- [HWDataManager setIntegerWithKey:Const_cloudPhone_cur_resolution value:1];
- }
- #pragma mark 点击了分辨率1080
- - (void)didClickResolution1080ButFun
- {
- if(_resolution1080Button.selected){
- return;
- }
- _resolution720Button.selected = NO;
- _resolution1080Button.selected = YES;
- [_resolution1080Button.layer insertSublayer:_glayer atIndex:0];
-
- if(_didClickButtonFun){
- _didClickButtonFun(2);
- }
-
- [HWDataManager setIntegerWithKey:Const_cloudPhone_cur_resolution value:2];
- }
- @end
|