Преглед на файлове

1.丢包的颜色需求

huangxiaodong преди 11 месеца
родител
ревизия
bea450e99c

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/View/playerSetView.h

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
 @interface playerSetView : UIView
 @property (nonatomic,copy) void (^didClickButtonFun)(NSInteger tag);
 
-- (void)setWebRctMsgBydelayed:(NSInteger)delayedMS withPacketLoss:(NSString*)PacketLossStr withSpeed:(NSString*)speedStr withFPS:(NSString*)fpsStr;
+- (void)setWebRctMsgBydelayed:(NSInteger)delayedMS withPacketLoss:(NSInteger)PacketLoss withSpeed:(NSString*)speedStr withFPS:(NSString*)fpsStr;
 
 - (void)setAllSwitchFun;
 @end

+ 10 - 3
创维盒子/双子星云手机/CloudPlayer/View/playerSetView.m

@@ -573,7 +573,7 @@
     }
 }
 
-- (void)setWebRctMsgBydelayed:(NSInteger)delayedMS withPacketLoss:(NSString*)PacketLossStr withSpeed:(NSString*)speedStr withFPS:(NSString*)fpsStr
+- (void)setWebRctMsgBydelayed:(NSInteger)delayedMS withPacketLoss:(NSInteger)PacketLoss withSpeed:(NSString*)speedStr withFPS:(NSString*)fpsStr
 {
     //网络延迟: [0, 50ms)= 绿色 #22A082 ,[50ms, 100ms= 黄色, [100ms, ∞)= 红色 #FF2855
     
@@ -595,11 +595,18 @@
     }
     
     NSString*LossleftStr = NSLocalizedString(@"webrtc_msg_PacketLoss",nil);
-    NSString*LossRightStr = PacketLossStr;
+    NSString*LossRightStr  = [[NSString alloc] initWithFormat:@"%ld%%",PacketLoss];
     NSString *LossfullTitle = [[NSString alloc] initWithFormat:@"%@%@",LossleftStr,LossRightStr];
     NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:LossfullTitle];
     NSRange rightRange = NSMakeRange([LossfullTitle rangeOfString:LossRightStr].location, LossRightStr.length);
-    UIColor *rightColor =[UIColor hwColor:@"#FF2855" alpha:1.0];
+    UIColor *rightColor = [UIColor hwColor:@"22A082"];
+    if(PacketLoss >= 5 && PacketLoss < 10){
+        rightColor = [UIColor yellowColor];
+    }
+    else if(PacketLoss >= 10){
+        rightColor = [UIColor hwColor:@"#FF2855"];
+    }
+    
     [attrStr addAttribute:NSForegroundColorAttributeName value:rightColor range:rightRange];
     _PacketLossLabel.attributedText = attrStr;
     

+ 2 - 2
创维盒子/双子星云手机/webRtc/webRtcPlayerViewController.m

@@ -1309,7 +1309,7 @@
     
     
     
-    NSString*lostDataStr = [[NSString alloc] initWithFormat:@"%ld%%",prelostRate];
+    //NSString*lostDataStr = [[NSString alloc] initWithFormat:@"%ld%%",prelostRate];
     
     //FPS
     NSString*FPSStr = @"";//[[NSString alloc] initWithFormat:@"%ld\n",framesPerSecond];
@@ -1326,7 +1326,7 @@
     mainBlock(^{
         if(weakSelf.playerSetV){
             [weakSelf updateControlBtnBgImageWith:delayedMS];
-            [weakSelf.playerSetV setWebRctMsgBydelayed:delayedMS withPacketLoss:lostDataStr withSpeed:netDataSpeedStr withFPS:FPSStr];
+            [weakSelf.playerSetV setWebRctMsgBydelayed:delayedMS withPacketLoss:self->prelostRate withSpeed:netDataSpeedStr withFPS:FPSStr];
         }
     });