wxr
2024-12-03 cb9232b3ab413fae7bcc2b94abd70f18ca02b263
HDLLinPhoneSDK£¨OC£©/HDLLinPhoneSDK/HDLLPOnMonitorViewController.m
@@ -10,7 +10,7 @@
#import <Photos/Photos.h>
#import "HDLLinphoneUtlis.h"
#import "HDLLinphoneManager.h"
#import "HDLLinPhoneCommon.h"
//#import "HDLLinPhoneSDK-Swift.h"
//#import "LCUtlis.h"
//#import "LCApiKit.h"
@@ -37,7 +37,7 @@
@property (nonatomic,strong) dispatch_source_t openDoorTimer;
@property (nonatomic, assign) int openDoorTimeout;
@property (nonatomic, assign)  BOOL isHangUpByRemote;//是否对方远程挂断
/// æ’­æ”¾å™¨
//@property (nonatomic, strong) LCOpenSDK_PlayWindow *playWindow;
@@ -58,6 +58,8 @@
    
    NSString * LCSdkToken;
    NSString * LCHostApi;
    NSString * cancelStr;
    NSString * tipMsgStr;
    
    CGFloat Height66;
    bool isShowErrorAlert;
@@ -75,7 +77,7 @@
    [self initData];
    [self initESVideo];
    [self StartMonitoring];
//    [HDLLinphoneManager.instance enableMicro:false];
    [HDLLinphoneManager.instance enableMicro:false];
    
//    //暂时不支持开锁功能
//    [self setUnlock:NO];
@@ -101,7 +103,8 @@
    int state = [[notif.userInfo objectForKey:@"state"] intValue];
    if ((state == LinphoneCallEnd || state == LinphoneCallError)){//挂断了
        NSLog(@"挂断或出错了");
        [self showUIAlertViewWithBack:@"监视结束"];
        self.isHangUpByRemote=YES;
        [self showUIAlertViewWithBack:endOfMonitoringStr];
        
    }
}
@@ -119,6 +122,8 @@
        unlockStr = @"开锁";
        endOfMonitoringStr = @"监视结束";
        unlockSuccessfullyStr = @"开锁成功";
        cancelStr = @"取消";
        tipMsgStr = @"确定开锁吗?";
        
    }else{
        tipStr = @"Prompt";
@@ -129,6 +134,8 @@
        unlockStr = @"Unlock";
        endOfMonitoringStr = @"End of monitoring";
        unlockSuccessfullyStr = @"Unlock successfully";
        cancelStr = @"Cancel";
        tipMsgStr = @"Are you sure to unlock?";
    }
    
    
@@ -218,11 +225,13 @@
-(UIView *)videoView{
    if (_videoView == Nil) {
        _videoView =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, GetRealWidth((210)))];
        _videoView.backgroundColor = UIColor.lightGrayColor;
//        _videoView.backgroundColor = UIColor.lightGrayColor;
        _videoView.backgroundColor = UIColor.blackColor;
        _videoView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor;
        _videoView.layer.shadowOffset = CGSizeMake(0,0.5);
        _videoView.layer.shadowOpacity = 1;
        _videoView.layer.shadowRadius = 0;
        _videoView.layer.masksToBounds=YES;
    }
    return _videoView;
}
@@ -255,9 +264,6 @@
    [_screenshotTextBtn setTitleColor:TextColor forState:UIControlStateNormal];
    NSLog(@"截图");
    //截图
//    if(self.playWindow){
//        [self saveThumbImage];
//    }
    [HDLLinphoneManager.instance snapShotWithView:self.videoView];
    
}
@@ -303,7 +309,26 @@
    [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal];
    //开锁
    if(self.hdlLinphoneCallDelegate != NULL){
        [self.hdlLinphoneCallDelegate onUnlockAction];
        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:tipMsgStr preferredStyle:UIAlertControllerStyleAlert];
        // æ·»åŠ å–æ¶ˆæŒ‰é’®
        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelStr style:UIAlertActionStyleCancel handler:nil];
        [alertController addAction:cancelAction];
        // æ·»åŠ ç¡®è®¤æŒ‰é’®
        WEAKSELF_AT
        UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:okStr  style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            [weakSelf_AT.hdlLinphoneCallDelegate onUnlockAction];
        }];
        [alertController addAction:confirmAction];
        // èŽ·å–å½“å‰è§†å›¾æŽ§åˆ¶å™¨
        UIViewController *currentViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
        // æ˜¾ç¤ºå¼¹çª—
        [self presentViewController:alertController animated:YES completion:nil];
    }
    
}
@@ -422,7 +447,7 @@
 å¼€å§‹ç›‘控
 */
-(void)StartMonitoring{
    NSLog(@"开始呼叫:@%@",self.userName);
    NSLog(@"开始呼叫:%@",self.userName);
    [HDLLinphoneManager.instance startCall:self.userName];
    
}
@@ -450,8 +475,9 @@
    [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self backAction];
    }]];
    [self presentViewController:alertController animated:YES completion:nil];
//    [[HDLLinPhoneCommon rootController] presentViewController:alertController animated:YES completion:nil];
}
@@ -469,14 +495,16 @@
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    //1.暂停SDK相关播放
    [self stopPlay];
    if (!self.isHangUpByRemote) {
        [self stopPlay];
    }
    //2.Delegate释放
//    self.mLCCallDelegate = nil;
    //3.定时器释放