录制和回放1
This commit is contained in:
+3
-3
@@ -68,10 +68,10 @@ static NSString *bootomRecCellIdentifier = @"IfishRecVideoViewCell";
|
||||
////录制回放功能打开
|
||||
//_dataImgArray = @[LXImageWithImageName(@"devicename_iocn_screenshots.png"),LXImageWithImageName(@"devicename_iocn_gallery.png"),LXImageWithImageName(@"devicename_iocn_rec.png"),LXImageWithImageName(@"devicename_iocn_playback.png"),LXImageWithImageName(@"devicename_iocn_care.png"),LXImageWithImageName(@"devicename_iocn_look.png"),LXImageWithImageName(@"devicename_iocn_Ilookat.png"),LXImageWithImageName(@"devicename_iocn_look.png"),LXImageWithImageName(@"devicename_iocn_look.png")];
|
||||
//equipment_iocn_playback
|
||||
_dataImgArray = @[LXImageWithImageName(@"equipment_iocn_printscreen"),LXImageWithImageName(@"equipment_iocn_gallery"),LXImageWithImageName(@"equipment_iocn_care"),LXImageWithImageName(@"equipment_iocn_look"),LXImageWithImageName(@"equipment_iocn_mylook"),LXImageWithImageName(@"equipment_iocn_share")];
|
||||
_dataImgArray = @[LXImageWithImageName(@"equipment_iocn_printscreen"),LXImageWithImageName(@"equipment_iocn_gallery"),LXImageWithImageName(@"equipment_iocn_care"),LXImageWithImageName(@"equipment_iocn_look"),LXImageWithImageName(@"equipment_iocn_mylook"),LXImageWithImageName(@"equipment_iocn_share"),LXImageWithImageName(@"equipment_iocn_videorecord"),LXImageWithImageName(@"equipment_iocn_videoback")];
|
||||
|
||||
//_dataNameArray = @[@"截图",@"图库",@"录制",@"回放",@"我的看护",@"爱鱼看看",@"我的看看",@"",@""];
|
||||
_dataNameArray = @[@"截图",@"图库",@"我的看护",@"爱鱼看看",@"我的看看",@"分享爱鱼奇"];
|
||||
_dataNameArray = @[@"截图",@"图库",@"我的看护",@"爱鱼看看",@"我的看看",@"分享爱鱼奇",@"视频录制",@"视频回放"];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
@@ -84,7 +84,7 @@ static NSString *bootomRecCellIdentifier = @"IfishRecVideoViewCell";
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
|
||||
//return 9;
|
||||
return 6;
|
||||
return 8;
|
||||
|
||||
}
|
||||
#pragma mark 设置item内容
|
||||
|
||||
+4
@@ -9,7 +9,11 @@
|
||||
#import "BaseViewController.h"
|
||||
#import "IfishCameraModel.h"
|
||||
#import "MBProgressHUD.h"
|
||||
#import <GWP2P/GWP2P.h>
|
||||
|
||||
|
||||
@interface CameraRecordViewController : BaseViewController
|
||||
@property (nonatomic,strong) IfishCameraModel *camera;
|
||||
@property (nonatomic, strong) GWP2PVideoPlayer *player;//摄像头页面
|
||||
@property (strong, nonatomic) MBProgressHUD *progressAlert;
|
||||
@end
|
||||
|
||||
+78
-4
@@ -25,7 +25,7 @@ static const CGFloat ToastFade = 0.2;
|
||||
@property(nonatomic) NSInteger minute;
|
||||
@property(nonatomic,strong) NSTimer*timer;
|
||||
@property(nonatomic,copy) NSString *timestr;
|
||||
|
||||
@property (nonatomic, assign) BOOL isConnectCamera;
|
||||
@property(nonatomic) BOOL isRecording;
|
||||
@property(nonatomic) NSIndexPath *timerIndex;
|
||||
@property(nonatomic) NSIndexPath *switchIndex;
|
||||
@@ -92,7 +92,78 @@ static const CGFloat ToastFade = 0.2;
|
||||
[self.view addSubview:self.tab];
|
||||
|
||||
}
|
||||
-(void)connectDevice{
|
||||
|
||||
UserModel *model=[dataContorl getUserInfo];
|
||||
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
|
||||
//初始化设备
|
||||
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
|
||||
NSLog(@"正在检查P2P连接状态");
|
||||
BOOL connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
|
||||
|
||||
if (connectDevice) {
|
||||
[self connectCamera];
|
||||
}else{
|
||||
NSLog(@"p2pConnect failure.失败,不能操作设备");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//连接到摄像头
|
||||
-(void)connectCamera{
|
||||
|
||||
[[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:self.camera.cameraId password:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
|
||||
|
||||
if (success) {
|
||||
_isConnectCamera = YES;
|
||||
[self monitorP2PCall];
|
||||
NSLog(@"当前连接设备信息:%@",dataDictionary);
|
||||
}else{
|
||||
_isConnectCamera = YES;
|
||||
[self monitorP2PCall];
|
||||
// _isConnectCamera = NO;
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// [self.view makeToast:@"连接设备失败"];
|
||||
// [self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:NO];
|
||||
// });
|
||||
// return;
|
||||
}
|
||||
}];
|
||||
}
|
||||
#pragma mark --尝试连接摄像头
|
||||
-(void)monitorP2PCall{
|
||||
if ([self.player isPlaying]) {//如果已经连接,则不重复发出连接申请
|
||||
return;
|
||||
}
|
||||
//p2p未连接
|
||||
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
|
||||
[self connectDevice];
|
||||
return;
|
||||
}
|
||||
//未连接到设备
|
||||
if (!_isConnectCamera) {
|
||||
[self connectCamera];
|
||||
return;
|
||||
}
|
||||
WEAK_SELF;
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
|
||||
[weakSelf.player p2pCallDeviceWithDeviceId:self.camera.cameraId password:self.camera.cameraPass definition:GWP2PPTZDefinitionSD calling:^(NSDictionary *parameters) {
|
||||
//呼叫设备
|
||||
NSLog(@"[p2pCallDevice-Calling],paras=%@",parameters);
|
||||
|
||||
} accept:^(NSDictionary *parameters) {
|
||||
|
||||
NSLog(@"[p2pCallDevice-Accept],paras=%@",parameters);
|
||||
|
||||
} reject:^(GWP2PCallError error, NSString *errorCode) {
|
||||
} ready:^{
|
||||
} allowLAN:YES];
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
@@ -623,12 +694,15 @@ static const CGFloat ToastFade = 0.2;
|
||||
[self startTostVIew];
|
||||
|
||||
if (swt.isOn) {
|
||||
_isManual = YES;
|
||||
_isManual = NO;
|
||||
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
|
||||
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_OFF];
|
||||
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
|
||||
[[P2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeSchedule withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
|
||||
NSLog(@"data=%@",dataDictionary);
|
||||
}];;
|
||||
}else{
|
||||
|
||||
_isManual = NO;
|
||||
_isManual = YES;
|
||||
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
|
||||
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user