123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- //
- // webRtcPlayerViewController+AdjustPlayerViewFrame.m
- // 双子星云手机
- //
- // Created by xd h on 2024/9/5.
- //
- #import "webRtcPlayerViewController+AdjustPlayerViewFrame.h"
- @implementation webRtcPlayerViewController (AdjustPlayerViewFrame)
- - (void)setPoMas_makeWithImageRate:(CGFloat)w_h_rate{
- /*播放视图*/
- // touchCommondView.isLan = NO;
- lastVideoWHRate = w_h_rate;
- BOOL fullScreenShow = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
- [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 ((scr_H - scr_W/w_h_rate - 40.f)/2.f < 0){
- if(fullScreenShow){
- make.height.mas_equalTo(scr_H);
- make.width.mas_equalTo(scr_W);
- }
- else{
- make.height.mas_equalTo(scr_H - 40.f);
- make.width.mas_equalTo((scr_H - 40.f)*w_h_rate);
- }
- make.centerX.equalTo(self.view.mas_centerX);
- make.top.mas_equalTo(0);
- }
- else{
- make.left.mas_equalTo(0.f);
- make.right.mas_equalTo(0.f);
- if(fullScreenShow){
- make.height.mas_equalTo(scr_H);
- make.top.mas_equalTo(0.f);
- }
- else{
- make.height.mas_equalTo(scr_W/w_h_rate);
- make.top.mas_equalTo((scr_H - scr_W/w_h_rate - 40.f)/2.f);
- }
- }
- }];
-
-
- [self.bottomContrView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(40.f);
- make.right.equalTo(self.mediaStream.mas_right);
- if(fullScreenShow){
- make.bottom.mas_equalTo(0);
- }
- else{
- make.top.equalTo(self.mediaStream.mas_bottom);
- }
- make.left.equalTo(self.mediaStream.mas_left);
- }];
- [self.bottomContrView updateFrameFunByIsLan:NO];
- }
- /**
- * @brief 设置横屏模式UI布局
- *
- * @param w_h_rate 宽高比
- */
- - (void)setLanMas_makeWithImageRate:(CGFloat)w_h_rate{
-
- lastVideoWHRate = w_h_rate;
- BOOL fullScreenShow = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
-
- CGFloat h_forPhoneBottomView = 40.0;
- CGFloat h_forPhoneTop = 0;
- 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);
- }];
-
- [self.bottomContrView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(h_forPhoneBottomView);
- make.left.equalTo(self.mediaStream.mas_right);
- if(fullScreenShow){
- make.right.mas_equalTo(0);
- }
- else{
- make.top.mas_equalTo(0);
- }
- make.bottom.mas_equalTo(0);
- }];
- [self.bottomContrView updateFrameFunByIsLan:YES];
- }
- @end
|