playerSetView.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. //
  2. // playerSetView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/24.
  6. //
  7. #import "playerSetView.h"
  8. #import "SYJUISwitch.h"
  9. @interface playerSetView ()
  10. @property(nonatomic, strong) SYJUISwitch * bottomNavSwitch;//底部导航栏开关
  11. @property(nonatomic, strong) SYJUISwitch * fullScreenSwitch;//全面屏开关
  12. @property(nonatomic, strong) UIButton *TVButton;
  13. @property(nonatomic, strong) UILabel *TVShowLabel;
  14. @property(nonatomic, strong) UIButton *exitPhoneButton;
  15. @property(nonatomic, strong) UILabel *delayedLabel;//延时
  16. @property(nonatomic, strong) UILabel *PacketLossLabel;//丢包
  17. @property(nonatomic, strong) UILabel *speedLabel;//速度(带宽)
  18. @property(nonatomic, strong) UILabel *fpsLabel;
  19. @end
  20. @implementation playerSetView
  21. - (id)initWithFrame:(CGRect)frame{
  22. self = [super initWithFrame:frame];
  23. self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
  24. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneTvStatusFun:) name:getCouldPhoneTvStatusNotification object:nil];
  25. [self drawAnyView];
  26. return self;
  27. }
  28. - (void)drawAnyView{
  29. //扩大金融云机范围按钮
  30. UIButton *bigButton = [[UIButton alloc] init];
  31. bigButton.tag = 1;
  32. [bigButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  33. [self addSubview:bigButton];
  34. //bigButton.backgroundColor = [UIColor greenColor];
  35. [bigButton mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.top.mas_equalTo(0);
  37. make.right.mas_equalTo(0);
  38. make.left.mas_equalTo(0);
  39. make.bottom.mas_equalTo(0);
  40. }];
  41. UIView* blackBgView = [UIView new];
  42. blackBgView.layer.cornerRadius = 20;
  43. blackBgView.backgroundColor = [UIColor hwColor:@"#202630"];
  44. [self addSubview:blackBgView];
  45. [blackBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.height.mas_equalTo(260);//(256);
  47. make.width.mas_equalTo(320);//(245);
  48. make.centerX.mas_equalTo(0.f);
  49. make.centerY.mas_equalTo(0.f);
  50. }];
  51. /***************************顶部按钮显示*******************************************************/
  52. CGFloat laberTop = 24.0;
  53. CGFloat laberW = 30.0;
  54. CGFloat laberH = 16.0;
  55. //延迟
  56. UILabel * delayedTipLabel = [[UILabel alloc] init];
  57. delayedTipLabel.font = [UIFont systemFontOfSize:12.0];
  58. delayedTipLabel.textColor = [UIColor whiteColor];
  59. delayedTipLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
  60. [blackBgView addSubview:delayedTipLabel];
  61. //delayedTipLabel.backgroundColor = [UIColor redColor];
  62. [delayedTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.left.mas_equalTo(15);
  64. make.width.mas_equalTo(laberW);
  65. make.height.mas_equalTo(laberH);
  66. make.top.mas_equalTo(laberTop);
  67. }];
  68. _delayedLabel = [[UILabel alloc] init];
  69. _delayedLabel.font = [UIFont systemFontOfSize:12.0];
  70. //_delayedLabel.textColor = [UIColor whiteColor];
  71. //_delayedLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
  72. [blackBgView addSubview:_delayedLabel];
  73. //_delayedLabel.backgroundColor = [UIColor redColor];
  74. [_delayedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.mas_equalTo(delayedTipLabel.mas_right).offset(0);
  76. //make.width.mas_equalTo(laberW+5);
  77. make.height.mas_equalTo(laberH);
  78. make.top.mas_equalTo(laberTop);
  79. }];
  80. //丢包
  81. // UILabel * PacketLossTipLabel = [[UILabel alloc] init];
  82. // PacketLossTipLabel.font = [UIFont systemFontOfSize:12.0];
  83. // PacketLossTipLabel.textColor = [UIColor whiteColor];
  84. // PacketLossTipLabel.text = NSLocalizedString(@"webrtc_msg_PacketLoss",nil);
  85. // [blackBgView addSubview:PacketLossTipLabel];
  86. // //delayedTipLabel.backgroundColor = [UIColor redColor];
  87. //
  88. // [PacketLossTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  89. // make.centerX.mas_equalTo(- 1.5*laberW -10);
  90. // make.width.mas_equalTo(laberW);
  91. // make.height.mas_equalTo(laberH);
  92. // make.top.mas_equalTo(laberTop);
  93. // }];
  94. //
  95. // _PacketLossLabel = [[UILabel alloc] init];
  96. // _PacketLossLabel.font = [UIFont systemFontOfSize:12.0];
  97. // _PacketLossLabel.textColor = [UIColor hwColor:@"#FF2855"];
  98. // //_PacketLossLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
  99. // [blackBgView addSubview:_PacketLossLabel];
  100. // //_PacketLossLabel.backgroundColor = [UIColor redColor];
  101. //
  102. // [_PacketLossLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  103. // make.left.mas_equalTo(PacketLossTipLabel.mas_right).offset(0);
  104. // make.width.mas_equalTo(laberW+5);
  105. // make.height.mas_equalTo(laberH);
  106. // make.top.mas_equalTo(laberTop);
  107. // }];
  108. //带宽
  109. // UILabel * speedLossTipLabel = [[UILabel alloc] init];
  110. // speedLossTipLabel.font = [UIFont systemFontOfSize:12.0];
  111. // speedLossTipLabel.textColor = [UIColor whiteColor];
  112. // speedLossTipLabel.text = NSLocalizedString(@"webrtc_msg_speed",nil);
  113. // [blackBgView addSubview:speedLossTipLabel];
  114. // //speedLossTipLabel.backgroundColor = [UIColor redColor];
  115. //
  116. // [speedLossTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  117. // make.centerX.mas_equalTo(1.5*laberW -10);
  118. // make.width.mas_equalTo(laberW +10 );
  119. // make.height.mas_equalTo(laberH);
  120. // make.top.mas_equalTo(laberTop);
  121. // }];
  122. _speedLabel = [[UILabel alloc] init];
  123. _speedLabel.font = [UIFont systemFontOfSize:12.0];
  124. _speedLabel.textColor = [UIColor whiteColor];
  125. //_speedLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
  126. [blackBgView addSubview:_speedLabel];
  127. //_speedLabel.backgroundColor = [UIColor redColor];
  128. [_speedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  129. //make.centerX.mas_equalTo(1.5*laberW);
  130. make.centerX.mas_equalTo(self.mas_centerX);
  131. make.width.mas_equalTo(laberW*2.9);
  132. make.height.mas_equalTo(laberH);
  133. make.top.mas_equalTo(laberTop);
  134. }];
  135. //fps
  136. // UILabel * fpsTipLabel = [[UILabel alloc] init];
  137. // fpsTipLabel.font = [UIFont systemFontOfSize:12.0];
  138. // fpsTipLabel.textColor = [UIColor whiteColor];
  139. // fpsTipLabel.text = @"FPS:";
  140. // [blackBgView addSubview:fpsTipLabel];
  141. // //speedLossTipLabel.backgroundColor = [UIColor redColor];
  142. //
  143. // [fpsTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  144. // make.right.mas_equalTo(- 15 - 0.5*laberW);
  145. // make.width.mas_equalTo(laberW);
  146. // make.height.mas_equalTo(laberH);
  147. // make.top.mas_equalTo(laberTop);
  148. // }];
  149. _fpsLabel = [[UILabel alloc] init];
  150. _fpsLabel.textAlignment = NSTextAlignmentRight;
  151. _fpsLabel.font = [UIFont systemFontOfSize:12.0];
  152. _fpsLabel.textColor = [UIColor whiteColor];
  153. //_fpsLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
  154. [blackBgView addSubview:_fpsLabel];
  155. //_fpsLabel.backgroundColor = [UIColor redColor];
  156. [_fpsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  157. make.right.mas_equalTo(-15);
  158. make.width.mas_equalTo(laberW*2);
  159. make.height.mas_equalTo(laberH);
  160. make.top.mas_equalTo(laberTop);
  161. }];
  162. [self setWebRctMsgBydelayed:0 withPacketLoss:@"-" withSpeed:@"-" withFPS:@"-"];
  163. /***************************全面屏相关*******************************************************/
  164. UIView *bg1View = [UIView new];
  165. // bg1View.layer.cornerRadius = 12;
  166. // bg1View.backgroundColor = [UIColor hwColor:@"#29313D"];
  167. [blackBgView addSubview:bg1View];
  168. [bg1View mas_makeConstraints:^(MASConstraintMaker *make) {
  169. make.height.mas_equalTo(42);
  170. make.left.mas_equalTo(12);
  171. make.right.mas_equalTo(-12);
  172. //make.top.mas_equalTo(16.f);
  173. make.top.mas_equalTo(54.f);
  174. }];
  175. UIView *bgBottomNavView = [UIView new];
  176. bgBottomNavView.layer.cornerRadius = 8;
  177. bgBottomNavView.backgroundColor = [UIColor hwColor:@"#29313D"];
  178. [blackBgView addSubview:bgBottomNavView];
  179. [bgBottomNavView mas_makeConstraints:^(MASConstraintMaker *make) {
  180. make.bottom.mas_equalTo(bg1View.mas_bottom);
  181. make.left.mas_equalTo(12);
  182. make.right.equalTo(self.mas_centerX).offset(-6);
  183. //make.top.mas_equalTo(16.f);
  184. make.top.mas_equalTo(bg1View.mas_top);
  185. }];
  186. UILabel *navSwitchTipLabel = [[UILabel alloc] init];
  187. navSwitchTipLabel.text = NSLocalizedString(@"cloudPhone_nav_show_tip",nil);
  188. //navSwitchTipLabel.textAlignment = NSTextAlignmentCenter;
  189. navSwitchTipLabel.textColor = [UIColor whiteColor];
  190. navSwitchTipLabel.font = [UIFont systemFontOfSize:12.0];
  191. [bgBottomNavView addSubview:navSwitchTipLabel];
  192. [navSwitchTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  193. make.left.mas_equalTo(15);
  194. make.top.equalTo(bgBottomNavView.mas_top).offset(0);
  195. make.bottom.equalTo(bgBottomNavView.mas_bottom).offset(0);
  196. }];
  197. //底部导航栏开关
  198. _bottomNavSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
  199. _bottomNavSwitch.onTintColor = HW13B2EBColor;
  200. _bottomNavSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
  201. [_bottomNavSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
  202. [bgBottomNavView addSubview:_bottomNavSwitch];
  203. [_bottomNavSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
  204. make.right.mas_equalTo(-15.f);
  205. make.centerY.mas_equalTo(0.f);
  206. make.width.mas_equalTo(44.f);
  207. make.height.mas_equalTo(22.f);
  208. }];
  209. //全面屏开关
  210. UIView *bgFullScreenView = [UIView new];
  211. bgFullScreenView.layer.cornerRadius = 8;
  212. bgFullScreenView.backgroundColor = [UIColor hwColor:@"#29313D"];
  213. [blackBgView addSubview:bgFullScreenView];
  214. [bgFullScreenView mas_makeConstraints:^(MASConstraintMaker *make) {
  215. make.bottom.mas_equalTo(bg1View.mas_bottom);
  216. make.right.mas_equalTo(-12);
  217. make.left.equalTo(self.mas_centerX).offset(6);
  218. //make.top.mas_equalTo(16.f);
  219. make.top.mas_equalTo(bg1View.mas_top);
  220. }];
  221. UILabel *fullScreenTipLabel = [[UILabel alloc] init];
  222. fullScreenTipLabel.text = NSLocalizedString(@"cloudPhone_fullScreen_show_tip",nil);
  223. //fullScreenTipLabel.textAlignment = NSTextAlignmentCenter;
  224. fullScreenTipLabel.textColor = [UIColor whiteColor];
  225. fullScreenTipLabel.font = [UIFont systemFontOfSize:12.0];
  226. [bgFullScreenView addSubview:fullScreenTipLabel];
  227. [fullScreenTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  228. make.left.mas_equalTo(15);
  229. make.top.equalTo(bgFullScreenView.mas_top).offset(0);
  230. make.bottom.equalTo(bgFullScreenView.mas_bottom).offset(0);
  231. }];
  232. _fullScreenSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
  233. _fullScreenSwitch.onTintColor = HW13B2EBColor;
  234. _fullScreenSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
  235. [_fullScreenSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
  236. [bgFullScreenView addSubview:_fullScreenSwitch];
  237. [_fullScreenSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
  238. make.right.mas_equalTo(-15.f);
  239. make.centerY.mas_equalTo(0.f);
  240. make.width.mas_equalTo(44.f);
  241. make.height.mas_equalTo(22.f);
  242. }];
  243. KWeakSelf
  244. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  245. [weakSelf setAllSwitchFun];
  246. });
  247. /**********************************************************************************/
  248. UIView *bg2View = [UIView new];
  249. bg2View.layer.cornerRadius = 12;
  250. bg2View.backgroundColor = [UIColor hwColor:@"#29313D"];
  251. [blackBgView addSubview:bg2View];
  252. [bg2View mas_makeConstraints:^(MASConstraintMaker *make) {
  253. make.height.mas_equalTo(72);
  254. make.left.mas_equalTo(15);
  255. make.right.mas_equalTo(-15);
  256. make.top.equalTo(bg1View.mas_bottom).offset(12);
  257. //make.top.mas_equalTo(52);
  258. }];
  259. NSArray *titleArr = @[NSLocalizedString(@"cloudPhone_set_screenshot_tip",nil),
  260. NSLocalizedString(@"my_set_no_TV_p2p",nil),//my_set_no_close_TV_p2p
  261. NSLocalizedString(@"my_set_no_restart_phone",nil),
  262. //NSLocalizedString(@"cloudPhone_set_exit_tip",nil),
  263. ];
  264. NSArray *imageArr = @[@"cloudPhone_set_screenshot",
  265. @"cloudPhone_set_TV",
  266. @"cloudPhone_set_restart",
  267. //@"cloudPhone_set_exit",
  268. ];
  269. CGFloat butTopY = 15.0;
  270. CGFloat imageWH = 24.0;
  271. CGFloat butHeight = imageWH +20 +5;
  272. CGFloat butWidth = (320 -15*2)/3.0; //70.0;
  273. //CGFloat butWidth = (245 -12*2)/2.0; //70.0;
  274. CGFloat butSpace = 0.0; //(245 - butWidth*3)/3.0;
  275. for (int i=0; i<titleArr.count; i++) {
  276. UIButton *but = [[UIButton alloc] init];
  277. //but.tag = 10+i;
  278. but.tag = 200+i;
  279. [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  280. [bg2View addSubview:but];
  281. //but.backgroundColor = [UIColor greenColor];
  282. [but mas_makeConstraints:^(MASConstraintMaker *make) {
  283. make.left.mas_equalTo(butSpace + (butWidth+butSpace)*(i%4));
  284. make.width.mas_equalTo(butWidth);
  285. make.height.mas_equalTo(butHeight);
  286. make.top.mas_equalTo(butTopY + (i/4)* (butHeight + 25) );
  287. }];
  288. UIImageView *imageV = [[UIImageView alloc] init];
  289. imageV.image = [UIImage imageNamed:imageArr[i]];
  290. [but addSubview:imageV];
  291. [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
  292. make.centerX.mas_equalTo(0);
  293. make.width.mas_equalTo(imageWH);
  294. make.height.mas_equalTo(imageWH);
  295. make.top.mas_equalTo(0);
  296. }];
  297. UILabel *textLabel = [[UILabel alloc] init];
  298. textLabel.textAlignment = NSTextAlignmentCenter;
  299. textLabel.font = [UIFont systemFontOfSize:12.0];
  300. textLabel.textColor = [UIColor whiteColor];
  301. textLabel.text = titleArr[i];
  302. [but addSubview:textLabel];
  303. //textLabel.backgroundColor = [UIColor redColor];
  304. [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  305. make.centerX.mas_equalTo(0);
  306. make.width.mas_equalTo(butWidth);
  307. make.height.mas_equalTo(20);
  308. make.top.equalTo(imageV.mas_bottom).offset(0);
  309. }];
  310. if(i==1){
  311. _TVButton = but;
  312. _TVShowLabel = textLabel;
  313. [self getCouldPhoneTvStatusFun:nil];
  314. }
  315. }
  316. /**********************************************************************************/
  317. NSString *titleStr = [[NSString alloc] initWithFormat:@" %@",NSLocalizedString(@"cloudPhone_set_exit_tip",nil)];
  318. _exitPhoneButton = [[UIButton alloc] init];
  319. _exitPhoneButton.tag = 100;
  320. [_exitPhoneButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  321. [_exitPhoneButton setTitle:titleStr forState:(UIControlStateNormal)];
  322. [_exitPhoneButton setImage:[UIImage imageNamed:@"cloudPhone_set_exit"] forState:UIControlStateNormal];
  323. _exitPhoneButton.layer.cornerRadius = 12;
  324. [_exitPhoneButton.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
  325. _exitPhoneButton.backgroundColor = [UIColor hwColor:@"#29313D"];
  326. [blackBgView addSubview:_exitPhoneButton];
  327. // if(ksharedAppDelegate.TvStatusMod.isTVShowType){
  328. // _TVButton.selected = YES;
  329. // }
  330. [_exitPhoneButton mas_makeConstraints:^(MASConstraintMaker *make) {
  331. make.height.mas_equalTo(42);
  332. make.left.mas_equalTo(12);
  333. make.right.mas_equalTo(-12);
  334. make.top.equalTo(bg2View.mas_bottom).offset(12);
  335. }];
  336. }
  337. - (void)setAllSwitchFun
  338. {
  339. BOOL haveShowBottonNavType = ![HWDataManager getBoolWithKey:Consn_player_Nav_hide];
  340. [_bottomNavSwitch setOn:haveShowBottonNavType];
  341. BOOL fullscreenType = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
  342. [_fullScreenSwitch setOn:fullscreenType];
  343. }
  344. - (void)maskSwitchPressed:(SYJUISwitch *)maskSwitch{
  345. if(_bottomNavSwitch == maskSwitch){
  346. if (maskSwitch.on) {
  347. [HWDataManager setBoolWithKey:Consn_player_Nav_hide value:NO];
  348. }
  349. else{
  350. [HWDataManager setBoolWithKey:Consn_player_Nav_hide value:YES];
  351. }
  352. [[NSNotificationCenter defaultCenter] postNotificationName:getPlayerBottomNavNotification object:nil];
  353. }
  354. else if (_fullScreenSwitch == maskSwitch){
  355. BOOL isTVShowType = ksharedAppDelegate.TvStatusMod.isTVShowType;
  356. if(isTVShowType){
  357. [[iToast makeText:NSLocalizedString(@"cloudPhone_tvShow_before_fullscreen_tip",nil)] show];
  358. [self removeFun];
  359. return;
  360. }
  361. if (maskSwitch.on) {
  362. [HWDataManager setBoolWithKey:Consn_player_full_screen_show value:YES];
  363. //数据埋点
  364. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_on"];
  365. }
  366. else{
  367. [HWDataManager setBoolWithKey:Consn_player_full_screen_show value:NO];
  368. //数据埋点
  369. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_off"];
  370. }
  371. [[NSNotificationCenter defaultCenter] postNotificationName:setPlayerFullScreenNotification object:nil];
  372. }
  373. [self removeFun];
  374. }
  375. #pragma mark 按钮事件
  376. - (void)didClickButtonFun:(UIButton*)but
  377. {
  378. NSInteger tag = but.tag;
  379. HLog(@"%ld",tag);
  380. [self removeFun];
  381. if(tag == 1){
  382. return;
  383. }
  384. if(tag == 201 && but.selected){
  385. tag = 301;
  386. }
  387. if(_didClickButtonFun){
  388. _didClickButtonFun(tag);
  389. }
  390. }
  391. - (void)removeFun
  392. {
  393. [self removeFromSuperview];
  394. }
  395. - (void)getCouldPhoneTvStatusFun:(NSNotification*)not
  396. {
  397. if(ksharedAppDelegate.TvStatusMod.isTVShowType){
  398. _TVButton.selected = YES;
  399. _TVShowLabel.text = NSLocalizedString(@"my_set_no_close_TV_p2p",nil);
  400. }
  401. else{
  402. _TVButton.selected = NO;
  403. _TVShowLabel.text = NSLocalizedString(@"my_set_no_TV_p2p",nil);
  404. }
  405. }
  406. - (void)setWebRctMsgBydelayed:(NSInteger)delayedMS withPacketLoss:(NSString*)PacketLossStr withSpeed:(NSString*)speedStr withFPS:(NSString*)fpsStr
  407. {
  408. //网络延迟: [0, 50ms)= 绿色 #22A082 ,[50ms, 100ms= 黄色, [100ms, ∞)= 红色 #FF2855
  409. if (delayedMS < 50) {
  410. _delayedLabel.textColor = [UIColor hwColor:@"22A082"];
  411. }
  412. else if (delayedMS < 100){
  413. _delayedLabel.textColor = [UIColor yellowColor];
  414. }
  415. else{
  416. _delayedLabel.textColor = [UIColor hwColor:@"#FF2855"];
  417. }
  418. _delayedLabel.text = [[NSString alloc] initWithFormat:@"%ldms",delayedMS];
  419. //_PacketLossLabel.text = PacketLossStr;
  420. _speedLabel.text = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"webrtc_msg_speed",nil),speedStr];
  421. _fpsLabel.text = [[NSString alloc] initWithFormat:@"FPS:%@",fpsStr];
  422. }
  423. @end