| | |
| | | #import "LCOnMonitorViewController.h" |
| | | #import <AVFoundation/AVFoundation.h> |
| | | #import <Photos/Photos.h> |
| | | #import "LCKit.h" |
| | | |
| | | |
| | | #import "LCUtlis.h" |
| | | #import "LCApiKit.h" |
| | | #import <LCOpenSDKDynamic/LCOpenSDKDynamic.h> |
| | | |
| | | @interface LCOnMonitorViewController ()<LCOpenSDK_EventListener> |
| | | |
| | |
| | | |
| | | @implementation LCOnMonitorViewController |
| | | { |
| | | BOOL isAccessAudio; |
| | | BOOL isAccessVideo; |
| | | BOOL isBackGround; |
| | | BOOL iSVideoNotDetermined; |
| | | BOOL iSAudioNotDetermined; |
| | | |
| | | NSString * tipStr; |
| | | NSString * okStr; |
| | |
| | | [self initESVideo]; |
| | | [self StartMonitoring]; |
| | | |
| | | //暂时不支持开锁功能 |
| | | [self setUnlock:NO]; |
| | | // //暂时不支持开锁功能 |
| | | // [self setUnlock:NO]; |
| | | //注册开锁成功监听 |
| | | [self addOpenSuccessAction]; |
| | | // Do any additional setup after loading the view. |
| | | } |
| | | |
| | |
| | | [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_unlock_unselect"] forState:UIControlStateNormal]; |
| | | [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; |
| | | //开锁 |
| | | // if(_es){ |
| | | // [_es openTheDoorWithRoomid:_mESRoomID]; |
| | | // } |
| | | if(self.mLCCallDelegate != NULL){ |
| | | [self.mLCCallDelegate onUnlockAction]; |
| | | } |
| | | } |
| | | |
| | | - (UIButton *)unlockTextBtn{ |
| | |
| | | - (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;; |
| | | |
| | |
| | | if (type == 0) { |
| | | |
| | | if ([RTSP_Result_String(STATE_RTSP_DESCRIBE_READY) isEqualToString:code]) { |
| | | // dispatch_async(dispatch_get_main_queue(), ^{ |
| | | // }); |
| | | // dispatch_async(dispatch_get_main_queue(), ^{ |
| | | // }); |
| | | return; |
| | | } |
| | | if ([RTSP_Result_String(STATE_RTSP_PLAY_READY) isEqualToString:code]) { |
| | | // dispatch_async(dispatch_get_main_queue(), ^{ |
| | | // }); |
| | | // dispatch_async(dispatch_get_main_queue(), ^{ |
| | | // }); |
| | | return; |
| | | } |
| | | //提示失败 |
| | |
| | | -(void)viewWillDisappear:(BOOL)animated{ |
| | | [super viewWillDisappear:animated]; |
| | | |
| | | //1.暂停SDK相关播放 |
| | | [self stopPlay]; |
| | | //2.Delegate释放 |
| | | self.mLCCallDelegate = nil; |
| | | //3.定时器释放 |
| | | if(_openDoorTimer){ |
| | | dispatch_source_cancel(_openDoorTimer); |
| | | _openDoorTimer = nil; // OK |
| | | } |
| | | |
| | | //防止用户不按挂断,或者不等收到对方的挂断,点击返回按钮。 |
| | | // if(_es){ |
| | | // [_es onHangup]; |
| | | // [_es onStopCapture]; |
| | | // [_es stopTalk]; |
| | | // |
| | | // _es.delegate = nil; |
| | | // ESVideo.shareInstance.snapImageCallback = nil; |
| | | // // _es.showView.removeFromSuperview; |
| | | // } |
| | | // [_es freeSubClass]; |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | | } |
| | | |
| | | -(void)dealloc{ |
| | | NSLog(@"==============dealloc 1"); |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| | | NSLog(@"==============dealloc 2"); |
| | | // [_es freeSubClass]; |
| | | // NSLog(@"==============dealloc 3"); |
| | | |
| | | if(_openDoorTimer){ |
| | | dispatch_source_cancel(_openDoorTimer); |
| | | _openDoorTimer = nil; // OK |
| | | |
| | | } |
| | | NSLog(@"==============dealloc 3"); |
| | | } |
| | | |
| | | //#pragma mark ESVideoPhoneDelegate |
| | |
| | | |
| | | } |
| | | |
| | | - (void)addOpenSuccessAction { |
| | | |
| | | [[NSNotificationCenter defaultCenter] removeObserver:self |
| | | name:LCCallDelegateOpenDoorSuccess |
| | | object:nil]; |
| | | |
| | | [[NSNotificationCenter defaultCenter] addObserver:self |
| | | selector:@selector(setOpenDoorSuccess) |
| | | name:LCCallDelegateOpenDoorSuccess |
| | | object:nil]; |
| | | } |
| | | |
| | | |
| | | @end |
| | | |