From fa84925cc150b7928dfc76430a8499c031069534 Mon Sep 17 00:00:00 2001 From: eagleychen Date: Wed, 18 Dec 2024 18:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=8C=E4=B8=AD=E8=BD=AC+?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=9F=E5=BC=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Podfile.lock | 8 ++-- .../Controller/TIoTAreaNetworkPreviewVC.m | 3 +- .../Controller/TIoTDemoNVRSubDeviceVC.m | 2 +- .../Controller/PreviousPath/TIoTPlayListVC.m | 2 +- .../Controller/PreviousPath/TIoTPlayMovieVC.m | 2 +- .../P2P/Controller/TIoTDemoPreviewDeviceVC.m | 7 ++-- .../P2P/Controller/TIoTDemoSameScreenVC.m | 2 +- .../P2P/Controller/TIoTDemoVideoCallVC.m | 7 ++-- .../P2P/Controller/TIoTDemoVideoPushVC.m | 7 ++-- .../Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m | 7 ++-- .../Controller/TIoTDemoLocalRecordVC.m | 2 +- .../Video/PlayBack/TIoTDemoPlaybackVC.m | 4 +- Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h | 18 ++++----- Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm | 40 +++++++++++++------ TIoTLinkVideo.podspec | 2 +- 15 files changed, 64 insertions(+), 49 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 35c0c7a6b..50c42ebff 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -35,13 +35,13 @@ PODS: - TIoTLinkKit_SoundTouch (1.0.0) - TIoTLinkKit_TPNS (1.0.1) - TIoTLinkKit_WechatOpenSDK (1.0.1) - - TIoTLinkKit_XP2P (2.4.52) + - TIoTLinkKit_XP2P (2.4.53-beta.202412180853) - TIoTLinkVideo (1.0.0): - CocoaAsyncSocket (= 7.6.5) - TIoTLinkKit_FLV (= 2.2.3) - TIoTLinkKit_GVoiceSE (>= 1.0.9) - TIoTLinkKit_SoundTouch (= 1.0.0) - - TIoTLinkKit_XP2P (= 2.4.52) + - TIoTLinkKit_XP2P (= 2.4.53-beta.202412180853) - TPCircularBuffer (= 1.6.1) - TPCircularBuffer (1.6.1) - TrueTime (5.0.3) @@ -133,8 +133,8 @@ SPEC CHECKSUMS: TIoTLinkKit_SoundTouch: cf79ae182b6c2349ff65bac7a338974bc538fa77 TIoTLinkKit_TPNS: 7cea4fc1d20ef6c4c11c4f0b66bbb10ecf4ed968 TIoTLinkKit_WechatOpenSDK: 7822d68cc5c46edf3f6020422202e7b65ea87614 - TIoTLinkKit_XP2P: e7cc68a561a86bfde6ecd70ed098e7c66be65df1 - TIoTLinkVideo: bf6562362dfc6fb6228eb397914867c8cc070db5 + TIoTLinkKit_XP2P: f8e7e8646955e42d151e36885a5ff68d7df29046 + TIoTLinkVideo: c3afe0e458b0e920665f012772d255690b120e38 TPCircularBuffer: c13243556527551c4d320709c7b14a6d20cdc30a TrueTime: b49551ffafb28a9dee04e51b226f42a416010842 TXLiteAVSDK_TRTC: e3383a81565e8bb2aaaaab4bd099ad5239cd5b2d diff --git a/Source/LinkSDKDemo/Video/LocalAreaNetwork/Controller/TIoTAreaNetworkPreviewVC.m b/Source/LinkSDKDemo/Video/LocalAreaNetwork/Controller/TIoTAreaNetworkPreviewVC.m index a4b63b952..973b13bc0 100644 --- a/Source/LinkSDKDemo/Video/LocalAreaNetwork/Controller/TIoTAreaNetworkPreviewVC.m +++ b/Source/LinkSDKDemo/Video/LocalAreaNetwork/Controller/TIoTAreaNetworkPreviewVC.m @@ -892,7 +892,8 @@ - (void)responseP2PdisConnect:(NSNotification *)notify { #warning 开启p2p dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:DeviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:@""]; + //TODO 重新拉取 p2pinfo 后,setxp2pinfo + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:DeviceName?:@"" xp2pinfo:@"请重新拉取xp2pinfo,填入此处"]; [self setVieoPlayerStartPlayWith:self.qualityString]; }); diff --git a/Source/LinkSDKDemo/Video/NVRList/Controller/TIoTDemoNVRSubDeviceVC.m b/Source/LinkSDKDemo/Video/NVRList/Controller/TIoTDemoNVRSubDeviceVC.m index 4aa199c42..93dab19d2 100644 --- a/Source/LinkSDKDemo/Video/NVRList/Controller/TIoTDemoNVRSubDeviceVC.m +++ b/Source/LinkSDKDemo/Video/NVRList/Controller/TIoTDemoNVRSubDeviceVC.m @@ -186,7 +186,7 @@ - (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName isReconnection:(BOO - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfoString?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""]; } - (void)setupUIViews { diff --git a/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayListVC.m b/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayListVC.m index 792dd0f4e..1af17e7e7 100644 --- a/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayListVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayListVC.m @@ -104,7 +104,7 @@ - (void)requestXp2pInfo:(NSString *)deviceName { - (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfo{ TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; } /// video 设备列表 - (void)requestVideoList { diff --git a/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayMovieVC.m b/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayMovieVC.m index cb5f7b9e7..4ca09241e 100644 --- a/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayMovieVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayMovieVC.m @@ -210,7 +210,7 @@ - (void)responseP2PdisConnect:(NSNotification *)notify { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfoString?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""]; } - (void)viewDidDisappear:(BOOL)animated { diff --git a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m index 43350138f..938896f7b 100644 --- a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m @@ -146,7 +146,7 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo { [self requestCloudStoreVideoList]; TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; [self setVieoPlayerStartPlayWith:self.qualityString]; //计算IPC打洞开始时间 @@ -1246,7 +1246,7 @@ - (void)resconnectXp2pRequestInfo:(NSString *)DeviceName { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; [self getDeviceStatusWithType:action_live qualityType:self.qualityString completion:^(BOOL finished) { if (finished) { @@ -1704,7 +1704,8 @@ - (void)appNetWorkResume { //重连使用 [[TIoTCoreXP2PBridge sharedInstance] stopService:self.deviceName?:@""]; TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; + [self requestXp2pInfo];// 重新获取info,启动p2p +// [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; } diff --git a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoSameScreenVC.m b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoSameScreenVC.m index da91140c4..df90ac6b0 100644 --- a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoSameScreenVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoSameScreenVC.m @@ -670,7 +670,7 @@ - (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName isReconnection:(BOO - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfoString?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""]; } #pragma mark -IJKPlayer diff --git a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoCallVC.m b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoCallVC.m index ec419f2b1..9f065b97c 100644 --- a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoCallVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoCallVC.m @@ -111,7 +111,7 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; if (errorcode == XP2P_ERR_VERSION) { UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)]; @@ -548,7 +548,7 @@ - (void)resconnectXp2pRequestInfo:(NSString *)DeviceName { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; [self getDeviceStatusWithType:action_live qualityType:self.qualityString completion:^(BOOL finished) { if (finished) { @@ -790,7 +790,8 @@ - (void)appNetWorkResume { //重连使用 [[TIoTCoreXP2PBridge sharedInstance] stopService:self.deviceName?:@""]; TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; + [self requestXp2pInfo];// 重新获取info,启动p2p +// [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; } diff --git a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoPushVC.m b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoPushVC.m index 3bb950216..3b221e7a7 100644 --- a/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoPushVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoPushVC.m @@ -170,7 +170,7 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; if (errorcode == XP2P_ERR_VERSION) { UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)]; @@ -515,7 +515,7 @@ - (void)resconnectXp2pRequestInfo:(NSString *)DeviceName { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; [self getDeviceStatusWithType:action_live qualityType:self.qualityString completion:^(BOOL finished) { if (finished) { @@ -626,7 +626,8 @@ - (void)appNetWorkResume { //重连使用 [[TIoTCoreXP2PBridge sharedInstance] stopService:self.deviceName?:@""]; TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; + [self requestXp2pInfo];// 重新获取info,启动p2p +// [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; } diff --git a/Source/LinkSDKDemo/Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m b/Source/LinkSDKDemo/Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m index 7caf04cd6..df4086df5 100644 --- a/Source/LinkSDKDemo/Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m +++ b/Source/LinkSDKDemo/Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m @@ -144,7 +144,7 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; if (errorcode == XP2P_ERR_VERSION) { UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)]; @@ -1225,7 +1225,7 @@ - (void)resconnectXp2pRequestInfo:(NSString *)DeviceName { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; [self getDeviceStatusWithType:action_live qualityType:self.qualityString completion:^(BOOL finished) { if (finished) { @@ -1695,7 +1695,8 @@ - (void)appNetWorkResume { //重连使用 [[TIoTCoreXP2PBridge sharedInstance] stopService:self.deviceName?:@""]; TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; - [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; + [self requestXp2pInfo];// 重新获取info,启动p2p +// [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudSecretId sec_key:env.cloudSecretKey pro_id:env.cloudProductId dev_name:self.deviceName?:@""]; } diff --git a/Source/LinkSDKDemo/Video/PlayBack/LocalPlayBack/Controller/TIoTDemoLocalRecordVC.m b/Source/LinkSDKDemo/Video/PlayBack/LocalPlayBack/Controller/TIoTDemoLocalRecordVC.m index 6119ca033..3f2dbae76 100644 --- a/Source/LinkSDKDemo/Video/PlayBack/LocalPlayBack/Controller/TIoTDemoLocalRecordVC.m +++ b/Source/LinkSDKDemo/Video/PlayBack/LocalPlayBack/Controller/TIoTDemoLocalRecordVC.m @@ -1622,7 +1622,7 @@ - (void)responseLocalP2PdisConnect:(NSNotification *)notify { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfoString?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""]; } #pragma mark Remove Movie Notification Handlers diff --git a/Source/LinkSDKDemo/Video/PlayBack/TIoTDemoPlaybackVC.m b/Source/LinkSDKDemo/Video/PlayBack/TIoTDemoPlaybackVC.m index 1a67e58b3..93607c85c 100644 --- a/Source/LinkSDKDemo/Video/PlayBack/TIoTDemoPlaybackVC.m +++ b/Source/LinkSDKDemo/Video/PlayBack/TIoTDemoPlaybackVC.m @@ -93,7 +93,7 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""]; if (errorcode == XP2P_ERR_VERSION) { UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)]; @@ -285,7 +285,7 @@ - (void)responseP2PdisConnect:(NSNotification *)notify { - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString { TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment]; [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""]; - [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfoString?:@""]; + [[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""]; } - (UIViewController *)getCurrentViewController diff --git a/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h b/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h index 570ab4438..65385d63c 100644 --- a/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h +++ b/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h @@ -22,6 +22,9 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd; @property (nonatomic, strong)NSString *appkey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret @property (nonatomic, strong)NSString *appsecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) @property (nonatomic, strong)NSString *userid; //用户纬度(每个手机区分开)使用用户自有的账号系统userid;若无请配置为[TIoTCoreXP2PBridge sharedInstance].getAppUUID; 查找日志是需提供此userid字段 + +@property (nonatomic, assign)BOOL crossStunTurn; //是否打开双中转开关,默认false +@property (nonatomic, assign)XP2PProtocolType type; //通信协议,默认auto @end @protocol TIoTCoreXP2PBridgeDelegate @@ -74,24 +77,17 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd; + (NSString *)getSDKVersion; + (instancetype)sharedInstance ; -// 不建议使用下面两个start接口,避免泄漏您的secretid和secretkey,会造成您的账户泄漏,demo仅用此接口做演示使用 -- (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name __attribute__((deprecated("Use -startAppWith & -setXp2pInfo"))); -- (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo __attribute__((deprecated("Use -startAppWith & -setXp2pInfo"))); - /* * 启动 sdk 服务,productid和devicename可以从video控制台创建得倒 * type: 默认auto模式,udp探测不通自动切换至tcp */ -- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name; -- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name type:(XP2PProtocolType)type; +- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name; __attribute__((deprecated("Use -startAppWith: dev_name: appconfig:"))); +- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name appconfig:(TIoTP2PAPPConfig *)appconfig; /* - * 此接口慎重:需注意 正式版app发布时候不需要传入secretid和secretkey,避免将这两个参数放置在app中,防止账号泄露,此处仅为演示功能 - * 此接口只二者选一:传入xp2pinfo 就不需要填写 secretid和secretkey,xp2pinfo可从自建服务获取; - * 仅跑通流程的话,可设置 secretid和secretkey 两个参数,xp2pinfo传“”即可 + * 设置设备 xp2pinfo ,ready 回调之后,即可开始(拉流、发信令、对讲等) */ -- (XP2PErrCode)setXp2pInfo:(NSString *)dev_name sec_id:(NSString *)sec_id sec_key:(NSString *)sec_key xp2pinfo:(NSString *)xp2pinfo __attribute__((deprecated("Use -setXp2pInfo: xp2pinfo:"))); -- (XP2PErrCode)setXp2pInfo:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo appconfig:(TIoTP2PAPPConfig *)appconfig; +- (XP2PErrCode)setXp2pInfo:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo; /* * 使用播放器播放时,需先等待 SDK 初始化完成,ready事件(xp2preconnect 通知)之后,即可获取到 http-url diff --git a/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm b/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm index 9336ab929..0c01a882c 100644 --- a/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm +++ b/Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm @@ -231,7 +231,7 @@ - (instancetype)init { return self; } - +/* - (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name { return [self startAppWith:sec_id sec_key:sec_key pro_id:pro_id dev_name:dev_name xp2pinfo:@""]; } @@ -241,7 +241,7 @@ - (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_i setDeviceXp2pInfo(dev_name.UTF8String, xp2pinfo.UTF8String); return (XP2PErrCode)ret; } - +*/ - (const char *)dicConvertString:(NSDictionary *)dic { NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:kNilOptions error:&error]; @@ -253,11 +253,22 @@ - (const char *)dicConvertString:(NSDictionary *)dic { } - (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name { - return [self startAppWith:pro_id dev_name:dev_name type:XP2P_PROTOCOL_AUTO]; + TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new]; + config.appkey = @"appkey"; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret + config.appsecret = @"appsecret"; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret + config.userid = [self getAppUUID]; + + config.type = XP2P_PROTOCOL_AUTO; + config.crossStunTurn = YES; + return [self startAppWith:pro_id dev_name:dev_name appconfig:config]; } -- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name type:(XP2PProtocolType)type{ - // setStunServerToXp2p("11.11.11.11", 111); - // setLogEnable(false, false); +- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name appconfig:(TIoTP2PAPPConfig *)appconfig { + if (!appconfig || appconfig.appkey.length < 1 || appconfig.appsecret.length < 1 || appconfig.userid.length < 1) { + NSLog(@"请输入正确的appconfig"); + return XP2P_ERR_INIT_PRM; + } + [self appGetUserConfig:appconfig]; //get config + NSString *bundleid = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]?:@""; NSString *nsstr_user_id = [self getAppUUID]; setContentDetail([self dicConvertString:@{@"str_user_id":nsstr_user_id, @"version":@"video-v2.4.30_beta1", @"str_package_name": bundleid}], @@ -280,13 +291,19 @@ - (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name typ [self.logger startLogging]; } + // 配置是否启用双中转 + if (appconfig.crossStunTurn) { + setCrossStunTurn(true); + } + //1.配置IOT_P2P SDK self.pro_id = pro_id; self.dev_name = dev_name; - int ret = startService(dev_name.UTF8String, pro_id.UTF8String, dev_name.UTF8String, type); + int ret = startService(dev_name.UTF8String, pro_id.UTF8String, dev_name.UTF8String, appconfig.type); return (XP2PErrCode)ret; } +/* - (XP2PErrCode)setXp2pInfo:(NSString *)dev_name sec_id:(NSString *)sec_id sec_key:(NSString *)sec_key xp2pinfo:(NSString *)xp2pinfo { if (xp2pinfo == nil || [xp2pinfo isEqualToString:@""]) { @@ -305,17 +322,14 @@ - (XP2PErrCode)setXp2pInfo:(NSString *)dev_name sec_id:(NSString *)sec_id sec_ke [self setXp2pInfo:dev_name xp2pinfo:xp2pinfo appconfig:config]; return XP2P_ERR_INIT_PRM; } +*/ -- (XP2PErrCode)setXp2pInfo:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo appconfig:(TIoTP2PAPPConfig *)appconfig { - if (!appconfig || appconfig.appkey.length < 1 || appconfig.appsecret.length < 1 || appconfig.userid.length < 1) { - NSLog(@"请输入正确的appconfig"); - return XP2P_ERR_INIT_PRM; - } +- (XP2PErrCode)setXp2pInfo:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo { if (xp2pinfo == nil || xp2pinfo.length < 1) { NSLog(@"请输入正确的xp2pInfo"); return XP2P_ERR_INIT_PRM; } - [self appGetUserConfig:appconfig]; + int ret = setDeviceXp2pInfo(dev_name.UTF8String, xp2pinfo.UTF8String); return (XP2PErrCode)ret; } diff --git a/TIoTLinkVideo.podspec b/TIoTLinkVideo.podspec index 517859f6f..65c1aa976 100644 --- a/TIoTLinkVideo.podspec +++ b/TIoTLinkVideo.podspec @@ -19,7 +19,7 @@ Pod::Spec.new do |s| s.source_files = 'Source/SDK/LinkVideo/**/*.{h,m,c,mm}' s.resource = 'Source/SDK/LinkVideo/FLV/asset/GvoiceSE_v1_239-119-oneref-e.nn' - s.dependency 'TIoTLinkKit_XP2P', '2.4.52' + s.dependency 'TIoTLinkKit_XP2P', '2.4.53-beta.202412180853' s.dependency 'TIoTLinkKit_FLV', '2.2.3' s.dependency 'CocoaAsyncSocket', '7.6.5' s.dependency 'TIoTLinkKit_SoundTouch', '1.0.0'