Skip to content

Commit e93120c

Browse files
author
eagleychen
committed
添加三元组直接拉流方式
1 parent 69d80d5 commit e93120c

File tree

8 files changed

+293
-78
lines changed

8 files changed

+293
-78
lines changed

Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ target 'LinkApp' do
3030
pod 'CocoaAsyncSocket', '7.6.5'
3131
pod 'TIoTLinkKit_TPNS', '1.0.1'
3232
pod 'TIoTLinkKit_WechatOpenSDK', '1.0.1'
33-
pod 'TIoTLinkKit_IJKPlayer', '2.0.15'
33+
pod 'TIoTLinkKit_IJKPlayer', '2.0.16-beta.202502200213'
3434
pod 'Bugly', '2.5.91'
3535
end
3636

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

4444
pod 'TIoTLinkVideo', :path => './'
45-
pod 'TIoTLinkKit_IJKPlayer', '2.0.15'
45+
pod 'TIoTLinkKit_IJKPlayer', '2.0.16-beta.202502200213'
4646
end
4747

4848
#older OS versions does not contain 'libarclite', at least iOS 11

Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ PODS:
3030
- TXLiteAVSDK_TRTC (= 8.0.9644)
3131
- YYModel (= 1.0.4)
3232
- TIoTLinkKit_FLV (2.2.3)
33-
- TIoTLinkKit_GVoiceSE (1.0.9)
34-
- TIoTLinkKit_IJKPlayer (2.0.15)
33+
- TIoTLinkKit_GVoiceSE (1.1.0)
34+
- TIoTLinkKit_IJKPlayer (2.0.16-beta.202502200213)
3535
- TIoTLinkKit_SoundTouch (1.0.0)
3636
- TIoTLinkKit_TPNS (1.0.1)
3737
- TIoTLinkKit_WechatOpenSDK (1.0.1)
@@ -66,7 +66,7 @@ DEPENDENCIES:
6666
- Tencent-MapSDK (= 4.3.9)
6767
- TIoTLinkKit (from `./`)
6868
- TIoTLinkKit/LinkRTC (from `./`)
69-
- TIoTLinkKit_IJKPlayer (= 2.0.15)
69+
- TIoTLinkKit_IJKPlayer (= 2.0.16-beta.202502200213)
7070
- TIoTLinkKit_TPNS (= 1.0.1)
7171
- TIoTLinkKit_WechatOpenSDK (= 1.0.1)
7272
- TIoTLinkVideo (from `./`)
@@ -128,8 +128,8 @@ SPEC CHECKSUMS:
128128
Tencent-MapSDK: 6dfbee53b46131deb4c4bb02b3edc5ce7fb630dc
129129
TIoTLinkKit: 0386fb583c61765a02ad5cca810c7661d5a0bc53
130130
TIoTLinkKit_FLV: aec2b2ec9664990ec6c5b9f760fc1a9043d5a9a5
131-
TIoTLinkKit_GVoiceSE: 27d0b2045a1acc600cd69c256e7667dacf7dc051
132-
TIoTLinkKit_IJKPlayer: 55cc0faec1a9395118fe0309652e83b8136d0599
131+
TIoTLinkKit_GVoiceSE: cd43b03fd7b6f923987352452a82680d7c14ba68
132+
TIoTLinkKit_IJKPlayer: f69a63ee19daaab5838e193dee2d785ad5c0b0e5
133133
TIoTLinkKit_SoundTouch: cf79ae182b6c2349ff65bac7a338974bc538fa77
134134
TIoTLinkKit_TPNS: 7cea4fc1d20ef6c4c11c4f0b66bbb10ecf4ed968
135135
TIoTLinkKit_WechatOpenSDK: 7822d68cc5c46edf3f6020422202e7b65ea87614
@@ -141,6 +141,6 @@ SPEC CHECKSUMS:
141141
TZImagePickerController: bf4c57b98d8707fce41ea6be872414a71c7a8c9d
142142
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
143143

144-
PODFILE CHECKSUM: 795d3763c3242d732936fb2a6c17075ff99dd006
144+
PODFILE CHECKSUM: 92a7d686950802e211919ac3c37c266e3ac9323e
145145

146146
COCOAPODS: 1.14.3

Source/LinkSDKDemo/Video/Login/Controller/TIoTDemoVideoVC.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#import "TIoTCoreXP2PBridge.h"
99
#import "UILabel+TIoTExtension.h"
1010
#import "TIoTAreaNetworkConfigVC.h"
11+
#import "TIoTDeviceInfoVC.h"
1112
@interface TIoTDemoVideoVC ()
1213

1314
@end
@@ -86,9 +87,10 @@ - (void)initVideoUI {
8687
}];
8788

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

117+
- (void)jumpOnlyDevice {
118+
TIoTDeviceInfoVC *areaNetVC = [[TIoTDeviceInfoVC alloc]init];
119+
[self.navigationController pushViewController:areaNetVC animated:YES];
120+
}
121+
115122
- (void)jumpLocalAreaNetwork {
116123
TIoTAreaNetworkConfigVC *areaNetVC = [[TIoTAreaNetworkConfigVC alloc]init];
117124
[self.navigationController pushViewController:areaNetVC animated:YES];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// TIoTAreaNetworkConfigVC.h
3+
// LinkSDKDemo
4+
//
5+
6+
#import <UIKit/UIKit.h>
7+
8+
NS_ASSUME_NONNULL_BEGIN
9+
10+
/// 局域网探测设备 输入信息控制器
11+
@interface TIoTDeviceInfoVC : UIViewController
12+
13+
@end
14+
15+
NS_ASSUME_NONNULL_END
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
//
2+
// TIoTAreaNetworkConfigVC.m
3+
// LinkSDKDemo
4+
5+
#import "TIoTDeviceInfoVC.h"
6+
#import "TIoTDemoPreviewDeviceVC.h"
7+
#import "TIoTAreaNetworkDeviceCell.h"
8+
#import "TIoTLocalNetDetch.h"
9+
#import "TIoTCoreAppEnvironment.h"
10+
#import "TIoTCoreUserManage.h"
11+
#import "NSString+Extension.h"
12+
#import "UIImage+TIoTDemoExtension.h"
13+
14+
@interface TIoTDeviceInfoVC ()<UITextFieldDelegate>
15+
@property (nonatomic, strong) UITextField *productID;
16+
@property (nonatomic, strong) UITextField *devicenname;
17+
@property (nonatomic, strong) UITextField *xp2pinfo;
18+
@end
19+
20+
@implementation TIoTDeviceInfoVC
21+
22+
- (void)viewDidLoad {
23+
[super viewDidLoad];
24+
// Do any additional setup after loading the view.
25+
[self setupUI];
26+
27+
[self setupNavBarStyleWithNormal:NO];
28+
if (@available(iOS 13.0, *)) {
29+
UINavigationBarAppearance *barApp = [[UINavigationBarAppearance alloc] init];
30+
[barApp configureWithOpaqueBackground];
31+
barApp.backgroundColor = [UIColor whiteColor];
32+
barApp.shadowColor = [UIColor clearColor];
33+
barApp.shadowImage = [UIImage new];
34+
self.navigationController.navigationBar.standardAppearance = barApp;
35+
self.navigationController.navigationBar.scrollEdgeAppearance = barApp;
36+
}
37+
}
38+
- (void)viewWillAppear:(BOOL)animated {
39+
[super viewWillAppear:animated];
40+
[self setupNavBarStyleWithNormal:NO];
41+
}
42+
43+
- (void)viewWillDisappear:(BOOL)animated {
44+
[super viewWillDisappear:animated];
45+
[self setupNavBarStyleWithNormal:YES];
46+
}
47+
48+
- (void)setupNavBarStyleWithNormal:(BOOL)isNormal {
49+
50+
if (isNormal) {
51+
[self.navigationController.navigationBar setBackgroundImage:[UIImage getGradientImageWithColors:@[[UIColor colorWithHexString:@"#ffffff"],[UIColor colorWithHexString:@"#ffffff"]] imgSize:CGSizeMake(kScreenWidth, 44)] forBarMetrics:UIBarMetricsDefault];
52+
}else {
53+
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FFFFFF"],NSFontAttributeName:[UIFont wcPfRegularFontOfSize:17]}];
54+
[self.navigationController.navigationBar setBackgroundImage:[UIImage getGradientImageWithColors:@[[UIColor colorWithHexString:@"#3D8BFF"],[UIColor colorWithHexString:@"#1242FF"]] imgSize:CGSizeMake(kScreenWidth, 44)] forBarMetrics:UIBarMetricsDefault];
55+
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
56+
}
57+
58+
}
59+
- (void)dealloc {
60+
}
61+
62+
- (void)setupUI {
63+
self.view.backgroundColor = [UIColor whiteColor];
64+
self.title = @"IoT Video (局域网)";
65+
66+
CGFloat kWidthPadding = 16;
67+
CGFloat kItemHeight = 56;
68+
CGFloat kAPIBtnWidthHeight = 24;
69+
CGFloat kInputItemLeftPadding = 150;
70+
71+
//第一行
72+
UILabel *productIDLabel = [[UILabel alloc]init];
73+
[productIDLabel setLabelFormateTitle:@"Product ID" font:[UIFont wcPfRegularFontOfSize:17] titleColorHexString:@"#000000" textAlignment:NSTextAlignmentLeft];
74+
[self.view addSubview:productIDLabel];
75+
[productIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
76+
if (@available(iOS 11.0, *)) {
77+
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(20);
78+
} else {
79+
// Fallback on earlier versions
80+
make.top.equalTo(self.view.mas_top).offset(64).offset(20);
81+
}
82+
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
83+
make.height.mas_equalTo(kItemHeight);
84+
}];
85+
86+
self.productID = [[UITextField alloc]init];
87+
self.productID.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
88+
self.productID.returnKeyType = UIReturnKeyDone;
89+
self.productID.placeholder = @"请输入Product ID";
90+
self.productID.delegate = self;
91+
self.productID.textAlignment = NSTextAlignmentLeft;
92+
self.productID.returnKeyType = UIReturnKeyDone;
93+
[self.view addSubview:self.productID];
94+
[self.productID mas_makeConstraints:^(MASConstraintMaker *make) {
95+
make.left.equalTo(self.view.mas_left).offset(kInputItemLeftPadding);
96+
make.centerY.equalTo(productIDLabel);
97+
make.height.equalTo(productIDLabel);
98+
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding - kAPIBtnWidthHeight);
99+
}];
100+
101+
UIView *line2 = [[UIView alloc]init];
102+
line2.backgroundColor = [UIColor colorWithHexString:kVideoDemoPlaceColor];
103+
[self.view addSubview:line2];
104+
[line2 mas_makeConstraints:^(MASConstraintMaker *make) {
105+
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
106+
make.right.equalTo(self.view);
107+
make.top.equalTo(productIDLabel.mas_bottom);
108+
make.height.mas_equalTo(1);
109+
}];
110+
111+
//第二行
112+
UILabel *clientTokenLabel = [[UILabel alloc]init];
113+
[clientTokenLabel setLabelFormateTitle:@"Device Name" font:[UIFont wcPfRegularFontOfSize:17] titleColorHexString:@"#000000" textAlignment:NSTextAlignmentLeft];
114+
[self.view addSubview:clientTokenLabel];
115+
[clientTokenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
116+
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
117+
make.top.equalTo(line2.mas_bottom);
118+
make.height.mas_equalTo(kItemHeight);
119+
}];
120+
121+
self.devicenname = [[UITextField alloc]init];
122+
self.devicenname.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
123+
self.devicenname.placeholder = @"请输入Device Name";
124+
self.devicenname.delegate = self;
125+
// self.clientToken.secureTextEntry = YES;
126+
self.devicenname.textAlignment = NSTextAlignmentLeft;
127+
self.devicenname.returnKeyType = UIReturnKeyDone;
128+
[self.view addSubview:self.devicenname];
129+
[self.devicenname mas_makeConstraints:^(MASConstraintMaker *make) {
130+
make.left.equalTo(self.view.mas_left).offset(kInputItemLeftPadding);
131+
make.centerY.equalTo(clientTokenLabel);
132+
make.height.equalTo(clientTokenLabel);
133+
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding);
134+
}];
135+
136+
UIView *line3 = [[UIView alloc]init];
137+
line3.backgroundColor = [UIColor colorWithHexString:kVideoDemoPlaceColor];
138+
[self.view addSubview:line3];
139+
[line3 mas_makeConstraints:^(MASConstraintMaker *make) {
140+
make.top.equalTo(clientTokenLabel.mas_bottom);
141+
make.height.mas_equalTo(1);
142+
make.left.right.equalTo(line2);
143+
}];
144+
145+
//第三行
146+
UILabel *p2pinfoLabel = [[UILabel alloc]init];
147+
[p2pinfoLabel setLabelFormateTitle:@"XP2P Info" font:[UIFont wcPfRegularFontOfSize:17] titleColorHexString:@"#000000" textAlignment:NSTextAlignmentLeft];
148+
[self.view addSubview:p2pinfoLabel];
149+
[p2pinfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
150+
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
151+
make.top.equalTo(line3.mas_bottom);
152+
make.height.mas_equalTo(kItemHeight);
153+
}];
154+
155+
self.xp2pinfo = [[UITextField alloc]init];
156+
self.xp2pinfo.textColor = [UIColor colorWithHexString:@"#7F7F7F"];
157+
self.xp2pinfo.placeholder = @"请输入XP2P Info";
158+
self.xp2pinfo.delegate = self;
159+
// self.clientToken.secureTextEntry = YES;
160+
self.xp2pinfo.textAlignment = NSTextAlignmentLeft;
161+
self.xp2pinfo.returnKeyType = UIReturnKeyDone;
162+
[self.view addSubview:self.xp2pinfo];
163+
[self.xp2pinfo mas_makeConstraints:^(MASConstraintMaker *make) {
164+
make.left.equalTo(self.view.mas_left).offset(kInputItemLeftPadding);
165+
make.centerY.equalTo(p2pinfoLabel);
166+
make.height.equalTo(p2pinfoLabel);
167+
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding);
168+
}];
169+
170+
UIView *line4 = [[UIView alloc]init];
171+
line4.backgroundColor = [UIColor colorWithHexString:kVideoDemoPlaceColor];
172+
[self.view addSubview:line4];
173+
[line4 mas_makeConstraints:^(MASConstraintMaker *make) {
174+
make.top.equalTo(p2pinfoLabel.mas_bottom);
175+
make.height.mas_equalTo(1);
176+
make.left.right.equalTo(line2);
177+
}];
178+
179+
UIButton *detectDeviceBtn = [UIButton buttonWithType:UIButtonTypeSystem];
180+
detectDeviceBtn.backgroundColor = [UIColor colorWithHexString:kVideoDemoMainThemeColor];
181+
[detectDeviceBtn setButtonFormateWithTitlt:@"连接设备" titleColorHexString:@"#FFFFFF" font:[UIFont wcPfRegularFontOfSize:17]];
182+
[detectDeviceBtn addTarget:self action:@selector(detectEquipment) forControlEvents:UIControlEventTouchUpInside];
183+
[self.view addSubview:detectDeviceBtn];
184+
[detectDeviceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
185+
make.left.equalTo(self.view.mas_left).offset(kWidthPadding);
186+
make.right.equalTo(self.view.mas_right).offset(-kWidthPadding);
187+
make.top.equalTo(line4.mas_bottom).offset(30);
188+
make.height.mas_equalTo(45);
189+
}];
190+
191+
[self judgeAutoFillInputInfo];
192+
}
193+
194+
- (void)judgeAutoFillInputInfo {
195+
196+
self.productID.text = [TIoTCoreUserManage shared].demoAreaNetProductID;
197+
self.devicenname.text = [TIoTCoreUserManage shared].demoAreaNetClientToken;
198+
self.xp2pinfo.text = [TIoTCoreUserManage shared].demoAreaNetClientToken;
199+
200+
}
201+
202+
- (void)saveInputInfo {
203+
204+
[TIoTCoreUserManage shared].demoAreaNetProductID = self.productID.text;
205+
[TIoTCoreUserManage shared].demoAreaNetClientToken = self.devicenname.text;
206+
}
207+
208+
///MARK: 探测设备
209+
- (void)detectEquipment {
210+
[self hideKeyBoard];
211+
[self saveInputInfo];
212+
213+
TIoTDemoPreviewDeviceVC *previewDeviceVC = [[TIoTDemoPreviewDeviceVC alloc]init];
214+
215+
TIoTExploreOrVideoDeviceModel *model = [TIoTExploreOrVideoDeviceModel new]; model.DeviceName = self.devicenname.text;
216+
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
217+
env.cloudProductId = self.productID.text;
218+
previewDeviceVC.selectedModel = model;
219+
previewDeviceVC.mXp2pInfo = self.xp2pinfo.text;
220+
previewDeviceVC.isNVR = NO;
221+
[self.navigationController pushViewController:previewDeviceVC animated:YES];
222+
}
223+
224+
225+
226+
#pragma mark - UITextField delegate
227+
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
228+
[self hideKeyBoard];
229+
return YES;
230+
}
231+
232+
- (void)hideKeyBoard {
233+
[self.productID resignFirstResponder];
234+
[self.devicenname resignFirstResponder];
235+
[self.xp2pinfo resignFirstResponder];
236+
}
237+
238+
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
239+
[self hideKeyBoard];
240+
return YES;
241+
}
242+
243+
@end

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
1313
*/
1414
@interface TIoTDemoPreviewDeviceVC : TIoTDemoBaseViewController
1515
@property (nonatomic, strong) TIoTExploreOrVideoDeviceModel *selectedModel; //选择设备的model
16+
@property (nonatomic, copy) NSString *mXp2pInfo;
1617
@property (nonatomic, assign) BOOL isNVR; //区分是NVR、IPC
1718
@property (nonatomic, strong) NSString *deviceNameNVR;
1819
@end

0 commit comments

Comments
 (0)