Skip to content

Commit

Permalink
添加三元组直接拉流方式
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleychen committed Feb 20, 2025
1 parent 69d80d5 commit e93120c
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ target 'LinkApp' do
pod 'CocoaAsyncSocket', '7.6.5'
pod 'TIoTLinkKit_TPNS', '1.0.1'
pod 'TIoTLinkKit_WechatOpenSDK', '1.0.1'
pod 'TIoTLinkKit_IJKPlayer', '2.0.15'
pod 'TIoTLinkKit_IJKPlayer', '2.0.16-beta.202502200213'
pod 'Bugly', '2.5.91'
end

Expand All @@ -42,7 +42,7 @@ target 'LinkSDKDemo' do
pod 'TIoTLinkKit/LinkRTC', :path => './'

pod 'TIoTLinkVideo', :path => './'
pod 'TIoTLinkKit_IJKPlayer', '2.0.15'
pod 'TIoTLinkKit_IJKPlayer', '2.0.16-beta.202502200213'
end

#older OS versions does not contain 'libarclite', at least iOS 11
Expand Down
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ PODS:
- TXLiteAVSDK_TRTC (= 8.0.9644)
- YYModel (= 1.0.4)
- TIoTLinkKit_FLV (2.2.3)
- TIoTLinkKit_GVoiceSE (1.0.9)
- TIoTLinkKit_IJKPlayer (2.0.15)
- TIoTLinkKit_GVoiceSE (1.1.0)
- TIoTLinkKit_IJKPlayer (2.0.16-beta.202502200213)
- TIoTLinkKit_SoundTouch (1.0.0)
- TIoTLinkKit_TPNS (1.0.1)
- TIoTLinkKit_WechatOpenSDK (1.0.1)
Expand Down Expand Up @@ -66,7 +66,7 @@ DEPENDENCIES:
- Tencent-MapSDK (= 4.3.9)
- TIoTLinkKit (from `./`)
- TIoTLinkKit/LinkRTC (from `./`)
- TIoTLinkKit_IJKPlayer (= 2.0.15)
- TIoTLinkKit_IJKPlayer (= 2.0.16-beta.202502200213)
- TIoTLinkKit_TPNS (= 1.0.1)
- TIoTLinkKit_WechatOpenSDK (= 1.0.1)
- TIoTLinkVideo (from `./`)
Expand Down Expand Up @@ -128,8 +128,8 @@ SPEC CHECKSUMS:
Tencent-MapSDK: 6dfbee53b46131deb4c4bb02b3edc5ce7fb630dc
TIoTLinkKit: 0386fb583c61765a02ad5cca810c7661d5a0bc53
TIoTLinkKit_FLV: aec2b2ec9664990ec6c5b9f760fc1a9043d5a9a5
TIoTLinkKit_GVoiceSE: 27d0b2045a1acc600cd69c256e7667dacf7dc051
TIoTLinkKit_IJKPlayer: 55cc0faec1a9395118fe0309652e83b8136d0599
TIoTLinkKit_GVoiceSE: cd43b03fd7b6f923987352452a82680d7c14ba68
TIoTLinkKit_IJKPlayer: f69a63ee19daaab5838e193dee2d785ad5c0b0e5
TIoTLinkKit_SoundTouch: cf79ae182b6c2349ff65bac7a338974bc538fa77
TIoTLinkKit_TPNS: 7cea4fc1d20ef6c4c11c4f0b66bbb10ecf4ed968
TIoTLinkKit_WechatOpenSDK: 7822d68cc5c46edf3f6020422202e7b65ea87614
Expand All @@ -141,6 +141,6 @@ SPEC CHECKSUMS:
TZImagePickerController: bf4c57b98d8707fce41ea6be872414a71c7a8c9d
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30

PODFILE CHECKSUM: 795d3763c3242d732936fb2a6c17075ff99dd006
PODFILE CHECKSUM: 92a7d686950802e211919ac3c37c266e3ac9323e

COCOAPODS: 1.14.3
9 changes: 8 additions & 1 deletion Source/LinkSDKDemo/Video/Login/Controller/TIoTDemoVideoVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "TIoTCoreXP2PBridge.h"
#import "UILabel+TIoTExtension.h"
#import "TIoTAreaNetworkConfigVC.h"
#import "TIoTDeviceInfoVC.h"
@interface TIoTDemoVideoVC ()

@end
Expand Down Expand Up @@ -86,9 +87,10 @@ - (void)initVideoUI {
}];

UIButton *industryVersionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[industryVersionBtn setButtonFormateWithTitlt:@"IoT Video(行业版" titleColorHexString:kVideoDemoMainThemeColor font:[UIFont wcPfRegularFontOfSize:17]];
[industryVersionBtn setButtonFormateWithTitlt:@"IoT Video(直连设备" titleColorHexString:kVideoDemoMainThemeColor font:[UIFont wcPfRegularFontOfSize:17]];
industryVersionBtn.layer.borderColor = [UIColor colorWithHexString:kVideoDemoMainThemeColor].CGColor;
industryVersionBtn.layer.borderWidth = 1;
[industryVersionBtn addTarget:self action:@selector(jumpOnlyDevice) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:industryVersionBtn];
[industryVersionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(consumerVersionBtn);
Expand All @@ -112,6 +114,11 @@ - (void)jumpPlaying {
[self.navigationController pushViewController:demoPlayListVC animated:YES];
}

- (void)jumpOnlyDevice {
TIoTDeviceInfoVC *areaNetVC = [[TIoTDeviceInfoVC alloc]init];
[self.navigationController pushViewController:areaNetVC animated:YES];
}

- (void)jumpLocalAreaNetwork {
TIoTAreaNetworkConfigVC *areaNetVC = [[TIoTAreaNetworkConfigVC alloc]init];
[self.navigationController pushViewController:areaNetVC animated:YES];
Expand Down
15 changes: 15 additions & 0 deletions Source/LinkSDKDemo/Video/Login/Controller/TIoTDeviceInfoVC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// TIoTAreaNetworkConfigVC.h
// LinkSDKDemo
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/// 局域网探测设备 输入信息控制器
@interface TIoTDeviceInfoVC : UIViewController

@end

NS_ASSUME_NONNULL_END
243 changes: 243 additions & 0 deletions Source/LinkSDKDemo/Video/Login/Controller/TIoTDeviceInfoVC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
//
// TIoTAreaNetworkConfigVC.m
// LinkSDKDemo

#import "TIoTDeviceInfoVC.h"
#import "TIoTDemoPreviewDeviceVC.h"
#import "TIoTAreaNetworkDeviceCell.h"
#import "TIoTLocalNetDetch.h"
#import "TIoTCoreAppEnvironment.h"
#import "TIoTCoreUserManage.h"
#import "NSString+Extension.h"
#import "UIImage+TIoTDemoExtension.h"

@interface TIoTDeviceInfoVC ()<UITextFieldDelegate>
@property (nonatomic, strong) UITextField *productID;
@property (nonatomic, strong) UITextField *devicenname;
@property (nonatomic, strong) UITextField *xp2pinfo;
@end

@implementation TIoTDeviceInfoVC

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setupUI];

[self setupNavBarStyleWithNormal:NO];
if (@available(iOS 13.0, *)) {
UINavigationBarAppearance *barApp = [[UINavigationBarAppearance alloc] init];
[barApp configureWithOpaqueBackground];
barApp.backgroundColor = [UIColor whiteColor];
barApp.shadowColor = [UIColor clearColor];
barApp.shadowImage = [UIImage new];
self.navigationController.navigationBar.standardAppearance = barApp;
self.navigationController.navigationBar.scrollEdgeAppearance = barApp;
}
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self setupNavBarStyleWithNormal:NO];
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self setupNavBarStyleWithNormal:YES];
}

- (void)setupNavBarStyleWithNormal:(BOOL)isNormal {

if (isNormal) {
[self.navigationController.navigationBar setBackgroundImage:[UIImage getGradientImageWithColors:@[[UIColor colorWithHexString:@"#ffffff"],[UIColor colorWithHexString:@"#ffffff"]] imgSize:CGSizeMake(kScreenWidth, 44)] forBarMetrics:UIBarMetricsDefault];
}else {
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FFFFFF"],NSFontAttributeName:[UIFont wcPfRegularFontOfSize:17]}];
[self.navigationController.navigationBar setBackgroundImage:[UIImage getGradientImageWithColors:@[[UIColor colorWithHexString:@"#3D8BFF"],[UIColor colorWithHexString:@"#1242FF"]] imgSize:CGSizeMake(kScreenWidth, 44)] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
}

}
- (void)dealloc {
}

- (void)setupUI {
self.view.backgroundColor = [UIColor whiteColor];
self.title = @"IoT Video (局域网)";

CGFloat kWidthPadding = 16;
CGFloat kItemHeight = 56;
CGFloat kAPIBtnWidthHeight = 24;
CGFloat kInputItemLeftPadding = 150;

//第一行
UILabel *productIDLabel = [[UILabel alloc]init];
[productIDLabel setLabelFormateTitle:@"Product ID" font:[UIFont wcPfRegularFontOfSize:17] titleColorHexString:@"#000000" textAlignment:NSTextAlignmentLeft];
[self.view addSubview:productIDLabel];
[productIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
if (@available(iOS 11.0, *)) {
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(20);
} else {
// Fallback on earlier versions
make.top.equalTo(self.view.mas_top).offset(64).offset(20);
}
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
make.height.mas_equalTo(kItemHeight);
}];

self.productID = [[UITextField alloc]init];
self.productID.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
self.productID.returnKeyType = UIReturnKeyDone;
self.productID.placeholder = @"请输入Product ID";
self.productID.delegate = self;
self.productID.textAlignment = NSTextAlignmentLeft;
self.productID.returnKeyType = UIReturnKeyDone;
[self.view addSubview:self.productID];
[self.productID mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kInputItemLeftPadding);
make.centerY.equalTo(productIDLabel);
make.height.equalTo(productIDLabel);
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding - kAPIBtnWidthHeight);
}];

UIView *line2 = [[UIView alloc]init];
line2.backgroundColor = [UIColor colorWithHexString:kVideoDemoPlaceColor];
[self.view addSubview:line2];
[line2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
make.right.equalTo(self.view);
make.top.equalTo(productIDLabel.mas_bottom);
make.height.mas_equalTo(1);
}];

//第二行
UILabel *clientTokenLabel = [[UILabel alloc]init];
[clientTokenLabel setLabelFormateTitle:@"Device Name" font:[UIFont wcPfRegularFontOfSize:17] titleColorHexString:@"#000000" textAlignment:NSTextAlignmentLeft];
[self.view addSubview:clientTokenLabel];
[clientTokenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
make.top.equalTo(line2.mas_bottom);
make.height.mas_equalTo(kItemHeight);
}];

self.devicenname = [[UITextField alloc]init];
self.devicenname.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
self.devicenname.placeholder = @"请输入Device Name";
self.devicenname.delegate = self;
// self.clientToken.secureTextEntry = YES;
self.devicenname.textAlignment = NSTextAlignmentLeft;
self.devicenname.returnKeyType = UIReturnKeyDone;
[self.view addSubview:self.devicenname];
[self.devicenname mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kInputItemLeftPadding);
make.centerY.equalTo(clientTokenLabel);
make.height.equalTo(clientTokenLabel);
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding);
}];

UIView *line3 = [[UIView alloc]init];
line3.backgroundColor = [UIColor colorWithHexString:kVideoDemoPlaceColor];
[self.view addSubview:line3];
[line3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(clientTokenLabel.mas_bottom);
make.height.mas_equalTo(1);
make.left.right.equalTo(line2);
}];

//第三行
UILabel *p2pinfoLabel = [[UILabel alloc]init];
[p2pinfoLabel setLabelFormateTitle:@"XP2P Info" font:[UIFont wcPfRegularFontOfSize:17] titleColorHexString:@"#000000" textAlignment:NSTextAlignmentLeft];
[self.view addSubview:p2pinfoLabel];
[p2pinfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
make.top.equalTo(line3.mas_bottom);
make.height.mas_equalTo(kItemHeight);
}];

self.xp2pinfo = [[UITextField alloc]init];
self.xp2pinfo.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
self.xp2pinfo.placeholder = @"请输入XP2P Info";
self.xp2pinfo.delegate = self;
// self.clientToken.secureTextEntry = YES;
self.xp2pinfo.textAlignment = NSTextAlignmentLeft;
self.xp2pinfo.returnKeyType = UIReturnKeyDone;
[self.view addSubview:self.xp2pinfo];
[self.xp2pinfo mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kInputItemLeftPadding);
make.centerY.equalTo(p2pinfoLabel);
make.height.equalTo(p2pinfoLabel);
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding);
}];

UIView *line4 = [[UIView alloc]init];
line4.backgroundColor = [UIColor colorWithHexString:kVideoDemoPlaceColor];
[self.view addSubview:line4];
[line4 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(p2pinfoLabel.mas_bottom);
make.height.mas_equalTo(1);
make.left.right.equalTo(line2);
}];

UIButton *detectDeviceBtn = [UIButton buttonWithType:UIButtonTypeSystem];
detectDeviceBtn.backgroundColor = [UIColor colorWithHexString:kVideoDemoMainThemeColor];
[detectDeviceBtn setButtonFormateWithTitlt:@"连接设备" titleColorHexString:@"#FFFFFF" font:[UIFont wcPfRegularFontOfSize:17]];
[detectDeviceBtn addTarget:self action:@selector(detectEquipment) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:detectDeviceBtn];
[detectDeviceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding);
make.top.equalTo(line4.mas_bottom).offset(30);
make.height.mas_equalTo(45);
}];

[self judgeAutoFillInputInfo];
}

- (void)judgeAutoFillInputInfo {

self.productID.text = [TIoTCoreUserManage shared].demoAreaNetProductID;
self.devicenname.text = [TIoTCoreUserManage shared].demoAreaNetClientToken;
self.xp2pinfo.text = [TIoTCoreUserManage shared].demoAreaNetClientToken;

}

- (void)saveInputInfo {

[TIoTCoreUserManage shared].demoAreaNetProductID = self.productID.text;
[TIoTCoreUserManage shared].demoAreaNetClientToken = self.devicenname.text;
}

///MARK: 探测设备
- (void)detectEquipment {
[self hideKeyBoard];
[self saveInputInfo];

TIoTDemoPreviewDeviceVC *previewDeviceVC = [[TIoTDemoPreviewDeviceVC alloc]init];

TIoTExploreOrVideoDeviceModel *model = [TIoTExploreOrVideoDeviceModel new]; model.DeviceName = self.devicenname.text;
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
env.cloudProductId = self.productID.text;
previewDeviceVC.selectedModel = model;
previewDeviceVC.mXp2pInfo = self.xp2pinfo.text;
previewDeviceVC.isNVR = NO;
[self.navigationController pushViewController:previewDeviceVC animated:YES];
}



#pragma mark - UITextField delegate
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
[self hideKeyBoard];
return YES;
}

- (void)hideKeyBoard {
[self.productID resignFirstResponder];
[self.devicenname resignFirstResponder];
[self.xp2pinfo resignFirstResponder];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[self hideKeyBoard];
return YES;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface TIoTDemoPreviewDeviceVC : TIoTDemoBaseViewController
@property (nonatomic, strong) TIoTExploreOrVideoDeviceModel *selectedModel; //选择设备的model
@property (nonatomic, copy) NSString *mXp2pInfo;
@property (nonatomic, assign) BOOL isNVR; //区分是NVR、IPC
@property (nonatomic, strong) NSString *deviceNameNVR;
@end
Expand Down
Loading

0 comments on commit e93120c

Please sign in to comment.