JLChen
2021-11-04 1443556e9ccb1a19ed8e6710c16c8adc4d4f4fb3
iOS/Xamarin/LCSDKOnXamarin/LCSDKOnXamarin/LCOnIntercomViewController.m
@@ -53,11 +53,8 @@
@implementation LCOnIntercomViewController{
    
    BOOL isAccessAudio;
    BOOL isAccessVideo;
    BOOL isBackGround;
    BOOL iSVideoNotDetermined;
    BOOL iSAudioNotDetermined;
    BOOL isAnswer;//是否已经点击接听过了
    
    NSString * tipStr;
@@ -92,8 +89,7 @@
    //开始反呼
    [self StartReverseCall];
    [self ShowCalltimeBtn:callingStr];
//    //暂时不支持开锁功能
//    [self setUnlock:NO];
    //注册开锁成功监听
    [self addOpenSuccessAction];
    
@@ -131,8 +127,6 @@
    }
}
- (void)initTopBarView {
    UIView *TopView =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, APP_TOP_BAR_HEIGHT)];
    TopView.backgroundColor = HEXCOLORA(0xF7F7F7,1.0);
@@ -143,7 +137,6 @@
    TopView.layer.shadowOffset = CGSizeMake(0,0.5);
    TopView.layer.shadowOpacity = 1;
    TopView.layer.shadowRadius = 0;
}
- (UIButton *)backButton{
@@ -450,13 +443,13 @@
    
}
- (int *)getTextWidth:(UIButton*) btn
{
    int textWidth = 0;
    //     CGSize size = [btn.titleLabel.textsizeWithFont:[UIFontboldSystemFontOfSize:15]constrainedToSize:contentMaxSizes lineBreakMode:UILineBreakModeCharacterWrap];
    //    textWidth = (int)fontSize.Width;
    return textWidth;
}
//- (int *)getTextWidth:(UIButton*) btn
//{
//    int textWidth = 0;
//    //     CGSize size = [btn.titleLabel.textsizeWithFont:[UIFontboldSystemFontOfSize:15]constrainedToSize:contentMaxSizes lineBreakMode:UILineBreakModeCharacterWrap];
//    //    textWidth = (int)fontSize.Width;
//    return textWidth;
//}
@@ -672,7 +665,8 @@
        param.psk =  [[LCApiKit sharedInstance] currentPsk];
        /** 7. 设置播放密钥,非必传,传了会提升拉流速度 */
        param.playToken = [[LCApiKit sharedInstance] currentDevicePlayToken];;
        /** 8. 对讲请求类型,call呼叫,如果不传,默认为talk */
        param.talkType = @"call";//2021-10-28 新增
        NSInteger result = [self.talker playTalk:param];
        if (result != 0) {
            //错误处理
@@ -702,7 +696,7 @@
- (void)onPlayerResult:(NSString*)code Type:(NSInteger)type Index:(NSInteger)index {
    // play
    WEAKSELF_AT(self);
    NSLog(@"LIVE_PLAY-CODE:%@,TYPE:%ld", code, type);
    NSLog(@"LIVE_PLAY-CODE:%@,TYPE:%ld", code, (long)type);
    //是否已经弹窗过
    if(isShowErrorAlert) return;;
    
@@ -859,24 +853,11 @@
    [super viewWillDisappear:animated];
    [self stopPlaySystemSound];
    //防止用户不按挂断,或者不等收到对方的挂断,点击返回按钮。
    //1.暂停SDK相关播放
    [self stopPlay];
    //    if(_es){
    //        [_es onHangup];
    //        [_es onStopCapture];
    //        [_es stopTalk];
    //
    //        _es.delegate = nil;
    //        ESVideo.shareInstance.snapImageCallback = nil;
    //
    //
    //    }
    //    [_es freeSubClass];
}
-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    //    [_es freeSubClass];
    //2.Delegate释放
    self.mLCCallDelegate = nil;
    //3.定时器释放
    if(_openDoorTimer){
        dispatch_source_cancel(_openDoorTimer);
        _openDoorTimer = nil; // OK
@@ -886,9 +867,12 @@
        _countdownTimer = nil; // OK
        
    }
    NSLog(@"==============dealloc");
}
-(void)dealloc{
    NSLog(@"==============dealloc  1");
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}
//#pragma mark ESVideoPhoneDelegate
@@ -1095,11 +1079,11 @@
- (void)stopPlaySystemSound{
    //    return;
    NSLog(@"stop PlaySystemSound");
    stopRingAndVibration();
    LCStopRingAndVibration();
}
//停止响铃和震动,移除回调并处理掉铃声和震动
void stopRingAndVibration() {
void LCStopRingAndVibration() {
    AudioServicesRemoveSystemSoundCompletion(kSystemSoundID_Vibrate);
    //    AudioServicesRemoveSystemSoundCompletion(sound);
    AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate);