录制和回放1
This commit is contained in:
parent
68d139a184
commit
55d25d8fba
|
|
@ -1283,12 +1283,7 @@ Assign BOOL isPush;
|
||||||
}
|
}
|
||||||
else if ([model.type isEqualToString:@"camera"]){
|
else if ([model.type isEqualToString:@"camera"]){
|
||||||
|
|
||||||
// self.hidesBottomBarWhenPushed = YES;
|
|
||||||
// IfishP2PPlayBackListViewController *cameraShopVC=[[IfishP2PPlayBackListViewController alloc]init];
|
|
||||||
// cameraShopVC.camera = model.camera;
|
|
||||||
// [self.navigationController pushViewController:cameraShopVC animated:YES];
|
|
||||||
// self.hidesBottomBarWhenPushed = NO;
|
|
||||||
|
|
||||||
//切换时主动 断开 soket
|
//切换时主动 断开 soket
|
||||||
[[Socketsingleton sharedInstance] cutOffSocket];
|
[[Socketsingleton sharedInstance] cutOffSocket];
|
||||||
//进入摄像头页面
|
//进入摄像头页面
|
||||||
|
|
|
||||||
|
|
@ -640,7 +640,7 @@ Strong UIImage *screenShotImage;//截图
|
||||||
self.bottomToolHView.hidden = NO;
|
self.bottomToolHView.hidden = NO;
|
||||||
|
|
||||||
//底部view 水族箱view
|
//底部view 水族箱view
|
||||||
UIView *bottomHView = [[UIView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY(self.segControl.frame) + 10, width, height-CGRectGetMaxY(self.segControl.frame))];
|
UIView *bottomHView = [[UIView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY(self.segControl.frame) + 10, width, height-CGRectGetMaxY(self.segControl.frame)-10)];
|
||||||
bottomHView.backgroundColor = JWUIColorFromRGB(0xdddddd);
|
bottomHView.backgroundColor = JWUIColorFromRGB(0xdddddd);
|
||||||
[self.view addSubview:bottomHView];
|
[self.view addSubview:bottomHView];
|
||||||
self.bottomFishHView = bottomHView;
|
self.bottomFishHView = bottomHView;
|
||||||
|
|
@ -4570,6 +4570,23 @@ GWP2PCallErrorNotSupport,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//视频录制
|
||||||
|
else if (indexPath.row ==6){
|
||||||
|
CameraRecordViewController*ca=[[CameraRecordViewController alloc]init];
|
||||||
|
ca.camera=self.contact;
|
||||||
|
[self.navigationController pushViewController:ca animated:YES];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (indexPath.row ==7){
|
||||||
|
|
||||||
|
IfishP2PPlayBackListViewController *cameraShopVC=[[IfishP2PPlayBackListViewController alloc]init];
|
||||||
|
cameraShopVC.camera = self.contact;
|
||||||
|
[self.navigationController pushViewController:cameraShopVC animated:YES];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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")];
|
//_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
|
//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 = @[@"截图",@"图库",@"我的看护",@"爱鱼看看",@"我的看看",@"分享爱鱼奇"];
|
_dataNameArray = @[@"截图",@"图库",@"我的看护",@"爱鱼看看",@"我的看看",@"分享爱鱼奇",@"视频录制",@"视频回放"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - UICollectionViewDataSource
|
#pragma mark - UICollectionViewDataSource
|
||||||
|
|
@ -84,7 +84,7 @@ static NSString *bootomRecCellIdentifier = @"IfishRecVideoViewCell";
|
||||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||||
|
|
||||||
//return 9;
|
//return 9;
|
||||||
return 6;
|
return 8;
|
||||||
|
|
||||||
}
|
}
|
||||||
#pragma mark 设置item内容
|
#pragma mark 设置item内容
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,11 @@
|
||||||
#import "BaseViewController.h"
|
#import "BaseViewController.h"
|
||||||
#import "IfishCameraModel.h"
|
#import "IfishCameraModel.h"
|
||||||
#import "MBProgressHUD.h"
|
#import "MBProgressHUD.h"
|
||||||
|
#import <GWP2P/GWP2P.h>
|
||||||
|
|
||||||
|
|
||||||
@interface CameraRecordViewController : BaseViewController
|
@interface CameraRecordViewController : BaseViewController
|
||||||
@property (nonatomic,strong) IfishCameraModel *camera;
|
@property (nonatomic,strong) IfishCameraModel *camera;
|
||||||
|
@property (nonatomic, strong) GWP2PVideoPlayer *player;//摄像头页面
|
||||||
@property (strong, nonatomic) MBProgressHUD *progressAlert;
|
@property (strong, nonatomic) MBProgressHUD *progressAlert;
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ static const CGFloat ToastFade = 0.2;
|
||||||
@property(nonatomic) NSInteger minute;
|
@property(nonatomic) NSInteger minute;
|
||||||
@property(nonatomic,strong) NSTimer*timer;
|
@property(nonatomic,strong) NSTimer*timer;
|
||||||
@property(nonatomic,copy) NSString *timestr;
|
@property(nonatomic,copy) NSString *timestr;
|
||||||
|
@property (nonatomic, assign) BOOL isConnectCamera;
|
||||||
@property(nonatomic) BOOL isRecording;
|
@property(nonatomic) BOOL isRecording;
|
||||||
@property(nonatomic) NSIndexPath *timerIndex;
|
@property(nonatomic) NSIndexPath *timerIndex;
|
||||||
@property(nonatomic) NSIndexPath *switchIndex;
|
@property(nonatomic) NSIndexPath *switchIndex;
|
||||||
|
|
@ -92,7 +92,78 @@ static const CGFloat ToastFade = 0.2;
|
||||||
[self.view addSubview:self.tab];
|
[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 {
|
- (void)didReceiveMemoryWarning {
|
||||||
[super didReceiveMemoryWarning];
|
[super didReceiveMemoryWarning];
|
||||||
// Dispose of any resources that can be recreated.
|
// Dispose of any resources that can be recreated.
|
||||||
|
|
@ -623,12 +694,15 @@ static const CGFloat ToastFade = 0.2;
|
||||||
[self startTostVIew];
|
[self startTostVIew];
|
||||||
|
|
||||||
if (swt.isOn) {
|
if (swt.isOn) {
|
||||||
_isManual = YES;
|
_isManual = NO;
|
||||||
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
|
[[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{
|
}else{
|
||||||
|
|
||||||
_isManual = NO;
|
_isManual = YES;
|
||||||
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
|
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
|
||||||
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
|
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Loading…
Reference in New Issue