Explorar o código

1.ipad 推拉流页面 适配

huangxiaodong hai 7 meses
pai
achega
034aeb6d9d

+ 44 - 44
创维盒子/双子星云手机/webRtc/view/webRtcPlayerBottomContrView.m

@@ -181,52 +181,52 @@
         self->homeBtn.hidden = isHide;
         self->backBtn.hidden = isHide;
         
-        [weakSelf handleFullScreenClickBottomFunBy:isHide];
+        //[weakSelf handleFullScreenClickBottomFunBy:isHide];
     });
 }
 
 #pragma mark 处理全屏底部 点击事件无效
-- (void)handleFullScreenClickBottomFunBy:(BOOL)isHide
-{
-    BOOL fullScreenShow = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
-    
-    if(!fullScreenShow) return;
-    
-    if(_isLan){//横屏
-        
-        if(isHide){//隐藏
-            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.width.mas_equalTo(60);
-                make.right.mas_equalTo(0);
-                make.top.mas_equalTo(0);
-                make.height.mas_equalTo(60);
-            }];
-        }else{//显示
-            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.width.mas_equalTo(60);
-                make.right.mas_equalTo(0);
-                make.top.mas_equalTo(0);
-                make.bottom.mas_equalTo(0);
-            }];
-        }
-        
-    }
-    else{//竖屏
-        if(isHide){//隐藏
-            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.height.mas_equalTo(60.f);
-                make.right.mas_equalTo(0.f);
-                make.bottom.mas_equalTo(0);
-                make.width.mas_equalTo(60.f);
-            }];
-        }else{//显示
-            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
-                make.height.mas_equalTo(60.f);
-                make.right.mas_equalTo(0.f);
-                make.bottom.mas_equalTo(0);
-                make.left.mas_equalTo(0.f);
-            }];
-        }
-    }
-}
+//- (void)handleFullScreenClickBottomFunBy:(BOOL)isHide
+//{
+//    BOOL fullScreenShow = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
+//    
+//    if(!fullScreenShow) return;
+//    
+//    if(_isLan){//横屏
+//        
+//        if(isHide){//隐藏
+//            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
+//                make.width.mas_equalTo(60);
+//                make.right.mas_equalTo(0);
+//                make.top.mas_equalTo(0);
+//                make.height.mas_equalTo(60);
+//            }];
+//        }else{//显示
+//            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
+//                make.width.mas_equalTo(60);
+//                make.right.mas_equalTo(0);
+//                make.top.mas_equalTo(0);
+//                make.bottom.mas_equalTo(0);
+//            }];
+//        }
+//        
+//    }
+//    else{//竖屏
+//        if(isHide){//隐藏
+//            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
+//                make.height.mas_equalTo(60.f);
+//                make.right.mas_equalTo(0.f);
+//                make.bottom.mas_equalTo(0);
+//                make.width.mas_equalTo(60.f);
+//            }];
+//        }else{//显示
+//            [self mas_remakeConstraints:^(MASConstraintMaker *make) {
+//                make.height.mas_equalTo(60.f);
+//                make.right.mas_equalTo(0.f);
+//                make.bottom.mas_equalTo(0);
+//                make.left.mas_equalTo(0.f);
+//            }];
+//        }
+//    }
+//}
 @end

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

@@ -15,13 +15,14 @@
     lastVideoWHRate = w_h_rate;
     BOOL fullScreenShow = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
 
+    CGFloat scr_W = SCREEN_W;
+    CGFloat scr_H = SCREEN_H;
+    if (SCREEN_W > SCREEN_H){
+        scr_W = SCREEN_H;
+        scr_H = SCREEN_W;
+    }
+    
     [self.mediaStream mas_remakeConstraints:^(MASConstraintMaker *make) {
-        CGFloat scr_W = SCREEN_W;
-        CGFloat scr_H = SCREEN_H;
-        if (SCREEN_W > SCREEN_H){
-            scr_W = SCREEN_H;
-            scr_H = SCREEN_W;
-        }
         
         if(fullScreenShow){//全屏
             make.left.mas_equalTo(0.f);
@@ -56,17 +57,25 @@
     
     //[self.mediaStream setVideoContentMode:UIViewContentModeScaleAspectFit];
     
+    //self.bottomContrView.backgroundColor = [UIColor yellowColor];
     [self.bottomContrView mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.height.mas_equalTo(60.f);
+        //make.height.mas_equalTo(60.f);
+        make.bottom.mas_equalTo(0.f);
         make.right.mas_equalTo(0.f);
+        make.left.mas_equalTo(0.f);
         if(fullScreenShow){
-            //make.bottom.mas_equalTo(0);
-            make.top.equalTo(self.mediaStream.mas_bottom);
+            if(scr_H == 667){// iphone 6 7 8
+                make.top.equalTo(self.mediaStream.mas_bottom).offset(20);
+            }
+            else{
+                //make.bottom.mas_equalTo(0);
+                make.top.equalTo(self.mediaStream.mas_bottom);
+            }
+            
         }
         else{
             make.top.equalTo(self.mediaStream.mas_bottom);
         }
-        make.left.mas_equalTo(0.f);
     }];
 
     [self.bottomContrView updateFrameFunByIsLan:NO];
@@ -88,23 +97,16 @@
     if (IPHONE_X){
         h_forPhoneTop = 44.f;
     }
-//    CGFloat des_W = SCREEN_W<SCREEN_H?SCREEN_W:SCREEN_H;/*实际较小的数字*/
-//    CGFloat des_H = (SCREEN_W>SCREEN_H?SCREEN_W:SCREEN_H) - h_forPhoneTop;/*实际较大的数字*/
     
-//    [self.mediaStream mas_remakeConstraints:^(MASConstraintMaker *make) {
-//        make.bottom.mas_equalTo(0.f);
-//        make.width.mas_equalTo(des_W*w_h_rate);
-//        make.left.mas_equalTo(h_forPhoneTop + (des_H - h_forPhoneBottomView - des_W*w_h_rate)/2.f);
-//        make.top.mas_equalTo(0);
-//    }];
+    CGFloat scr_W = SCREEN_W;
+    CGFloat scr_H = SCREEN_H;
+    if (SCREEN_W < SCREEN_H){
+        scr_W = SCREEN_H;
+        scr_H = SCREEN_W;
+    }
     
     [self.mediaStream mas_remakeConstraints:^(MASConstraintMaker *make) {
-        CGFloat scr_W = SCREEN_W;
-        CGFloat scr_H = SCREEN_H;
-        if (SCREEN_W < SCREEN_H){
-            scr_W = SCREEN_H;
-            scr_H = SCREEN_W;
-        }
+     
         
         if(fullScreenShow){//全屏
             make.left.mas_equalTo(0.f);
@@ -114,24 +116,45 @@
             make.top.mas_equalTo(0.f);
         }
         else{//非全屏
-            if ((scr_W - scr_H*w_h_rate - 60.f) < 0){//空余宽度不满 40 (高不能满屏)
-                make.height.mas_equalTo((scr_W - 60.f)/w_h_rate);
-                make.width.mas_equalTo(scr_W - 60.f);
+            
+            if((scr_W - scr_H*w_h_rate - 60.f*2) >= 0){//居中显示
+                make.height.mas_equalTo(scr_H);
+                make.top.mas_equalTo(0.f);
+                make.width.mas_equalTo(scr_H*w_h_rate);
                 make.centerX.equalTo(self.view.mas_centerX);
-                make.left.mas_equalTo(0);
             }
-            else if ((scr_W - scr_H*w_h_rate - 60.f*2) < 0){//空余宽度不满 80 (X不能居中)
+            else if((scr_W - scr_H*w_h_rate - 60.f*2) < 0
+                     && (scr_W - scr_H*w_h_rate - 60.f) > 0){//空余宽度不满 120 (X不能居中){
                 make.height.mas_equalTo(scr_H);
                 make.width.mas_equalTo((scr_H)*w_h_rate);
-                make.centerY.equalTo(self.view.mas_centerX);
+                make.centerY.equalTo(self.view.mas_centerY);
                 make.right.mas_equalTo(-60);
             }
-            else{// 高满屏 X居中
-                make.height.mas_equalTo(scr_H);
-                make.top.mas_equalTo(0.f);
-                make.width.mas_equalTo(scr_H*w_h_rate);
-                make.centerX.equalTo(self.view.mas_centerX);
+            else if((scr_W - scr_H*w_h_rate - 60.f) < 0){//空余宽度不满 60 (高不能满屏)
+                make.height.mas_equalTo((scr_W - 60.f)/w_h_rate);
+                make.width.mas_equalTo(scr_W - 60.f);
+                make.centerY.equalTo(self.view.mas_centerY);
+                make.left.mas_equalTo(0);
             }
+            
+//            if ((scr_W - scr_H*w_h_rate - 60.f) < 0){//空余宽度不满 60 (高不能满屏)
+//                make.height.mas_equalTo((scr_W - 60.f)/w_h_rate);
+//                make.width.mas_equalTo(scr_W - 60.f);
+//                make.centerY.equalTo(self.view.mas_centerY);
+//                make.left.mas_equalTo(0);
+//            }
+//            else if ((scr_W - scr_H*w_h_rate - 60.f*2) < 0){//空余宽度不满 80 (X不能居中)
+//                make.height.mas_equalTo(scr_H);
+//                make.width.mas_equalTo((scr_H)*w_h_rate);
+//                make.centerY.equalTo(self.view.mas_centerY);
+//                make.right.mas_equalTo(-60);
+//            }
+//            else{// 高满屏 X居中
+//                make.height.mas_equalTo(scr_H);
+//                make.top.mas_equalTo(0.f);
+//                make.width.mas_equalTo(scr_H*w_h_rate);
+//                make.centerY.equalTo(self.view.mas_centerY);
+//            }
         }
         
     }];
@@ -141,8 +164,14 @@
     [self.bottomContrView mas_remakeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(h_forPhoneBottomView);
         if(fullScreenShow){
-            //make.right.mas_equalTo(0);
-            make.left.equalTo(self.mediaStream.mas_right);
+            if(scr_W == 667){// iphone 6 7 8
+                make.left.equalTo(self.mediaStream.mas_right).offset(20);
+            }
+            else{
+                //make.right.mas_equalTo(0);
+                make.left.equalTo(self.mediaStream.mas_right);
+            }
+            
         }
         else{
             make.left.equalTo(self.mediaStream.mas_right);