From feb1c3628a4d5da3c85bd3f3dae3be22ed4f5625 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 19 十月 2021 11:18:40 +0800 Subject: [PATCH] 2021-10-19 1.更新SDK --- Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/VideoTalk/EZVideoTalkViewcontroller.mm | 436 +++++++++++++++++++++++++++--------------------------- 1 files changed, 218 insertions(+), 218 deletions(-) diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/VideoTalk/EZVideoTalkViewcontroller.mm b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/VideoTalk/EZVideoTalkViewcontroller.mm index efe606a..afbb6f2 100644 --- a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/VideoTalk/EZVideoTalkViewcontroller.mm +++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/VideoTalk/EZVideoTalkViewcontroller.mm @@ -1,221 +1,221 @@ +//// +//// EZVideoTalkViewcontroller.m +//// EZBAVDemo +//// +//// Created by kanhaiping on 2018/6/26. +//// Copyright 漏 2018骞� hikvision. All rights reserved. +//// // -// EZVideoTalkViewcontroller.m -// EZBAVDemo +//#import "EZVideoTalkViewcontroller.h" +//#import "EZVideoTalkSDK.h" +//#import "EZVideoTalkParam.h" +//#import "UIView+Toast.h" +//#import <AVFoundation/AVFoundation.h> +//#import "EZOpenSDK.h" +//#import "EZDeviceInfo.h" +//#import "GlobalKit.h" +//#import "EzvizWatchServerInfo.h" +//#import "EZTokenKit.h" // -// Created by kanhaiping on 2018/6/26. -// Copyright 漏 2018骞� hikvision. All rights reserved. +//@interface EZVideoTalkViewcontroller ()<EZVideoTalkSDKDelegate> +//@property (nonatomic, assign) BOOL bEverOpenSound; +//@property (nonatomic, strong) EZVideoTalkSDK *client; // - -#import "EZVideoTalkViewcontroller.h" -#import "EZVideoTalkSDK.h" -#import "EZVideoTalkParam.h" -#import "UIView+Toast.h" -#import <AVFoundation/AVFoundation.h> -#import "EZOpenSDK.h" -#import "EZDeviceInfo.h" -#import "GlobalKit.h" -#import "EzvizWatchServerInfo.h" -#import "EZTokenKit.h" - -@interface EZVideoTalkViewcontroller ()<EZVideoTalkSDKDelegate> -@property (nonatomic, assign) BOOL bEverOpenSound; -@property (nonatomic, strong) EZVideoTalkSDK *client; - -@property (weak, nonatomic) IBOutlet UIView *localView; -@property (weak, nonatomic) IBOutlet UIView *remoteView; -@property (weak, nonatomic) IBOutlet UITextField *roomIDTextField; - -@property (nonatomic, strong) EzvizWatchServerInfo *watchServerInfo; - -@end - -@implementation EZVideoTalkViewcontroller - -+ (EZVideoTalkViewcontroller *) videoTalkVC { - - EZVideoTalkViewcontroller *vc = [[NSBundle mainBundle] loadNibNamed:@"EZVideoTalkViewcontroller" owner:nil options:nil].firstObject; - return vc; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; - if (self.view.gestureRecognizers.count <= 0) { - [self.view addGestureRecognizer:gesture]; - } - - self.title = @"Video Talk"; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(stopTalk) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [self getWatchInfo]; -} - -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - if (self.client != nil) { - [self stopTalk]; - } -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - - -#pragma mark Actions - -- (IBAction)createRoomAction:(id)sender { - - [self startTalkWithRoomID:0]; -} - -- (IBAction)enterRoomAction:(id)sender { - - if (self.roomIDTextField.text.length <= 0 || [self.roomIDTextField.text integerValue] <= 0) { - [self showMessage:@"璇疯緭鍏ユ纭殑鎴块棿鍙�"]; - return; - } - - [self startTalkWithRoomID:(int32_t)[self.roomIDTextField.text integerValue]]; - - [self showMessage:@"鍔犲叆鎴块棿"]; -} - -- (IBAction)leaveRoomAction:(id)sender { - - [self stopTalk]; - - [self showMessage:@"宸茬寮�鎴块棿"]; -} - -- (void)tapAction:(id)sender { - - [self.roomIDTextField resignFirstResponder]; -} - -#pragma mark Helper - -- (void)showMessage:(NSString *)message -{ - [self.view makeToast:message duration:2.0 position:CSToastPositionCenter]; -} - -#pragma mark BAV API - -- (void)getWatchInfo { - - __weak typeof(self) weakSelf = self; - [EZOpenSDK requestGetWatchServerInfo:self.deviceInfo.deviceSerial completion:^(id watchServerInfo, NSError *error) { - - weakSelf.watchServerInfo = watchServerInfo; - }]; -} - -- (void)startTalkWithRoomID:(int32_t)roomID -{ - if (self.client != nil) { - [self.client stop]; - self.client = nil; - } - - EZVideoTalkParam *param = [EZVideoTalkParam new]; - param.iCltRole = roomID > 0 ? 1 : 0; - param.iCltType = 1; - param.iOtherCltType = 1; -// param.iReason = 101; - param.iStsPort = self.watchServerInfo.port; - param.iRoomId = roomID > 0 ? roomID : 0; - param.szOterId = self.deviceInfo.deviceSerial; - param.szSelfId = @"1234567891"; - param.szAuthToken = [EZTokenKit sharedKit].token; - param.szStsAddr = self.watchServerInfo.domain; - - [EZVideoTalkSDK setDebugVideoLog:YES]; - [EZVideoTalkSDK setDebugLogEnable:YES withLogCallback:^(NSString *logStr) { - NSLog(@"%@", logStr); - }]; - - _client = [[EZVideoTalkSDK alloc] initWithParam:param localWindow:self.localView remoteWindow:self.remoteView]; - _client.delegate = self; - - // [_client startWithType:EZVideoTalkCaptureVideo | EZVideoTalkCaptureAudio]; - [_client startWithType:EZVideoTalkCaptureAudio]; -} - -- (void)stopTalk -{ - [self.client stop]; - self.client = nil; -} - -#pragma mark EZVideoTalkSDKDelegate - -- (void)videoTalk:(EZVideoTalkSDK *)client didReceivedError:(int32_t)errorCode -{ - NSLog(@"%s recived errorcode:%d", __func__, errorCode); - - dispatch_async(dispatch_get_main_queue(), ^{ - [self showMessage:[NSString stringWithFormat:@"BAVClient Error:%d",errorCode]]; - }); - - [self stopTalk]; -} - -- (void)videoTalk:(EZVideoTalkSDK *)client didReceivedMessage:(EZVideoTalkMessageType)messageCode msg:(NSString *)msg -{ - NSLog(@"%s recived messagecode:%lu ,msg:%@", __func__, (unsigned long)messageCode, msg); - - dispatch_async(dispatch_get_main_queue(), ^{ - - if (messageCode == EZVideoTalkMessageRoomCreated) { - - [self showMessage:[NSString stringWithFormat:@"宸插垱寤烘埧闂�:%d", self.client.roomID]]; - self.roomIDTextField.text = [NSString stringWithFormat:@"%d", self.client.roomID]; - } - else if (messageCode == EZVideoTalkMessageStartInputData) { - - [self showMessage:[NSString stringWithFormat:@"寮�濮嬫帹娴�"]]; - } - }); -} - -- (void)videoTalk:(EZVideoTalkSDK *)client didReceivedBavClientLogMsg:(NSString *)msg { - - NSLog(@"%s recived msg:%@", __func__, msg); -} - -- (void)videoTalk:(EZVideoTalkSDK *)client playDelayTime:(int32_t)delayTime { - - NSLog(@"%s delayTime:%d", __func__, delayTime); - - dispatch_async(dispatch_get_main_queue(), ^{ - [self showMessage:[NSString stringWithFormat:@"鎾斁鍗¢】-delayTime:%d", delayTime]]; - }); -} - -- (void)videoTalk:(EZVideoTalkSDK *)client playDelayTimeStatistics:(double)delayTimeStat { - - NSLog(@"%s delayTimeStat:%f", __func__, delayTimeStat); -} - -- (void)videoTalk:(EZVideoTalkSDK *)client didDisplayWidth:(int32_t)width height:(int32_t)height { - - NSLog(@"%s", __func__); - if (!self.bEverOpenSound) { - self.bEverOpenSound = YES; - [self.client openSound:YES]; - } -} - - - -@end +//@property (weak, nonatomic) IBOutlet UIView *localView; +//@property (weak, nonatomic) IBOutlet UIView *remoteView; +//@property (weak, nonatomic) IBOutlet UITextField *roomIDTextField; +// +//@property (nonatomic, strong) EzvizWatchServerInfo *watchServerInfo; +// +//@end +// +//@implementation EZVideoTalkViewcontroller +// +//+ (EZVideoTalkViewcontroller *) videoTalkVC { +// +// EZVideoTalkViewcontroller *vc = [[NSBundle mainBundle] loadNibNamed:@"EZVideoTalkViewcontroller" owner:nil options:nil].firstObject; +// return vc; +//} +// +//- (void)viewDidLoad { +// [super viewDidLoad]; +// // Do any additional setup after loading the view, typically from a nib. +// UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; +// if (self.view.gestureRecognizers.count <= 0) { +// [self.view addGestureRecognizer:gesture]; +// } +// +// self.title = @"Video Talk"; +//} +// +//- (void)viewWillAppear:(BOOL)animated { +// [super viewWillAppear:animated]; +// +// [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(stopTalk) name:UIApplicationDidEnterBackgroundNotification object:nil]; +// [self getWatchInfo]; +//} +// +//- (void)viewWillDisappear:(BOOL)animated { +// [super viewWillDisappear:animated]; +// +// [[NSNotificationCenter defaultCenter] removeObserver:self]; +// +// if (self.client != nil) { +// [self stopTalk]; +// } +//} +// +//- (void)didReceiveMemoryWarning { +// [super didReceiveMemoryWarning]; +// // Dispose of any resources that can be recreated. +//} +// +// +//#pragma mark Actions +// +//- (IBAction)createRoomAction:(id)sender { +// +// [self startTalkWithRoomID:0]; +//} +// +//- (IBAction)enterRoomAction:(id)sender { +// +// if (self.roomIDTextField.text.length <= 0 || [self.roomIDTextField.text integerValue] <= 0) { +// [self showMessage:@"璇疯緭鍏ユ纭殑鎴块棿鍙�"]; +// return; +// } +// +// [self startTalkWithRoomID:(int32_t)[self.roomIDTextField.text integerValue]]; +// +// [self showMessage:@"鍔犲叆鎴块棿"]; +//} +// +//- (IBAction)leaveRoomAction:(id)sender { +// +// [self stopTalk]; +// +// [self showMessage:@"宸茬寮�鎴块棿"]; +//} +// +//- (void)tapAction:(id)sender { +// +// [self.roomIDTextField resignFirstResponder]; +//} +// +//#pragma mark Helper +// +//- (void)showMessage:(NSString *)message +//{ +// [self.view makeToast:message duration:2.0 position:CSToastPositionCenter]; +//} +// +//#pragma mark BAV API +// +//- (void)getWatchInfo { +// +// __weak typeof(self) weakSelf = self; +// [EZOpenSDK requestGetWatchServerInfo:self.deviceInfo.deviceSerial completion:^(id watchServerInfo, NSError *error) { +// +// weakSelf.watchServerInfo = watchServerInfo; +// }]; +//} +// +//- (void)startTalkWithRoomID:(int32_t)roomID +//{ +// if (self.client != nil) { +// [self.client stop]; +// self.client = nil; +// } +// +// EZVideoTalkParam *param = [EZVideoTalkParam new]; +// param.iCltRole = roomID > 0 ? 1 : 0; +// param.iCltType = 1; +// param.iOtherCltType = 1; +//// param.iReason = 101; +// param.iStsPort = self.watchServerInfo.port; +// param.iRoomId = roomID > 0 ? roomID : 0; +// param.szOterId = self.deviceInfo.deviceSerial; +// param.szSelfId = @"1234567891"; +// param.szAuthToken = [EZTokenKit sharedKit].token; +// param.szStsAddr = self.watchServerInfo.domain; +// +// [EZVideoTalkSDK setDebugVideoLog:YES]; +// [EZVideoTalkSDK setDebugLogEnable:YES withLogCallback:^(NSString *logStr) { +// NSLog(@"%@", logStr); +// }]; +// +// _client = [[EZVideoTalkSDK alloc] initWithParam:param localWindow:self.localView remoteWindow:self.remoteView]; +// _client.delegate = self; +// +// // [_client startWithType:EZVideoTalkCaptureVideo | EZVideoTalkCaptureAudio]; +// [_client startWithType:EZVideoTalkCaptureAudio]; +//} +// +//- (void)stopTalk +//{ +// [self.client stop]; +// self.client = nil; +//} +// +//#pragma mark EZVideoTalkSDKDelegate +// +//- (void)videoTalk:(EZVideoTalkSDK *)client didReceivedError:(int32_t)errorCode +//{ +// NSLog(@"%s recived errorcode:%d", __func__, errorCode); +// +// dispatch_async(dispatch_get_main_queue(), ^{ +// [self showMessage:[NSString stringWithFormat:@"BAVClient Error:%d",errorCode]]; +// }); +// +// [self stopTalk]; +//} +// +//- (void)videoTalk:(EZVideoTalkSDK *)client didReceivedMessage:(EZVideoTalkMessageType)messageCode msg:(NSString *)msg +//{ +// NSLog(@"%s recived messagecode:%lu ,msg:%@", __func__, (unsigned long)messageCode, msg); +// +// dispatch_async(dispatch_get_main_queue(), ^{ +// +// if (messageCode == EZVideoTalkMessageRoomCreated) { +// +// [self showMessage:[NSString stringWithFormat:@"宸插垱寤烘埧闂�:%d", self.client.roomID]]; +// self.roomIDTextField.text = [NSString stringWithFormat:@"%d", self.client.roomID]; +// } +// else if (messageCode == EZVideoTalkMessageStartInputData) { +// +// [self showMessage:[NSString stringWithFormat:@"寮�濮嬫帹娴�"]]; +// } +// }); +//} +// +//- (void)videoTalk:(EZVideoTalkSDK *)client didReceivedBavClientLogMsg:(NSString *)msg { +// +// NSLog(@"%s recived msg:%@", __func__, msg); +//} +// +//- (void)videoTalk:(EZVideoTalkSDK *)client playDelayTime:(int32_t)delayTime { +// +// NSLog(@"%s delayTime:%d", __func__, delayTime); +// +// dispatch_async(dispatch_get_main_queue(), ^{ +// [self showMessage:[NSString stringWithFormat:@"鎾斁鍗¢】-delayTime:%d", delayTime]]; +// }); +//} +// +//- (void)videoTalk:(EZVideoTalkSDK *)client playDelayTimeStatistics:(double)delayTimeStat { +// +// NSLog(@"%s delayTimeStat:%f", __func__, delayTimeStat); +//} +// +//- (void)videoTalk:(EZVideoTalkSDK *)client didDisplayWidth:(int32_t)width height:(int32_t)height { +// +// NSLog(@"%s", __func__); +// if (!self.bEverOpenSound) { +// self.bEverOpenSound = YES; +// [self.client openSound:YES]; +// } +//} +// +// +// +//@end -- Gitblit v1.8.0