Skip to content

Commit 157f36d

Browse files
author
eagleychen
committed
更新接口 pro_id/dev_name 拼接
1 parent 8259ab4 commit 157f36d

File tree

3 files changed

+78
-76
lines changed

3 files changed

+78
-76
lines changed

Source/LinkSDKDemo/Video/LocalAreaNetwork/Controller/TIoTAreaNetworkPreviewVC.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ - (void)viewDidLoad {
9090

9191
self.deviceName = self.model.params.deviceName;
9292

93-
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startLanAppWith:self.productID?:@"" dev_name:self.deviceName?:@"" remote_host:self.model.params.address?:@"" remote_port:self.model.params.port?:@""];
93+
int errorcode = 0;//[[TIoTCoreXP2PBridge sharedInstance] startLanAppWith:self.productID?:@"" dev_name:self.deviceName?:@"" remote_host:self.model.params.address?:@"" remote_port:self.model.params.port?:@""];
9494

9595
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
9696
// [self setVieoPlayerStartPlayWith:self.qualityString];
@@ -156,7 +156,7 @@ - (void)addRotateNotification {
156156
/// 对讲post请求
157157
- (void)voicePostRequest {
158158

159-
[[TIoTCoreXP2PBridge sharedInstance] sendVoiceToServer:self.deviceName?:@"" channel:@"channel=0" audioConfig:TIoTAVCaptionFLVAudio_8];
159+
[[TIoTCoreXP2PBridge sharedInstance] sendVoiceToServer:self.deviceName?:@"" channel:@"channel=0"];
160160
}
161161

162162
- (void)setupPreViewViews {
@@ -902,11 +902,11 @@ - (void)responseP2PdisConnect:(NSNotification *)notify {
902902
- (void)setVieoPlayerStartPlayWith:(NSString *)qualityString {
903903
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
904904

905-
int proxyPort = [[TIoTCoreXP2PBridge sharedInstance] getLanProxyPort:self.deviceName];
905+
int proxyPort = 0;//[[TIoTCoreXP2PBridge sharedInstance] getLanProxyPort:self.deviceName];
906906
NSString *qualityID = [NSString stringWithFormat:@"%@&channel=0&_protocol=tcp&_port=%d&_crypto=off",qualityString,proxyPort];
907907

908908
// 获取URL 起播放器
909-
NSString *urlString = [[TIoTCoreXP2PBridge sharedInstance] getLanUrlForHttpFlv:self.deviceName?:@""];
909+
NSString *urlString = nil;//[[TIoTCoreXP2PBridge sharedInstance] getLanUrlForHttpFlv:self.deviceName?:@""];
910910

911911
self.videoUrl = [NSString stringWithFormat:@"%@%@",urlString,qualityID?:@""];
912912

@@ -1124,11 +1124,11 @@ - (void)resetVideoPlayerWithQuality:(NSString *)qualityString {
11241124

11251125
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
11261126

1127-
int proxyPort = [[TIoTCoreXP2PBridge sharedInstance] getLanProxyPort:self.deviceName];
1127+
int proxyPort = 0;//[[TIoTCoreXP2PBridge sharedInstance] getLanProxyPort:self.deviceName];
11281128
NSString *qualityID = [NSString stringWithFormat:@"%@&channel=0&_protocol=tcp&_port=%d&_crypto=off",qualityString,proxyPort];
11291129

11301130
// 获取URL 起播放器
1131-
NSString *urlString = [[TIoTCoreXP2PBridge sharedInstance] getLanUrlForHttpFlv:self.deviceName?:@""];
1131+
NSString *urlString = nil;//[[TIoTCoreXP2PBridge sharedInstance] getLanUrlForHttpFlv:self.deviceName?:@""];
11321132

11331133

11341134
self.videoUrl = [NSString stringWithFormat:@"%@%@",urlString,qualityID?:@""];

Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,25 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd;
3838
* 通过 startAvRecvService 和 stopAvRecvService 接口,可以启动和停止裸流传输
3939
* 客户端拉取到的裸流数据对应 data 参数
4040
*/
41-
- (void)getVideoPacketWithID:(NSString *)dev_name data:(uint8_t *)data len:(size_t)len;
41+
- (void)getVideoPacketWithID:(NSString *)combinedId data:(uint8_t *)data len:(size_t)len;
4242

4343

4444
/*
4545
* ⚠️⚠️⚠️ 谨慎!!! === 此接口切勿执行耗时操作,耗时操作请切换线程,切勿卡住当前线程,返回值需立即返回
4646
*
4747
* 接口功能 === 设备主动发消息给app:
48-
* dev_name 和所有接口的dev_name参数是保持一致,表示给那个哪个设备发的流
48+
* combinedId 和所有接口的combinedId 参数是保持一致,表示给那个哪个设备发的流
4949
* data是设备主动发过来的内容
5050
* 需注意使用场景:只能在直播,回看或对讲期间设备才可以主动发
5151
* char *返回值表示回复给设备的返回信息
5252
*/
53-
- (NSString *)reviceDeviceMsgWithID:(NSString *)dev_name data:(NSData *)data;
53+
- (NSString *)reviceDeviceMsgWithID:(NSString *)combinedId data:(NSData *)data;
5454

5555
/*
5656
* sdk 事件消息,事件对应类型与意义详见 XP2PType 类型说明
5757
* msg 事件详情
5858
*/
59-
- (void)reviceEventMsgWithID:(NSString *)dev_name eventType:(XP2PType)eventType msg:(const char*) msg;
59+
- (void)reviceEventMsgWithID:(NSString *)combinedId eventType:(XP2PType)eventType msg:(const char*) msg;
6060
@end
6161

6262

@@ -88,37 +88,36 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd;
8888

8989

9090
/*
91+
* ⚠️⚠️⚠️ 注意!!! 所有涉及combinedId ,都使用 productid/devicename 拼接表达。 例如 "pro_id/dev_name"
9192
* 使用播放器播放时,需先等待 SDK 初始化完成,ready事件(xp2preconnect 通知)之后,即可获取到 http-url
9293
*/
93-
- (NSString *)getUrlForHttpFlv:(NSString *)dev_name;
94+
- (NSString *)getUrlForHttpFlv:(NSString *)combinedId;
9495

9596
/*
97+
* ⚠️⚠️⚠️ 注意!!! 所有涉及combinedId ,都使用 productid/devicename 拼接表达。 例如 "pro_id/dev_name"
9698
* 与设备信令交互接口
9799
* 1.设备端回复 app 的消息没有限制
98100
* 2.app 发送给设备的信令,要求不带&符号,信令长度不超过3000个字节
99101
*
100102
* 事例 cmd 参数(action=inner_define&cmd=get_nvr_list)
101103
*/
102-
- (void)getCommandRequestWithAsync:(NSString *)dev_name cmd:(NSString *)cmd timeout:(uint64_t)timeout completion:(void (^ __nullable)(NSString * jsonList))completion;
104+
- (void)getCommandRequestWithAsync:(NSString *)combinedId cmd:(NSString *)cmd timeout:(uint64_t)timeout completion:(void (^ __nullable)(NSString * jsonList))completion;
103105

104106
/*
107+
* ⚠️⚠️⚠️ 注意!!! 所有涉及combinedId ,都使用 productid/devicename 拼接表达。 例如 "pro_id/dev_name"
105108
* 开始停止裸流传输接口,通过代理 getVideoPacket 返回裸流数据
106109
*/
107-
- (void)startAvRecvService:(NSString *)dev_name cmd:(NSString *)cmd;
108-
- (XP2PErrCode)stopAvRecvService:(NSString *)dev_name;
110+
- (void)startAvRecvService:(NSString *)combinedId cmd:(NSString *)cmd;
111+
- (XP2PErrCode)stopAvRecvService:(NSString *)combinedId;
109112

110113
/*
114+
* ⚠️⚠️⚠️ 注意!!! 所有涉及combinedId ,都使用 productid/devicename 拼接表达。 例如 "pro_id/dev_name"
111115
* 语音对讲开始结束接口
112116
*/
113117
//对讲音频默认采样率
114-
- (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_number;
118+
- (void)sendVoiceToServer:(NSString *)combinedId channel:(NSString *)channel_number;
115119
//可通过此接口 audio_onfig 参数既可设置对讲音频码率(bitrate)、采样率(sampleRate)、channelCount、sampleSize
116-
- (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_number audioConfig:(TIoTAVCaptionFLVAudioType)audio_rate;
117-
//音视频采样
118-
- (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_number audioConfig:(TIoTAVCaptionFLVAudioType)audio_rate withLocalPreviewView:(UIView *)localView; __attribute__((deprecated("Use -sendVoiceToServer: channel: audioConfig: videoConfig:")));
119-
- (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_number audioConfig:(TIoTAVCaptionFLVAudioType)audio_rate withLocalPreviewView:(UIView *)localView videoPosition:(AVCaptureDevicePosition)videoPosition; __attribute__((deprecated("Use -sendVoiceToServer: channel: audioConfig: videoConfig:")));
120-
- (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_number audioConfig:(TIoTAVCaptionFLVAudioType)audio_rate withLocalPreviewView:(UIView *)localView videoPosition:(AVCaptureDevicePosition)videoPosition isEchoCancel:(BOOL)isEchoCancel; __attribute__((deprecated("Use -sendVoiceToServer: channel: audioConfig: videoConfig:")));
121-
- (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_number audioConfig:(TIoTCoreAudioConfig *)audio_config videoConfig:(TIoTCoreVideoConfig *)video_config;
120+
- (void)sendVoiceToServer:(NSString *)combinedId channel:(NSString *)channel_number audioConfig:(TIoTCoreAudioConfig *)audio_config videoConfig:(TIoTCoreVideoConfig *)video_config;
122121
//刷新本地预览视图
123122
- (void)refreshLocalView:(UIView *)localView;
124123

@@ -130,29 +129,21 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd;
130129
- (void)resolutionRatio:(AVCaptureSessionPreset )resolutionValue;
131130

132131

133-
/*
134-
* 局域网相关接口
135-
*/
136-
- (XP2PErrCode)startLanAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name remote_host:(NSString *)remote_host remote_port:(NSString *)remote_port;
137-
- (NSString *)getLanUrlForHttpFlv:(NSString *)dev_name;
138-
- (int)getLanProxyPort:(NSString *)dev_name;
139-
140-
141132
/*
142133
* 退出 SDK 服务
143134
*/
144-
- (void)stopService:(NSString *)dev_name;
135+
- (void)stopService:(NSString *)combinedId;
145136

146137
/*
147138
* 调试接口,录制通过播放器拉取的数据流并行保存到 Document 目录的 video.data 文件
148139
* 需提前打开 writeFile 开关
149140
*/
150-
+ (void)recordstream:(NSString *)dev_name;
141+
+ (void)recordstream:(NSString *)combinedId;
151142

152143
/*
153144
* 获取当前发送链路的连接模式:0 无效;62 直连;63 转发
154145
*/
155-
+ (int)getStreamLinkMode:(NSString *)dev_name;
146+
+ (int)getStreamLinkMode:(NSString *)combinedId;
156147

157148
/*
158149
* 获取当前发送音视频水位大小,正常水位保持在低位大约(0~1000)

0 commit comments

Comments
 (0)