| | |
| | | NSString * callingStr; |
| | | NSString * hangUpStr; |
| | | NSString * endOfCallStr; |
| | | |
| | | NSString * cancelStr; |
| | | NSString * tipMsgStr; |
| | | |
| | | // int openDoorTimeout; |
| | | //全局变量 |
| | | SystemSoundID sound; |
| | |
| | | [self initCentetView]; |
| | | [self initData]; |
| | | [self initESVideo]; |
| | | //开始反呼 |
| | | //开始震动 |
| | | [self StartReverseCall]; |
| | | [self ShowCalltimeBtn:callingStr]; |
| | | //注册开锁成功监听 |
| | |
| | | self.titleUILabel.text=self.titleName; |
| | | } |
| | | // self.titleUILabel.text=self.titleName; |
| | | |
| | | [NSNotificationCenter.defaultCenter addObserver:self |
| | | selector:@selector(registrationUpdate:) |
| | | name:@"LinphoneRegistrationUpdate" |
| | | object:nil]; |
| | | |
| | | } |
| | | |
| | | - (void)registrationUpdate:(NSNotification *)notif { |
| | | int state = [[notif.userInfo objectForKey:@"state"] intValue]; |
| | | if(state==11){//挂断了 |
| | | NSLog(@"挂断或出错了"); |
| | | [self showUIAlertViewWithBack:@"通话结束"]; |
| | | |
| | | } |
| | | } |
| | | |
| | | -(void)initLlanguage{ |
| | | NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; |
| | |
| | | unlockSuccessfullyStr = @"开锁成功"; |
| | | callingStr = @"来电中..."; |
| | | endOfCallStr = @"通话结束"; |
| | | cancelStr = @"取消"; |
| | | tipMsgStr = @"确定开锁吗?"; |
| | | }else{ |
| | | tipStr = @"Prompt"; |
| | | okStr = @"OK"; |
| | |
| | | unlockSuccessfullyStr = @"Unlock successfully"; |
| | | callingStr = @"Incoming call"; |
| | | endOfCallStr = @"End of call"; |
| | | cancelStr = @"Cancel"; |
| | | tipMsgStr = @"Are you sure to unlock?"; |
| | | |
| | | } |
| | | } |
| | |
| | | [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_takephoto_unselect"] forState:UIControlStateNormal]; |
| | | |
| | | //截图 |
| | | [HDLLinphoneManager.instance snapShotWithView:self.videoView]; |
| | | |
| | | } |
| | | |
| | |
| | | [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_unlock_unselect"] 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; |
| | | |
| | | // 显示弹窗 |
| | | [currentViewController presentViewController:alertController animated:YES completion:nil]; |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | // [[HDLCallManager instance] acceptCallByCallID:self.CallId hasVideo:self.hasVideo]; |
| | | [[HDLLinphoneManager instance] acceptCall]; |
| | | /// 开启对讲 |
| | | [self startTalk]; |
| | | // [self startTalk]; |
| | | |
| | | _answerImgBtn.hidden = YES; |
| | | _answerTextBtn.hidden = YES; |
| | |
| | | /** 开启倒计时 */ |
| | | - (void)startOpenDoorCountdown { |
| | | |
| | | if (_openDoorTimeout > 20) { |
| | | if (_openDoorTimeout > 10) { |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | dispatch_source_set_event_handler(_openDoorTimer, ^{ |
| | | WEAKSELF_AT |
| | | if(weakSelf_AT.openDoorTimeout >= 20 ){// 计时结束 |
| | | if(weakSelf_AT.openDoorTimeout >= 10 ){// 计时结束 |
| | | // 关闭定时器 |
| | | dispatch_source_cancel(weakSelf_AT.openDoorTimer); |
| | | |
| | |
| | | } |
| | | |
| | | -(void)viewWillDisappear:(BOOL)animated{ |
| | | NSLog(@"viewWillDisappear"); |
| | | [super viewWillDisappear:animated]; |
| | | [self stopPlaySystemSound]; |
| | | //防止用户不按挂断,或者不等收到对方的挂断,点击返回按钮。 |
| | |
| | | _countdownTimer = nil; // OK |
| | | |
| | | } |
| | | |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | | |
| | | } |
| | | |
| | |
| | | #pragma 震动实现貌似和SDK冲突 不能实现震动 |
| | | //开始播放的时候调用 |
| | | -(void)startPlaySystemSound{ |
| | | return; |
| | | // return; |
| | | // //震动的提示文件名放到资源目录下 |
| | | // NSString *path = [[NSBundle mainBundle] pathForResource:@"ring" ofType:@"wav"]; |
| | | // AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &sound); |
| | |
| | | |
| | | //手动停止播放的时候调用 |
| | | - (void)stopPlaySystemSound{ |
| | | return; |
| | | // return; |
| | | NSLog(@"stop PlaySystemSound"); |
| | | stopRingAndVibration(); |
| | | HDLLPStopRingAndVibration(); |
| | | } |
| | | |
| | | //停止响铃和震动,移除回调并处理掉铃声和震动 |
| | | void stopRingAndVibration() { |
| | | void HDLLPStopRingAndVibration() { |
| | | AudioServicesRemoveSystemSoundCompletion(kSystemSoundID_Vibrate); |
| | | // AudioServicesRemoveSystemSoundCompletion(sound); |
| | | AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate); |