zby-live-sdk 1.0.49-beta-talrtc1014 → 1.0.49-beta-1222-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +5 -5
- package/.editorconfig +13 -13
- package/.eslintrc.js +29 -29
- package/CHANGELOG.md +419 -377
- package/README.md +276 -276
- package/dist/zby-live-sdk.cjs.js +3 -4
- package/dist/zby-live-sdk.esm.js +3 -4
- package/dist/zby-live-sdk.umd.js +3 -4
- package/package.json +1 -1
- package/src/channel/getSendMsgParams.js +66 -66
- package/src/channel/index.js +138 -138
- package/src/channel/pomelo/index.js +184 -184
- package/src/channel/pomelo/latestQueue.js +151 -151
- package/src/channel/pomelo/polemo.js +749 -749
- package/src/channel/pomelo/util.js +54 -54
- package/src/channel/sdk-cb.js +73 -73
- package/src/channel/stream-msg.js +97 -97
- package/src/channel/zby/index.js +74 -74
- package/src/channel/zby/interactWithChannel.js +4 -4
- package/src/channel/zby/interactWithChannelControl.js +1568 -1568
- package/src/channel/zby/interactWithChannelEntry.js +318 -318
- package/src/config/config.js +153 -153
- package/src/default/base.js +70 -70
- package/src/default/extend.js +36 -36
- package/src/default/index.js +9 -9
- package/src/live/base.js +42 -42
- package/src/live/call-method.js +9 -9
- package/src/live/extend.js +53 -53
- package/src/live/index.js +9 -9
- package/src/network/api.js +50 -50
- package/src/network/commonFetch.js +66 -66
- package/src/network/dataReport.js +429 -429
- package/src/notice.js +400 -394
- package/src/tool/base.js +74 -74
- package/src/tool/call-method.js +9 -9
- package/src/tool/extend.js +42 -42
- package/src/tool/index.js +9 -9
- package/src/util/bridge.js +87 -87
- package/src/util/bridge1.js +46 -46
- package/src/util/dict.js +51 -51
- package/src/util/sessionStorage.js +29 -29
- package/src/util/sha256.js +482 -482
- package/src/util/util.js +308 -308
- package/src/zby-av-sdk/agora-sdk.js +711 -711
- package/src/zby-av-sdk/device.js +145 -145
- package/src/zby-av-sdk/rtc-sdk.js +2845 -2839
- package/src/zby-av-sdk/talrtc-sdk.js +2394 -2392
- package/src/zby-av-sdk/trtc-sdk.js +1801 -1801
- package/src/zby-av-sdk/zby-av-sdk.js +1901 -1891
- package/src/zby-av-sdk/zego-sdk.js +3002 -2987
- package/src/zby-live-sdk.js +1564 -1561
package/src/zby-live-sdk.js
CHANGED
|
@@ -1,1561 +1,1564 @@
|
|
|
1
|
-
import zbyAVSDK from './zby-av-sdk/zby-av-sdk';
|
|
2
|
-
import {
|
|
3
|
-
version,
|
|
4
|
-
config,
|
|
5
|
-
// getAndSetInitParams,
|
|
6
|
-
// getLogAddress,
|
|
7
|
-
getApiCloudBaseUrl
|
|
8
|
-
} from './config/config';
|
|
9
|
-
import util from './util/util';
|
|
10
|
-
import dict from './util/dict';
|
|
11
|
-
|
|
12
|
-
import CHANNEL from './channel';
|
|
13
|
-
|
|
14
|
-
import dataReport from './network/dataReport';
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
getCloudData,
|
|
18
|
-
changeSdkInRoom
|
|
19
|
-
} from './network/api';
|
|
20
|
-
|
|
21
|
-
import toolBaseApi from './tool/base';
|
|
22
|
-
import liveBaseApi from './live/base';
|
|
23
|
-
import defaultApi from './default';
|
|
24
|
-
import {getDevicePermissionsFun, setMediaPermissionFun, isAppleM1} from './zby-av-sdk/device';
|
|
25
|
-
import NOTICE from './notice';
|
|
26
|
-
|
|
27
|
-
// window.zegoHasPushFlow = 0
|
|
28
|
-
|
|
29
|
-
export let userAndDeviceStatusInfo = {
|
|
30
|
-
microPhone: false,
|
|
31
|
-
camera: false,
|
|
32
|
-
isPushingFlow: false,
|
|
33
|
-
//不看他
|
|
34
|
-
// ignoreList : new Set()
|
|
35
|
-
};
|
|
36
|
-
let sdkConfig = config;
|
|
37
|
-
let sdk_status = -1;
|
|
38
|
-
let sdkRetryCount = 0;
|
|
39
|
-
let deviceCheckerInitStatus = -1;
|
|
40
|
-
|
|
41
|
-
const windowObjArr = [['zby_sdk_req_get_cloud_params', 'zbyAVSDK_init_params', 'zbyAVSDK_device_checker_init', 'zby_sdk_cloud_data'], ['zbyAVSDK_init_sdk_type', 'current_sdk_type']];
|
|
42
|
-
|
|
43
|
-
let confId;
|
|
44
|
-
|
|
45
|
-
// 重试初始化
|
|
46
|
-
function retryInit(error, name = 'init', args, dealSDKMsg) {
|
|
47
|
-
//通知业务层,初始化失败,重试
|
|
48
|
-
sdkRetryCount++;
|
|
49
|
-
sdk_status = -1;
|
|
50
|
-
if (sdkRetryCount > 3) {
|
|
51
|
-
sdkRetryCount = 0;
|
|
52
|
-
NOTICE.sdkStatus({
|
|
53
|
-
status: 'retry_stop'
|
|
54
|
-
});
|
|
55
|
-
try {
|
|
56
|
-
// console.log('获取云控失败上报加入教室code1',window.zby_sdk_init_params);
|
|
57
|
-
dataReport.joinRoomResult({
|
|
58
|
-
code: '1',
|
|
59
|
-
// cloud_api_response: JSON.stringify(window.zby_sdk_cloud_data),
|
|
60
|
-
// cloud_api_response: window.zby_sdk_cloud_data,
|
|
61
|
-
cloud_api_url: `${getApiCloudBaseUrl()}/rtccloud/class/init`
|
|
62
|
-
});
|
|
63
|
-
} catch(e) {
|
|
64
|
-
defaultApi.writeLog('获取云控接口失败');
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
NOTICE.sdkStatus({
|
|
68
|
-
status: `retry_${name}`,
|
|
69
|
-
count: sdkRetryCount
|
|
70
|
-
});
|
|
71
|
-
defaultApi.writeLog(`sdk action: retry_${name}, count: it's the 【${sdkRetryCount}】 retry, ${error} error`);
|
|
72
|
-
if (name === 'init') {
|
|
73
|
-
return zbysdk.init(args, dealSDKMsg);
|
|
74
|
-
}
|
|
75
|
-
return zbysdk.changeSDK(1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* 设备状态通知
|
|
82
|
-
* @param {String} deviceType 'audio', 'video'
|
|
83
|
-
* @param {Bollean} operation
|
|
84
|
-
*/
|
|
85
|
-
function sendDeviceStatus(deviceType, operation) {
|
|
86
|
-
if (window.zbyAVSDK_init_params) {
|
|
87
|
-
const initParams = window.zby_sdk_init_params;
|
|
88
|
-
NOTICE.deviceStatus({
|
|
89
|
-
userId: initParams.userId,
|
|
90
|
-
userName: initParams.userName,
|
|
91
|
-
role: initParams.role,
|
|
92
|
-
//获取设备类型和状态对应的文案,返回给业务层
|
|
93
|
-
deviceType: deviceType,
|
|
94
|
-
deviceStatus: operation ? 'open' : 'closed'
|
|
95
|
-
});
|
|
96
|
-
//更新设备状态,摄像头,麦克风 开启/关闭
|
|
97
|
-
CHANNEL.sendUpdateStreamDeviceStatus(Object.assign({}, initParams, {
|
|
98
|
-
deviceType: dict.getDeviceTypeKey(deviceType),
|
|
99
|
-
deviceStatus: dict.getDeviceStatusKey(operation ? 'open' : 'closed')
|
|
100
|
-
}));
|
|
101
|
-
} else {
|
|
102
|
-
console.log('尚未初始化,无须设备状态同步');
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
* @param {String} userId
|
|
108
|
-
* @param {String} status 流状态
|
|
109
|
-
*/
|
|
110
|
-
function noticeStreamStatus(userId, status) {
|
|
111
|
-
NOTICE.streamStatus({
|
|
112
|
-
userId,
|
|
113
|
-
status
|
|
114
|
-
});
|
|
115
|
-
defaultApi.writeLog(`sdk stream status userId: ${JSON.stringify(userId)} ${status}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function generateStreamId(userId, groupId) {
|
|
119
|
-
if (!window.zby_sdk_init_params) {
|
|
120
|
-
console.log('缺少初始化参数,无法生成streamId');
|
|
121
|
-
}
|
|
122
|
-
const initParams = window.zby_sdk_init_params;
|
|
123
|
-
if (!initParams) {
|
|
124
|
-
return '';
|
|
125
|
-
}
|
|
126
|
-
// TODO 测试用
|
|
127
|
-
// if (initParams.sdkName === 'talrtc') {
|
|
128
|
-
// initParams.institutionId = 'd46144';
|
|
129
|
-
// }
|
|
130
|
-
return util.getStreamId({
|
|
131
|
-
...initParams,
|
|
132
|
-
userId,
|
|
133
|
-
groupId
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function caculateDeatailArgs(baseArgs, cloudData) {
|
|
138
|
-
try {
|
|
139
|
-
const commonArgs = {
|
|
140
|
-
userId: baseArgs.userId,
|
|
141
|
-
streamId: util.getStreamId(baseArgs),
|
|
142
|
-
userName: baseArgs.userName || '',
|
|
143
|
-
sid: baseArgs.sid,
|
|
144
|
-
role: baseArgs.role,
|
|
145
|
-
roomId: baseArgs.roomId + '',
|
|
146
|
-
confId: confId,
|
|
147
|
-
userAvatar: baseArgs.userAvatar || '',
|
|
148
|
-
userToken: baseArgs.userToken || '',
|
|
149
|
-
devices: baseArgs.devices,
|
|
150
|
-
env: baseArgs.env,
|
|
151
|
-
//站立模式:0 / 坐立模式:1
|
|
152
|
-
mode: baseArgs.mode,
|
|
153
|
-
live_id: baseArgs.liveId,
|
|
154
|
-
// 课堂模式,0=小组课/1=新小班
|
|
155
|
-
classMode: +baseArgs.classMode,
|
|
156
|
-
//数据上报班课类型
|
|
157
|
-
liveType: +baseArgs.liveType,
|
|
158
|
-
//是否开启转推功能
|
|
159
|
-
isTurnPush: baseArgs.isTurnPush || false,
|
|
160
|
-
// isSetAEC: baseArgs.isSetAEC || false,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
//从云控返回值中获取直播相关配置
|
|
164
|
-
const liveConfig = {
|
|
165
|
-
//大画面视频采集码率(取值范围:40kb~2000kb)
|
|
166
|
-
// captureBitrate: +cloudData.captureBitrate,
|
|
167
|
-
//大画面视频采集帧率(取值范围:5~30)
|
|
168
|
-
// captureFps: +cloudData.captureFps,
|
|
169
|
-
//大画面视频编码分辨率
|
|
170
|
-
encodedResolutionWidth: +cloudData.encodedResolution.split('*')[0],
|
|
171
|
-
encodedResolutionHeight: +cloudData.encodedResolution.split('*')[1],
|
|
172
|
-
// 预览画面视频采集码率(取值范围:40kb~300kb)
|
|
173
|
-
encodeCaptureBitrate: +cloudData.encodedBitrate,
|
|
174
|
-
encodeCaptureFps: +cloudData.encodedFps,
|
|
175
|
-
// 预览画面视频采集帧率(取值范围:5~15)
|
|
176
|
-
previewCaptureFps: +cloudData.previewFps,
|
|
177
|
-
// 预览视频编码分辨率
|
|
178
|
-
previewResolutionWidth: +cloudData.previewResolution.split('*')[0],
|
|
179
|
-
previewResolutionHeight: +cloudData.previewResolution.split('*')[1],
|
|
180
|
-
//rtc同屏分辨率
|
|
181
|
-
screenSameResolutionWidth: cloudData.screenSameResolution ? +cloudData.screenSameResolution.split('*')[0] : 1280,
|
|
182
|
-
screenSameResolutionHeight: cloudData.screenSameResolution ? +cloudData.screenSameResolution.split('*')[1] : 720,
|
|
183
|
-
//rtc同屏帧率 码率
|
|
184
|
-
screenSameFps: cloudData.screenSameFps ? +cloudData.screenSameFps : 15,
|
|
185
|
-
screenSameBitrate: cloudData.screenSameBitrate ? +cloudData.screenSameBitrate : 512000,
|
|
186
|
-
// 转推Rtmp地址
|
|
187
|
-
recordUrl: cloudData.recordUrl,
|
|
188
|
-
aecMode: cloudData.aecMode != null ? cloudData.aecMode : -1,
|
|
189
|
-
noiseSuppressMode: cloudData.noiseSuppressMode != null ? cloudData.noiseSuppressMode : -1
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const detailArgs = {
|
|
193
|
-
rtc: Object.assign({}, commonArgs, liveConfig, {
|
|
194
|
-
extensionVersion: baseArgs.extension.version.rtc,
|
|
195
|
-
appId: cloudData.appId
|
|
196
|
-
}),
|
|
197
|
-
talrtc: Object.assign({}, commonArgs, liveConfig, {
|
|
198
|
-
extensionVersion: baseArgs.extension.version.agora || '1.0.0.0',
|
|
199
|
-
appId: cloudData.appId,
|
|
200
|
-
usersign: 'testsign',
|
|
201
|
-
teacherId: baseArgs.teacherId
|
|
202
|
-
}),
|
|
203
|
-
trtc: Object.assign({}, commonArgs, liveConfig, {
|
|
204
|
-
extensionVersion: baseArgs.extension.version.trtc || '1.0.0.0',
|
|
205
|
-
appId: cloudData.appId,
|
|
206
|
-
usersign: cloudData.txRtcKey,
|
|
207
|
-
}),
|
|
208
|
-
zego: Object.assign({}, commonArgs, liveConfig, {
|
|
209
|
-
extensionVersion: baseArgs.extension.version.zego,
|
|
210
|
-
appId: parseInt(cloudData.appId)|| 2251703116,
|
|
211
|
-
appSignature: cloudData.appKey|| 'uYsmfJ4F8ERzRNC4ug6lWB/vfU6ffg+/ETRF14vjzs4=',
|
|
212
|
-
businessType: 0,
|
|
213
|
-
nNetType: 1
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
};
|
|
217
|
-
return detailArgs;
|
|
218
|
-
} catch (error) {
|
|
219
|
-
console.error(error);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* SDK 方法
|
|
225
|
-
*/
|
|
226
|
-
const zbysdk = {
|
|
227
|
-
version: version,
|
|
228
|
-
notice: null,
|
|
229
|
-
// 打开监听log
|
|
230
|
-
openListenerLog: false,
|
|
231
|
-
//端上初始化时传的false
|
|
232
|
-
autoChangeSdk: true,
|
|
233
|
-
log_id:null,
|
|
234
|
-
setConfig(options) {
|
|
235
|
-
Object.assign(sdkConfig, options);
|
|
236
|
-
Object.assign(this, options);
|
|
237
|
-
},
|
|
238
|
-
deviceStatus: {},
|
|
239
|
-
// 开始设备检测
|
|
240
|
-
// async deviceCheckerInit(cb, extension, env = 'test') {
|
|
241
|
-
// if (!extension) {
|
|
242
|
-
// defaultApi.writeLog('sdk deviceCheckerInit extension param is required');
|
|
243
|
-
// }
|
|
244
|
-
// if (deviceCheckerInitStatus > -1) {
|
|
245
|
-
// return 'please stop check device first';
|
|
246
|
-
// }
|
|
247
|
-
// deviceCheckerInitStatus = 0;
|
|
248
|
-
// defaultApi.writeLog(`sdk action: deviceCheckerInit ${JSON.stringify({
|
|
249
|
-
// cb,
|
|
250
|
-
// extension,
|
|
251
|
-
// env,
|
|
252
|
-
// sdk_version: version
|
|
253
|
-
// })}`);
|
|
254
|
-
// if (typeof cb === 'function') {
|
|
255
|
-
// zbysdk.notice = cb;
|
|
256
|
-
// }
|
|
257
|
-
// await zbyAVSDK.deviceCheckerInit(extension, env);
|
|
258
|
-
// deviceCheckerInitStatus = 1;
|
|
259
|
-
// defaultApi.writeLog('sdk devices checked');
|
|
260
|
-
// },
|
|
261
|
-
|
|
262
|
-
async deviceCheckerInit(cb, extension, env = 'test') {
|
|
263
|
-
if (!extension) {
|
|
264
|
-
defaultApi.writeLog('sdk deviceCheckerInit extension param is required');
|
|
265
|
-
}
|
|
266
|
-
if (deviceCheckerInitStatus > -1) {
|
|
267
|
-
return 'please stop check device first';
|
|
268
|
-
}
|
|
269
|
-
deviceCheckerInitStatus = 0;
|
|
270
|
-
defaultApi.writeLog(`sdk action: deviceCheckerInit ${JSON.stringify({
|
|
271
|
-
cb,
|
|
272
|
-
extension,
|
|
273
|
-
env,
|
|
274
|
-
sdk_version: version
|
|
275
|
-
})}`);
|
|
276
|
-
if (typeof cb === 'function') {
|
|
277
|
-
zbysdk.notice = cb;
|
|
278
|
-
}
|
|
279
|
-
await zbyAVSDK.deviceCheckerInit(extension, env);
|
|
280
|
-
deviceCheckerInitStatus = 1;
|
|
281
|
-
defaultApi.writeLog('sdk devices checked');
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
// 结束设备检测
|
|
285
|
-
stopCheckDevice() {
|
|
286
|
-
if (deviceCheckerInitStatus === -1) {
|
|
287
|
-
defaultApi.writeLog('please start check device first');
|
|
288
|
-
return 'please start check device first';
|
|
289
|
-
}
|
|
290
|
-
deviceCheckerInitStatus = -1;
|
|
291
|
-
defaultApi.writeLog('sdk stop check device');
|
|
292
|
-
return zbyAVSDK.stopCheckDevice();
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
async init(args, dealSDKMsg) {
|
|
296
|
-
if (sdk_status !== -1) {
|
|
297
|
-
console.log('not allow init');
|
|
298
|
-
dealSDKMsg({
|
|
299
|
-
type: 'error',
|
|
300
|
-
data: {
|
|
301
|
-
message: 'should not start init before init finished'
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
defaultApi.writeLog(`sdk action: init zby_live_sdk_version : ${version}`);
|
|
307
|
-
defaultApi.writeLog(`sdk action: init args : ${JSON.stringify(args)}`);
|
|
308
|
-
defaultApi.writeLog(`sdk action: init_cloudData_args : ${JSON.stringify(args.cloudData)}`);
|
|
309
|
-
try {
|
|
310
|
-
let argsCopy = JSON.parse(JSON.stringify(args));
|
|
311
|
-
delete argsCopy.cloudData;
|
|
312
|
-
defaultApi.writeLog(`sdk action: init_argsCopy_args : ${JSON.stringify(argsCopy)}`);
|
|
313
|
-
} catch (e) {};
|
|
314
|
-
this.log_id = 0;
|
|
315
|
-
sdk_status = 0;
|
|
316
|
-
// 初始化参数存入共享
|
|
317
|
-
window.zby_sdk_init_params = args;
|
|
318
|
-
// 设置confId
|
|
319
|
-
confId = util.getConfId(args.institutionId, args.roomId);
|
|
320
|
-
await liveBaseApi.init();
|
|
321
|
-
try {
|
|
322
|
-
toolBaseApi.init();
|
|
323
|
-
} catch(e) {
|
|
324
|
-
console.log('toolBaseApi_Init',e);
|
|
325
|
-
}
|
|
326
|
-
// try {
|
|
327
|
-
// await util.getNetworkTimeStamp();
|
|
328
|
-
// } catch(e) {
|
|
329
|
-
// console.log('getTimeError',e);
|
|
330
|
-
// };
|
|
331
|
-
//使用初始化传入的 env, isHttps 参数
|
|
332
|
-
Object.assign(sdkConfig, args);
|
|
333
|
-
|
|
334
|
-
zbysdk.notice = dealSDKMsg;
|
|
335
|
-
|
|
336
|
-
// try {
|
|
337
|
-
// await getLogAddress();
|
|
338
|
-
// await getAndSetInitParams({institutionId: args.institutionId, userId: args.userId});
|
|
339
|
-
// } catch (error) {
|
|
340
|
-
// return retryInit('getAndSetInitParams', 'init', args, dealSDKMsg);
|
|
341
|
-
// }
|
|
342
|
-
const reqParam = {
|
|
343
|
-
clientType: 'pc',
|
|
344
|
-
roomType: 7,
|
|
345
|
-
institutionId: args.institutionId + '',
|
|
346
|
-
roomId: args.roomId + '',
|
|
347
|
-
userType: args.role === 'assistant' ? 'student' : args.role,
|
|
348
|
-
userId: args.userId + '',
|
|
349
|
-
teacherId: args.teacherId + ''
|
|
350
|
-
};
|
|
351
|
-
window.zby_sdk_req_get_cloud_params = reqParam;
|
|
352
|
-
let cloudData;
|
|
353
|
-
if (args.cloudData && args.cloudData.sdkName && args.cloudData.encodedResolution && args.cloudData.previewResolution) {
|
|
354
|
-
cloudData = args.cloudData;
|
|
355
|
-
} else {
|
|
356
|
-
defaultApi.writeLog(`sdk_init: getCloudData reqParam : ${JSON.stringify(reqParam)}`);
|
|
357
|
-
let cloudResponse;
|
|
358
|
-
try {
|
|
359
|
-
cloudResponse = await getCloudData(reqParam);
|
|
360
|
-
} catch (error) {
|
|
361
|
-
return retryInit('getCloudData', 'init', args, dealSDKMsg);
|
|
362
|
-
}
|
|
363
|
-
defaultApi.writeLog(`sdk_init: cloudResponse : ${JSON.stringify(cloudResponse)}`);
|
|
364
|
-
if (cloudResponse.code === 0 && cloudResponse.data) {
|
|
365
|
-
cloudData = cloudResponse.data;
|
|
366
|
-
} else {
|
|
367
|
-
defaultApi.writeLog(`sdk_init: get cloudResponse error: ${JSON.stringify(cloudResponse)}`);
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
defaultApi.writeLog(`sdk_init: cloudData : ${JSON.stringify(cloudData)}`);
|
|
372
|
-
window.zby_sdk_cloud_data = cloudData;
|
|
373
|
-
const detailArgs = caculateDeatailArgs(args, cloudData);
|
|
374
|
-
|
|
375
|
-
let sdk_type = cloudData.sdkName;
|
|
376
|
-
// let sdk_type = 'zego';
|
|
377
|
-
Object.assign(window.zby_sdk_init_params, cloudData);
|
|
378
|
-
//通知业务层,初始化完成
|
|
379
|
-
NOTICE.sdkStatus({
|
|
380
|
-
sdk_type,
|
|
381
|
-
status: 'before_init'
|
|
382
|
-
});
|
|
383
|
-
defaultApi.writeLog(`sdk status : before_init , sdk_type : ${sdk_type}`);
|
|
384
|
-
await zbyAVSDK.init(sdk_type, detailArgs).catch(error => {
|
|
385
|
-
defaultApi.writeLog(`sdk init AVSDK init_failed ${JSON.stringify(error)}`);
|
|
386
|
-
return;
|
|
387
|
-
});
|
|
388
|
-
defaultApi.writeLog(`sdk status : setAudioCallbackType , sdk_type : ${sdk_type}`);
|
|
389
|
-
try {
|
|
390
|
-
await liveBaseApi.setAudioCallbackType(sdk_type);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
dataReport.joinRoom({initParams: args});
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
//
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
//
|
|
470
|
-
// await
|
|
471
|
-
//
|
|
472
|
-
//
|
|
473
|
-
//
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
//
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
//
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
let
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
//
|
|
559
|
-
//
|
|
560
|
-
//
|
|
561
|
-
//
|
|
562
|
-
//
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
CHANNEL.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
},
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
//
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
};
|
|
832
|
-
if(
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
defaultApi.writeLog(`sdk action : startPullFlow ,userId : ${JSON.stringify(userId)},
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
defaultApi.writeLog(`sdk action : stopPullFlow ,userId : ${userId}, groupId: ${groupId},
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
defaultApi.writeLog(`sdk action : playDestroy ,userId : ${userId}, groupId: ${groupId},
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
* @
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
//
|
|
1084
|
-
//
|
|
1085
|
-
//
|
|
1086
|
-
//
|
|
1087
|
-
//
|
|
1088
|
-
//
|
|
1089
|
-
|
|
1090
|
-
//
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
CHANNEL.
|
|
1095
|
-
//
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
streamId
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
streamId,
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
streamId
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
streamId
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
* @
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
* @
|
|
1267
|
-
* @
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
* @
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
* @
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
return
|
|
1346
|
-
},
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
* @
|
|
1358
|
-
* @param { number }
|
|
1359
|
-
* @param { number }
|
|
1360
|
-
* @param {
|
|
1361
|
-
* @
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
* @
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
* @
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
* @
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
* @
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
* @
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
//
|
|
1533
|
-
//
|
|
1534
|
-
//
|
|
1535
|
-
//
|
|
1536
|
-
//
|
|
1537
|
-
//
|
|
1538
|
-
//
|
|
1539
|
-
//
|
|
1540
|
-
//
|
|
1541
|
-
//
|
|
1542
|
-
// },
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1
|
+
import zbyAVSDK from './zby-av-sdk/zby-av-sdk';
|
|
2
|
+
import {
|
|
3
|
+
version,
|
|
4
|
+
config,
|
|
5
|
+
// getAndSetInitParams,
|
|
6
|
+
// getLogAddress,
|
|
7
|
+
getApiCloudBaseUrl
|
|
8
|
+
} from './config/config';
|
|
9
|
+
import util from './util/util';
|
|
10
|
+
import dict from './util/dict';
|
|
11
|
+
|
|
12
|
+
import CHANNEL from './channel';
|
|
13
|
+
|
|
14
|
+
import dataReport from './network/dataReport';
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
getCloudData,
|
|
18
|
+
changeSdkInRoom
|
|
19
|
+
} from './network/api';
|
|
20
|
+
|
|
21
|
+
import toolBaseApi from './tool/base';
|
|
22
|
+
import liveBaseApi from './live/base';
|
|
23
|
+
import defaultApi from './default';
|
|
24
|
+
import {getDevicePermissionsFun, setMediaPermissionFun, isAppleM1} from './zby-av-sdk/device';
|
|
25
|
+
import NOTICE from './notice';
|
|
26
|
+
|
|
27
|
+
// window.zegoHasPushFlow = 0
|
|
28
|
+
|
|
29
|
+
export let userAndDeviceStatusInfo = {
|
|
30
|
+
microPhone: false,
|
|
31
|
+
camera: false,
|
|
32
|
+
isPushingFlow: false,
|
|
33
|
+
//不看他
|
|
34
|
+
// ignoreList : new Set()
|
|
35
|
+
};
|
|
36
|
+
let sdkConfig = config;
|
|
37
|
+
let sdk_status = -1;
|
|
38
|
+
let sdkRetryCount = 0;
|
|
39
|
+
let deviceCheckerInitStatus = -1;
|
|
40
|
+
|
|
41
|
+
const windowObjArr = [['zby_sdk_req_get_cloud_params', 'zbyAVSDK_init_params', 'zbyAVSDK_device_checker_init', 'zby_sdk_cloud_data'], ['zbyAVSDK_init_sdk_type', 'current_sdk_type']];
|
|
42
|
+
|
|
43
|
+
let confId;
|
|
44
|
+
|
|
45
|
+
// 重试初始化
|
|
46
|
+
function retryInit(error, name = 'init', args, dealSDKMsg) {
|
|
47
|
+
//通知业务层,初始化失败,重试
|
|
48
|
+
sdkRetryCount++;
|
|
49
|
+
sdk_status = -1;
|
|
50
|
+
if (sdkRetryCount > 3) {
|
|
51
|
+
sdkRetryCount = 0;
|
|
52
|
+
NOTICE.sdkStatus({
|
|
53
|
+
status: 'retry_stop'
|
|
54
|
+
});
|
|
55
|
+
try {
|
|
56
|
+
// console.log('获取云控失败上报加入教室code1',window.zby_sdk_init_params);
|
|
57
|
+
dataReport.joinRoomResult({
|
|
58
|
+
code: '1',
|
|
59
|
+
// cloud_api_response: JSON.stringify(window.zby_sdk_cloud_data),
|
|
60
|
+
// cloud_api_response: window.zby_sdk_cloud_data,
|
|
61
|
+
cloud_api_url: `${getApiCloudBaseUrl()}/rtccloud/class/init`
|
|
62
|
+
});
|
|
63
|
+
} catch(e) {
|
|
64
|
+
defaultApi.writeLog('获取云控接口失败');
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
NOTICE.sdkStatus({
|
|
68
|
+
status: `retry_${name}`,
|
|
69
|
+
count: sdkRetryCount
|
|
70
|
+
});
|
|
71
|
+
defaultApi.writeLog(`sdk action: retry_${name}, count: it's the 【${sdkRetryCount}】 retry, ${error} error`);
|
|
72
|
+
if (name === 'init') {
|
|
73
|
+
return zbysdk.init(args, dealSDKMsg);
|
|
74
|
+
}
|
|
75
|
+
return zbysdk.changeSDK(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 设备状态通知
|
|
82
|
+
* @param {String} deviceType 'audio', 'video'
|
|
83
|
+
* @param {Bollean} operation
|
|
84
|
+
*/
|
|
85
|
+
function sendDeviceStatus(deviceType, operation) {
|
|
86
|
+
if (window.zbyAVSDK_init_params) {
|
|
87
|
+
const initParams = window.zby_sdk_init_params;
|
|
88
|
+
NOTICE.deviceStatus({
|
|
89
|
+
userId: initParams.userId,
|
|
90
|
+
userName: initParams.userName,
|
|
91
|
+
role: initParams.role,
|
|
92
|
+
//获取设备类型和状态对应的文案,返回给业务层
|
|
93
|
+
deviceType: deviceType,
|
|
94
|
+
deviceStatus: operation ? 'open' : 'closed'
|
|
95
|
+
});
|
|
96
|
+
//更新设备状态,摄像头,麦克风 开启/关闭
|
|
97
|
+
CHANNEL.sendUpdateStreamDeviceStatus(Object.assign({}, initParams, {
|
|
98
|
+
deviceType: dict.getDeviceTypeKey(deviceType),
|
|
99
|
+
deviceStatus: dict.getDeviceStatusKey(operation ? 'open' : 'closed')
|
|
100
|
+
}));
|
|
101
|
+
} else {
|
|
102
|
+
console.log('尚未初始化,无须设备状态同步');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @param {String} userId
|
|
108
|
+
* @param {String} status 流状态
|
|
109
|
+
*/
|
|
110
|
+
function noticeStreamStatus(userId, status) {
|
|
111
|
+
NOTICE.streamStatus({
|
|
112
|
+
userId,
|
|
113
|
+
status
|
|
114
|
+
});
|
|
115
|
+
defaultApi.writeLog(`sdk stream status userId: ${JSON.stringify(userId)} ${status}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function generateStreamId(userId, groupId) {
|
|
119
|
+
if (!window.zby_sdk_init_params) {
|
|
120
|
+
console.log('缺少初始化参数,无法生成streamId');
|
|
121
|
+
}
|
|
122
|
+
const initParams = window.zby_sdk_init_params;
|
|
123
|
+
if (!initParams) {
|
|
124
|
+
return '';
|
|
125
|
+
}
|
|
126
|
+
// TODO 测试用
|
|
127
|
+
// if (initParams.sdkName === 'talrtc') {
|
|
128
|
+
// initParams.institutionId = 'd46144';
|
|
129
|
+
// }
|
|
130
|
+
return util.getStreamId({
|
|
131
|
+
...initParams,
|
|
132
|
+
userId,
|
|
133
|
+
groupId
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function caculateDeatailArgs(baseArgs, cloudData) {
|
|
138
|
+
try {
|
|
139
|
+
const commonArgs = {
|
|
140
|
+
userId: baseArgs.userId,
|
|
141
|
+
streamId: util.getStreamId(baseArgs),
|
|
142
|
+
userName: baseArgs.userName || '',
|
|
143
|
+
sid: baseArgs.sid,
|
|
144
|
+
role: baseArgs.role,
|
|
145
|
+
roomId: baseArgs.roomId + '',
|
|
146
|
+
confId: confId,
|
|
147
|
+
userAvatar: baseArgs.userAvatar || '',
|
|
148
|
+
userToken: baseArgs.userToken || '',
|
|
149
|
+
devices: baseArgs.devices,
|
|
150
|
+
env: baseArgs.env,
|
|
151
|
+
//站立模式:0 / 坐立模式:1
|
|
152
|
+
mode: baseArgs.mode,
|
|
153
|
+
live_id: baseArgs.liveId,
|
|
154
|
+
// 课堂模式,0=小组课/1=新小班
|
|
155
|
+
classMode: +baseArgs.classMode,
|
|
156
|
+
//数据上报班课类型
|
|
157
|
+
liveType: +baseArgs.liveType,
|
|
158
|
+
//是否开启转推功能
|
|
159
|
+
isTurnPush: baseArgs.isTurnPush || false,
|
|
160
|
+
// isSetAEC: baseArgs.isSetAEC || false,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
//从云控返回值中获取直播相关配置
|
|
164
|
+
const liveConfig = {
|
|
165
|
+
//大画面视频采集码率(取值范围:40kb~2000kb)
|
|
166
|
+
// captureBitrate: +cloudData.captureBitrate,
|
|
167
|
+
//大画面视频采集帧率(取值范围:5~30)
|
|
168
|
+
// captureFps: +cloudData.captureFps,
|
|
169
|
+
//大画面视频编码分辨率
|
|
170
|
+
encodedResolutionWidth: +cloudData.encodedResolution.split('*')[0],
|
|
171
|
+
encodedResolutionHeight: +cloudData.encodedResolution.split('*')[1],
|
|
172
|
+
// 预览画面视频采集码率(取值范围:40kb~300kb)
|
|
173
|
+
encodeCaptureBitrate: +cloudData.encodedBitrate,
|
|
174
|
+
encodeCaptureFps: +cloudData.encodedFps,
|
|
175
|
+
// 预览画面视频采集帧率(取值范围:5~15)
|
|
176
|
+
previewCaptureFps: +cloudData.previewFps,
|
|
177
|
+
// 预览视频编码分辨率
|
|
178
|
+
previewResolutionWidth: +cloudData.previewResolution.split('*')[0],
|
|
179
|
+
previewResolutionHeight: +cloudData.previewResolution.split('*')[1],
|
|
180
|
+
//rtc同屏分辨率
|
|
181
|
+
screenSameResolutionWidth: cloudData.screenSameResolution ? +cloudData.screenSameResolution.split('*')[0] : 1280,
|
|
182
|
+
screenSameResolutionHeight: cloudData.screenSameResolution ? +cloudData.screenSameResolution.split('*')[1] : 720,
|
|
183
|
+
//rtc同屏帧率 码率
|
|
184
|
+
screenSameFps: cloudData.screenSameFps ? +cloudData.screenSameFps : 15,
|
|
185
|
+
screenSameBitrate: cloudData.screenSameBitrate ? +cloudData.screenSameBitrate : 512000,
|
|
186
|
+
// 转推Rtmp地址
|
|
187
|
+
recordUrl: cloudData.recordUrl,
|
|
188
|
+
aecMode: cloudData.aecMode != null ? cloudData.aecMode : -1,
|
|
189
|
+
noiseSuppressMode: cloudData.noiseSuppressMode != null ? cloudData.noiseSuppressMode : -1
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const detailArgs = {
|
|
193
|
+
rtc: Object.assign({}, commonArgs, liveConfig, {
|
|
194
|
+
extensionVersion: baseArgs.extension.version.rtc,
|
|
195
|
+
appId: cloudData.appId
|
|
196
|
+
}),
|
|
197
|
+
talrtc: Object.assign({}, commonArgs, liveConfig, {
|
|
198
|
+
extensionVersion: baseArgs.extension.version.agora || '1.0.0.0',
|
|
199
|
+
appId: cloudData.appId,
|
|
200
|
+
usersign: 'testsign',
|
|
201
|
+
teacherId: baseArgs.teacherId
|
|
202
|
+
}),
|
|
203
|
+
trtc: Object.assign({}, commonArgs, liveConfig, {
|
|
204
|
+
extensionVersion: baseArgs.extension.version.trtc || '1.0.0.0',
|
|
205
|
+
appId: cloudData.appId,
|
|
206
|
+
usersign: cloudData.txRtcKey,
|
|
207
|
+
}),
|
|
208
|
+
zego: Object.assign({}, commonArgs, liveConfig, {
|
|
209
|
+
extensionVersion: baseArgs.extension.version.zego,
|
|
210
|
+
appId: parseInt(cloudData.appId)|| 2251703116,
|
|
211
|
+
appSignature: cloudData.appKey|| 'uYsmfJ4F8ERzRNC4ug6lWB/vfU6ffg+/ETRF14vjzs4=',
|
|
212
|
+
businessType: 0,
|
|
213
|
+
nNetType: 1
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
};
|
|
217
|
+
return detailArgs;
|
|
218
|
+
} catch (error) {
|
|
219
|
+
console.error(error);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* SDK 方法
|
|
225
|
+
*/
|
|
226
|
+
const zbysdk = {
|
|
227
|
+
version: version,
|
|
228
|
+
notice: null,
|
|
229
|
+
// 打开监听log
|
|
230
|
+
openListenerLog: false,
|
|
231
|
+
//端上初始化时传的false
|
|
232
|
+
autoChangeSdk: true,
|
|
233
|
+
log_id:null,
|
|
234
|
+
setConfig(options) {
|
|
235
|
+
Object.assign(sdkConfig, options);
|
|
236
|
+
Object.assign(this, options);
|
|
237
|
+
},
|
|
238
|
+
deviceStatus: {},
|
|
239
|
+
// 开始设备检测
|
|
240
|
+
// async deviceCheckerInit(cb, extension, env = 'test') {
|
|
241
|
+
// if (!extension) {
|
|
242
|
+
// defaultApi.writeLog('sdk deviceCheckerInit extension param is required');
|
|
243
|
+
// }
|
|
244
|
+
// if (deviceCheckerInitStatus > -1) {
|
|
245
|
+
// return 'please stop check device first';
|
|
246
|
+
// }
|
|
247
|
+
// deviceCheckerInitStatus = 0;
|
|
248
|
+
// defaultApi.writeLog(`sdk action: deviceCheckerInit ${JSON.stringify({
|
|
249
|
+
// cb,
|
|
250
|
+
// extension,
|
|
251
|
+
// env,
|
|
252
|
+
// sdk_version: version
|
|
253
|
+
// })}`);
|
|
254
|
+
// if (typeof cb === 'function') {
|
|
255
|
+
// zbysdk.notice = cb;
|
|
256
|
+
// }
|
|
257
|
+
// await zbyAVSDK.deviceCheckerInit(extension, env);
|
|
258
|
+
// deviceCheckerInitStatus = 1;
|
|
259
|
+
// defaultApi.writeLog('sdk devices checked');
|
|
260
|
+
// },
|
|
261
|
+
|
|
262
|
+
async deviceCheckerInit(cb, extension, env = 'test') {
|
|
263
|
+
if (!extension) {
|
|
264
|
+
defaultApi.writeLog('sdk deviceCheckerInit extension param is required');
|
|
265
|
+
}
|
|
266
|
+
if (deviceCheckerInitStatus > -1) {
|
|
267
|
+
return 'please stop check device first';
|
|
268
|
+
}
|
|
269
|
+
deviceCheckerInitStatus = 0;
|
|
270
|
+
defaultApi.writeLog(`sdk action: deviceCheckerInit ${JSON.stringify({
|
|
271
|
+
cb,
|
|
272
|
+
extension,
|
|
273
|
+
env,
|
|
274
|
+
sdk_version: version
|
|
275
|
+
})}`);
|
|
276
|
+
if (typeof cb === 'function') {
|
|
277
|
+
zbysdk.notice = cb;
|
|
278
|
+
}
|
|
279
|
+
await zbyAVSDK.deviceCheckerInit(extension, env);
|
|
280
|
+
deviceCheckerInitStatus = 1;
|
|
281
|
+
defaultApi.writeLog('sdk devices checked');
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// 结束设备检测
|
|
285
|
+
stopCheckDevice() {
|
|
286
|
+
if (deviceCheckerInitStatus === -1) {
|
|
287
|
+
defaultApi.writeLog('please start check device first');
|
|
288
|
+
return 'please start check device first';
|
|
289
|
+
}
|
|
290
|
+
deviceCheckerInitStatus = -1;
|
|
291
|
+
defaultApi.writeLog('sdk stop check device');
|
|
292
|
+
return zbyAVSDK.stopCheckDevice();
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
async init(args, dealSDKMsg) {
|
|
296
|
+
if (sdk_status !== -1) {
|
|
297
|
+
console.log('not allow init');
|
|
298
|
+
dealSDKMsg({
|
|
299
|
+
type: 'error',
|
|
300
|
+
data: {
|
|
301
|
+
message: 'should not start init before init finished'
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
defaultApi.writeLog(`sdk action: init zby_live_sdk_version : ${version}`);
|
|
307
|
+
defaultApi.writeLog(`sdk action: init args : ${JSON.stringify(args)}`);
|
|
308
|
+
defaultApi.writeLog(`sdk action: init_cloudData_args : ${JSON.stringify(args.cloudData)}`);
|
|
309
|
+
try {
|
|
310
|
+
let argsCopy = JSON.parse(JSON.stringify(args));
|
|
311
|
+
delete argsCopy.cloudData;
|
|
312
|
+
defaultApi.writeLog(`sdk action: init_argsCopy_args : ${JSON.stringify(argsCopy)}`);
|
|
313
|
+
} catch (e) {};
|
|
314
|
+
this.log_id = 0;
|
|
315
|
+
sdk_status = 0;
|
|
316
|
+
// 初始化参数存入共享
|
|
317
|
+
window.zby_sdk_init_params = args;
|
|
318
|
+
// 设置confId
|
|
319
|
+
confId = util.getConfId(args.institutionId, args.roomId);
|
|
320
|
+
await liveBaseApi.init();
|
|
321
|
+
try {
|
|
322
|
+
toolBaseApi.init();
|
|
323
|
+
} catch(e) {
|
|
324
|
+
console.log('toolBaseApi_Init',e);
|
|
325
|
+
}
|
|
326
|
+
// try {
|
|
327
|
+
// await util.getNetworkTimeStamp();
|
|
328
|
+
// } catch(e) {
|
|
329
|
+
// console.log('getTimeError',e);
|
|
330
|
+
// };
|
|
331
|
+
//使用初始化传入的 env, isHttps 参数
|
|
332
|
+
Object.assign(sdkConfig, args);
|
|
333
|
+
|
|
334
|
+
zbysdk.notice = dealSDKMsg;
|
|
335
|
+
|
|
336
|
+
// try {
|
|
337
|
+
// await getLogAddress();
|
|
338
|
+
// await getAndSetInitParams({institutionId: args.institutionId, userId: args.userId});
|
|
339
|
+
// } catch (error) {
|
|
340
|
+
// return retryInit('getAndSetInitParams', 'init', args, dealSDKMsg);
|
|
341
|
+
// }
|
|
342
|
+
const reqParam = {
|
|
343
|
+
clientType: 'pc',
|
|
344
|
+
roomType: 7,
|
|
345
|
+
institutionId: args.institutionId + '',
|
|
346
|
+
roomId: args.roomId + '',
|
|
347
|
+
userType: args.role === 'assistant' ? 'student' : args.role,
|
|
348
|
+
userId: args.userId + '',
|
|
349
|
+
teacherId: args.teacherId + ''
|
|
350
|
+
};
|
|
351
|
+
window.zby_sdk_req_get_cloud_params = reqParam;
|
|
352
|
+
let cloudData;
|
|
353
|
+
if (args.cloudData && args.cloudData.sdkName && args.cloudData.encodedResolution && args.cloudData.previewResolution) {
|
|
354
|
+
cloudData = args.cloudData;
|
|
355
|
+
} else {
|
|
356
|
+
defaultApi.writeLog(`sdk_init: getCloudData reqParam : ${JSON.stringify(reqParam)}`);
|
|
357
|
+
let cloudResponse;
|
|
358
|
+
try {
|
|
359
|
+
cloudResponse = await getCloudData(reqParam);
|
|
360
|
+
} catch (error) {
|
|
361
|
+
return retryInit('getCloudData', 'init', args, dealSDKMsg);
|
|
362
|
+
}
|
|
363
|
+
defaultApi.writeLog(`sdk_init: cloudResponse : ${JSON.stringify(cloudResponse)}`);
|
|
364
|
+
if (cloudResponse.code === 0 && cloudResponse.data) {
|
|
365
|
+
cloudData = cloudResponse.data;
|
|
366
|
+
} else {
|
|
367
|
+
defaultApi.writeLog(`sdk_init: get cloudResponse error: ${JSON.stringify(cloudResponse)}`);
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
defaultApi.writeLog(`sdk_init: cloudData : ${JSON.stringify(cloudData)}`);
|
|
372
|
+
window.zby_sdk_cloud_data = cloudData;
|
|
373
|
+
const detailArgs = caculateDeatailArgs(args, cloudData);
|
|
374
|
+
|
|
375
|
+
let sdk_type = cloudData.sdkName;
|
|
376
|
+
// let sdk_type = 'zego';
|
|
377
|
+
Object.assign(window.zby_sdk_init_params, cloudData);
|
|
378
|
+
//通知业务层,初始化完成
|
|
379
|
+
NOTICE.sdkStatus({
|
|
380
|
+
sdk_type,
|
|
381
|
+
status: 'before_init'
|
|
382
|
+
});
|
|
383
|
+
defaultApi.writeLog(`sdk status : before_init , sdk_type : ${sdk_type}`);
|
|
384
|
+
await zbyAVSDK.init(sdk_type, detailArgs).catch(error => {
|
|
385
|
+
defaultApi.writeLog(`sdk init AVSDK init_failed ${JSON.stringify(error)}`);
|
|
386
|
+
return;
|
|
387
|
+
});
|
|
388
|
+
defaultApi.writeLog(`sdk status : setAudioCallbackType , sdk_type : ${sdk_type}`);
|
|
389
|
+
try {
|
|
390
|
+
await liveBaseApi.setAudioCallbackType(sdk_type);
|
|
391
|
+
await zbyAVSDK.setThirdAudioCallbackType(sdk_type);
|
|
392
|
+
} catch (e) {
|
|
393
|
+
defaultApi.writeLog(`sdk status : setAudioCallbackType , error : ${JSON.stringify(e)}`);
|
|
394
|
+
};
|
|
395
|
+
try {
|
|
396
|
+
// dataReport.joinRoom({initParams: JSON.stringify(args)});
|
|
397
|
+
dataReport.joinRoom({initParams: args});
|
|
398
|
+
} catch (e) {};
|
|
399
|
+
defaultApi.writeLog(`sdk status : init_finished , sdk_type : ${sdk_type}`);
|
|
400
|
+
//通知业务层,初始化完成
|
|
401
|
+
NOTICE.sdkStatus({
|
|
402
|
+
sdk_type,
|
|
403
|
+
status: 'init_finished'
|
|
404
|
+
});
|
|
405
|
+
try {
|
|
406
|
+
window.zby_isM1Type =(await isAppleM1()).data.is_Apple_Silicon;
|
|
407
|
+
} catch (error) {
|
|
408
|
+
defaultApi.writeLog(`sdk action : isAppleM1 error ${JSON.stringify(error)}`);
|
|
409
|
+
}
|
|
410
|
+
try{
|
|
411
|
+
dataReport.initFinished({code:0});
|
|
412
|
+
}catch (e){ }
|
|
413
|
+
sdk_status = 1;
|
|
414
|
+
sdkRetryCount = 0;
|
|
415
|
+
|
|
416
|
+
// 缓存初始化信息
|
|
417
|
+
windowObjArr[0].forEach(item => {
|
|
418
|
+
if (window[item] !== undefined) {
|
|
419
|
+
localStorage.setItem(item, JSON.stringify(window[item]));
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
windowObjArr[1].forEach(item => {
|
|
423
|
+
if (window[item] !== undefined) {
|
|
424
|
+
localStorage.setItem(item, window[item]);
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
//进入信道房间
|
|
429
|
+
// enterChannelRoom({...args, chatUrl: cloudData.chatUrl}, dealSDKMsg);
|
|
430
|
+
// sendInitChannelMsg(args);
|
|
431
|
+
CHANNEL.joinRoom({...args, chatUrl: cloudData.chatUrl, guid: window.zby_sdk_init_params.guid}, dealSDKMsg, cloudData.chatType);
|
|
432
|
+
},
|
|
433
|
+
|
|
434
|
+
// 设置新窗口配置
|
|
435
|
+
setNewWindowConfig(args) {
|
|
436
|
+
defaultApi.writeLog(`sdk action : setNewWindowConfig , args : ${JSON.stringify(args)}`);
|
|
437
|
+
window.zbyAVSDK_init_sdk_type = args.sdkType;
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
// 恢复sdk
|
|
441
|
+
async recoverSdk(args, dealSDKMsg) {
|
|
442
|
+
defaultApi.writeLog(`sdk action : recoverSdk , args : ${JSON.stringify(args)}`);
|
|
443
|
+
// 恢复全局变量
|
|
444
|
+
windowObjArr[0].forEach(item => {
|
|
445
|
+
const obj = localStorage.getItem(item);
|
|
446
|
+
if (obj && obj.indexOf('{') > -1) {
|
|
447
|
+
try {
|
|
448
|
+
window[item] = JSON.parse(obj);
|
|
449
|
+
} catch (error) {
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
let cloudData;
|
|
454
|
+
if (args.cloudData) {
|
|
455
|
+
cloudData = args.cloudData;
|
|
456
|
+
} else {
|
|
457
|
+
try {
|
|
458
|
+
cloudData = JSON.parse(localStorage.getItem('zby_sdk_cloud_data'));
|
|
459
|
+
} catch (error) {
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
windowObjArr[1].forEach(item => {
|
|
463
|
+
window[item] = localStorage.getItem(item);
|
|
464
|
+
});
|
|
465
|
+
window.zby_sdk_init_params = args;
|
|
466
|
+
|
|
467
|
+
defaultApi.writeLog('sdk action : recoverSdk , set window params finished');
|
|
468
|
+
|
|
469
|
+
// try {
|
|
470
|
+
// await getLogAddress();
|
|
471
|
+
// await getAndSetInitParams({institutionId: args.institutionId, userId: args.userId});
|
|
472
|
+
// } catch (error) {
|
|
473
|
+
// return retryInit('getAndSetInitParams', 'init', args, dealSDKMsg);
|
|
474
|
+
// }
|
|
475
|
+
|
|
476
|
+
//使用初始化传入的 env, isHttps 参数
|
|
477
|
+
Object.assign(sdkConfig, args);
|
|
478
|
+
|
|
479
|
+
zbysdk.notice = dealSDKMsg;
|
|
480
|
+
|
|
481
|
+
const detailArgs = caculateDeatailArgs(args, cloudData);
|
|
482
|
+
|
|
483
|
+
await zbyAVSDK.recoverSdk(detailArgs);
|
|
484
|
+
|
|
485
|
+
sdk_status = 1;
|
|
486
|
+
|
|
487
|
+
//通知业务层,初始化完成
|
|
488
|
+
NOTICE.sdkStatus({
|
|
489
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
490
|
+
status: 'init_finished'
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
defaultApi.writeLog('sdk action : recoverSdk finished');
|
|
494
|
+
|
|
495
|
+
//进入信道房间
|
|
496
|
+
// enterChannelRoom({...args, chatUrl: cloudData.chatUrl}, dealSDKMsg);
|
|
497
|
+
// sendInitChannelMsg(args);
|
|
498
|
+
CHANNEL.joinRoom({...args, chatUrl: cloudData.chatUrl}, dealSDKMsg, cloudData.chatType);
|
|
499
|
+
},
|
|
500
|
+
|
|
501
|
+
// 接收到信道消息,进行切换SDK操作
|
|
502
|
+
// from 0:云控 1:重试 2: 上层调用
|
|
503
|
+
async changeSDK(from = 0) {
|
|
504
|
+
if (!window.zby_sdk_init_params || !window.zby_sdk_req_get_cloud_params) {
|
|
505
|
+
console.log('缺少初始化参数,无法切换SDK');
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
//重试(2)不走下一步,否则会陷入死循环,如果是reJoin(1)来的,自动走切sdk逻辑,不触发start_sdk_change回调直接切
|
|
509
|
+
if (from < 1) {
|
|
510
|
+
// 通知业务层,切换之前(授课业务逻辑需要,比如老师主动调切sdk,云控走的切sdk全部由老师主动切,修复连麦崩溃)
|
|
511
|
+
NOTICE.sdkStatus({
|
|
512
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
513
|
+
status: 'start_sdk_change'
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
defaultApi.writeLog('sdk status : start_sdk_change');
|
|
517
|
+
if (from === 0 && !this.autoChangeSdk) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
const initParams = window.zby_sdk_init_params;
|
|
521
|
+
let nowSdk = window.zbyAVSDK_init_sdk_type;
|
|
522
|
+
let cloudData;
|
|
523
|
+
//请求云控获取更新后的SDK配置相关信息
|
|
524
|
+
let cloudResponse;
|
|
525
|
+
try {
|
|
526
|
+
cloudResponse = await getCloudData(window.zby_sdk_req_get_cloud_params);
|
|
527
|
+
} catch (error)
|
|
528
|
+
{
|
|
529
|
+
defaultApi.writeLog(`changeSDK: getCloudData error ${JSON.stringify(error)}`);
|
|
530
|
+
return retryInit('getCloudData', 'changeSDK');
|
|
531
|
+
};
|
|
532
|
+
cloudData = cloudResponse.data;
|
|
533
|
+
|
|
534
|
+
if (cloudData) {
|
|
535
|
+
const changeSDKParam = caculateDeatailArgs(initParams, cloudData);
|
|
536
|
+
const sdk_type = cloudData.sdkName;
|
|
537
|
+
|
|
538
|
+
window.zbyAVSDK_init_params = changeSDKParam;
|
|
539
|
+
|
|
540
|
+
if (window.zbyAVSDK_init_sdk_type === sdk_type) {
|
|
541
|
+
console.log('%cchangeSDK :和本地SDK一致,不切换:' + sdk_type, 'color:blue');
|
|
542
|
+
defaultApi.writeLog(`sdk: change sdk action , target is the same as local , will not change sdk to ${sdk_type}`);
|
|
543
|
+
window.target_sdk_type = null;
|
|
544
|
+
return;
|
|
545
|
+
} else {
|
|
546
|
+
window.target_sdk_type = sdk_type;
|
|
547
|
+
defaultApi.writeLog(`sdk action: changeSDK to sdk_type : ${sdk_type}, sdk status : start_change `);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// 通知业务层,切换之前
|
|
551
|
+
NOTICE.sdkStatus({
|
|
552
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
553
|
+
target_sdk_type: sdk_type,
|
|
554
|
+
status: 'before_sdk_change'
|
|
555
|
+
});
|
|
556
|
+
defaultApi.writeLog(`sdk status : before_sdk_change to sdk_type : ${sdk_type}`);
|
|
557
|
+
|
|
558
|
+
// try {
|
|
559
|
+
// dataReport.sdkChange({
|
|
560
|
+
// from: window.zbyAVSDK_init_sdk_type,
|
|
561
|
+
// to: sdk_type
|
|
562
|
+
// });
|
|
563
|
+
// } catch (e){};
|
|
564
|
+
|
|
565
|
+
// //切换SDK之前,先停止转推
|
|
566
|
+
if(window.zbyAVSDK_init_params[sdk_type].isTurnPush) {
|
|
567
|
+
zbyAVSDK.turnPush('stop');
|
|
568
|
+
};
|
|
569
|
+
sdk_status = 0;
|
|
570
|
+
|
|
571
|
+
console.log('%c执行SDK切换' + sdk_type, 'color:blue');
|
|
572
|
+
try {
|
|
573
|
+
CHANNEL.sendRemoveStream(window.zby_sdk_init_params);
|
|
574
|
+
CHANNEL.sendLeave(window.zby_sdk_init_params);
|
|
575
|
+
await zbyAVSDK.changeSDK({
|
|
576
|
+
sdk_type
|
|
577
|
+
});
|
|
578
|
+
} catch (error) {
|
|
579
|
+
defaultApi.writeLog(`changeSDK error : ${JSON.stringify(error)}`);
|
|
580
|
+
window.target_sdk_type = null;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
try {
|
|
584
|
+
console.log('开始设置rtmp声音回调',sdk_type);
|
|
585
|
+
await liveBaseApi.setAudioCallbackType(sdk_type);
|
|
586
|
+
await zbyAVSDK.setThirdAudioCallbackType(sdk_type);
|
|
587
|
+
} catch (error) {
|
|
588
|
+
defaultApi.writeLog(`setAudioCallbackType error : ${JSON.stringify(error)}`);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
try {
|
|
592
|
+
dataReport.sdkChange({
|
|
593
|
+
from: nowSdk,
|
|
594
|
+
to: sdk_type
|
|
595
|
+
});
|
|
596
|
+
} catch (e){};
|
|
597
|
+
|
|
598
|
+
console.log('%cSDK切换完毕' + sdk_type, 'color:blue');
|
|
599
|
+
sdkRetryCount = 0;
|
|
600
|
+
sdk_status = 1;
|
|
601
|
+
window.target_sdk_type = null;
|
|
602
|
+
// 通知业务层,切换完成
|
|
603
|
+
NOTICE.sdkStatus({
|
|
604
|
+
sdk_type,
|
|
605
|
+
status: 'sdk_changed'
|
|
606
|
+
});
|
|
607
|
+
defaultApi.writeLog(`sdk status : sdk_changed , sdk_type : ${sdk_type}`);
|
|
608
|
+
|
|
609
|
+
//切换SDK 完成后,先发送 join消息
|
|
610
|
+
CHANNEL.sendJoin(initParams);
|
|
611
|
+
|
|
612
|
+
// 打开本地摄像头, 并开始推流后, 老师视频和麦克风状态变为'开启', 即true
|
|
613
|
+
//切换完成之后,学生重新推流
|
|
614
|
+
// if (window.zby_sdk_init_params.role === 'student') {
|
|
615
|
+
console.log('%c执行打开摄像头和推流:' + sdk_type, 'color:blue');
|
|
616
|
+
await zbysdk.openOrCloseCamera(userAndDeviceStatusInfo.camera);
|
|
617
|
+
await zbysdk.openOrCloseMicrophone(userAndDeviceStatusInfo.microPhone);
|
|
618
|
+
if (userAndDeviceStatusInfo.isPushingFlow) {
|
|
619
|
+
await zbysdk.startPushFlow();
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const videoSrc = await zbysdk.getOrLocateVideo({
|
|
623
|
+
isLocal: true,
|
|
624
|
+
});
|
|
625
|
+
NOTICE.updateLocalPreview({
|
|
626
|
+
videoSrc: videoSrc
|
|
627
|
+
});
|
|
628
|
+
defaultApi.writeLog(`sdk update_local_preview , videoSrc : ${videoSrc} `);
|
|
629
|
+
// }
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
changeGroup(groupId, channelToken) {
|
|
633
|
+
return this.changeRoom(groupId, channelToken);
|
|
634
|
+
},
|
|
635
|
+
|
|
636
|
+
//alias changeGroup
|
|
637
|
+
async changeRoom(roomId, channelToken) {
|
|
638
|
+
if (!channelToken) {
|
|
639
|
+
console.warn('changeRoom param: channelToken is required !');
|
|
640
|
+
defaultApi.writeLog('changeRoom param: channelToken is required !');
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
defaultApi.writeLog(`sdk action : changeRoom to roomId : ${roomId}`);
|
|
645
|
+
|
|
646
|
+
//业务层停止所有拉流
|
|
647
|
+
window.zby_sdk_init_params.roomId = roomId;
|
|
648
|
+
const initParams = window.zby_sdk_init_params;
|
|
649
|
+
|
|
650
|
+
// 通知业务层,room 切换之前
|
|
651
|
+
zbysdk.notice({
|
|
652
|
+
type: 'sdk_status',
|
|
653
|
+
data: {
|
|
654
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
655
|
+
target_room_id: roomId,
|
|
656
|
+
status: 'before_room_change'
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
defaultApi.writeLog(`sdk status : before_room_change to roomId ${roomId}`);
|
|
660
|
+
//广播 leave 消息
|
|
661
|
+
CHANNEL.sendLeave(initParams);
|
|
662
|
+
//断开信道
|
|
663
|
+
CHANNEL.leaveRoom(initParams);
|
|
664
|
+
defaultApi.writeLog('channle status : leave channel room invoked');
|
|
665
|
+
//退出当前流媒体房间
|
|
666
|
+
await zbyAVSDK.leaveRoom();
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
//获取新小组的云控数据
|
|
670
|
+
let reqParam = {
|
|
671
|
+
clientType: 'pc',
|
|
672
|
+
roomType: 7,
|
|
673
|
+
institutionId: initParams.institutionId + '',
|
|
674
|
+
roomId: initParams.roomId + '',
|
|
675
|
+
userType: initParams.role,
|
|
676
|
+
userId: initParams.userId + '',
|
|
677
|
+
teacherId: initParams.teacherId + ''
|
|
678
|
+
};
|
|
679
|
+
reqParam.sign = util.getVerifySign(reqParam);
|
|
680
|
+
reqParam.main = 2;
|
|
681
|
+
//暂存请求云控所需参数,为切换SDK作预备
|
|
682
|
+
window.zby_sdk_req_get_cloud_params = reqParam;
|
|
683
|
+
const cloudResponse = await getCloudData(window.zby_sdk_req_get_cloud_params);
|
|
684
|
+
const cloudData = cloudResponse.data;
|
|
685
|
+
const sdk_type = cloudData.sdkName;
|
|
686
|
+
//SDK重新初始化
|
|
687
|
+
const detailArgs = caculateDeatailArgs(initParams, cloudData);
|
|
688
|
+
await zbyAVSDK.init(sdk_type, detailArgs);
|
|
689
|
+
|
|
690
|
+
//重新进入信道
|
|
691
|
+
initParams.channelToken = channelToken;
|
|
692
|
+
// enterChannelRoom({...initParams, chatUrl: cloudData.chatUrl});
|
|
693
|
+
defaultApi.writeLog('channle status : enter channel room invoked');
|
|
694
|
+
// sendInitChannelMsg(initParams);
|
|
695
|
+
CHANNEL.joinRoom({...args, chatUrl: cloudData.chatUrl}, dealSDKMsg, cloudData.chatType);
|
|
696
|
+
|
|
697
|
+
// 通知业务层,room 切换之前
|
|
698
|
+
zbysdk.notice({
|
|
699
|
+
type: 'sdk_status',
|
|
700
|
+
data: {
|
|
701
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
702
|
+
room_id: roomId,
|
|
703
|
+
status: 'room_changed'
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
defaultApi.writeLog(`sdk status : room_changed ,roomId ${roomId}`);
|
|
707
|
+
|
|
708
|
+
},
|
|
709
|
+
async setCameraDevice(deviceId) {
|
|
710
|
+
defaultApi.writeLog(`sdk action : setCameraDevice --start,deviceId ${deviceId}`);
|
|
711
|
+
await zbyAVSDK.setCameraDevice(deviceId,'client');
|
|
712
|
+
defaultApi.writeLog(`sdk action : setCameraDevice --end,deviceId ${deviceId}`);
|
|
713
|
+
|
|
714
|
+
},
|
|
715
|
+
|
|
716
|
+
async getCameraDeviceList() {
|
|
717
|
+
defaultApi.writeLog('sdk action : getCameraDeviceList ');
|
|
718
|
+
return await zbyAVSDK.getCameraDeviceList();
|
|
719
|
+
},
|
|
720
|
+
|
|
721
|
+
async openOrCloseCamera(operation) {
|
|
722
|
+
defaultApi.writeLog(`sdk action : openOrCloseCamera ${operation} --start`);
|
|
723
|
+
await zbyAVSDK.openOrCloseCamera(operation);
|
|
724
|
+
try {
|
|
725
|
+
dataReport.deviceChange({
|
|
726
|
+
device_type: 1,
|
|
727
|
+
code: operation? 1 : 0,
|
|
728
|
+
device_name: window.zbyAVSDK_device_checker_init.camera.name,
|
|
729
|
+
device_id: window.zbyAVSDK_device_checker_init.camera.use
|
|
730
|
+
});
|
|
731
|
+
} catch (e){};
|
|
732
|
+
userAndDeviceStatusInfo.camera = operation;
|
|
733
|
+
//记录摄像头状态,用作推流类型上报,是否推视频
|
|
734
|
+
this.deviceStatus.camera = operation;
|
|
735
|
+
sdk_status === 1 && sendDeviceStatus('video', operation);
|
|
736
|
+
defaultApi.writeLog(`sdk action : openOrCloseCamera ${operation} --end`);
|
|
737
|
+
},
|
|
738
|
+
|
|
739
|
+
//推不推画面
|
|
740
|
+
async setPushStreamVideo(operation) {
|
|
741
|
+
await zbyAVSDK.setPushStreamVideo(operation);
|
|
742
|
+
defaultApi.writeLog(`sdk action : setPushStreamVideo ${operation} `);
|
|
743
|
+
},
|
|
744
|
+
|
|
745
|
+
//看或不看指定用户的视频
|
|
746
|
+
async setVideoMute(userId, operation, groupId) {
|
|
747
|
+
const streamId = generateStreamId(userId, groupId);
|
|
748
|
+
await zbyAVSDK.setVideoMute(streamId, operation);
|
|
749
|
+
defaultApi.writeLog(`sdk action : setVideoMute userId ${userId}, groupId ${groupId}, operation ${operation}, streamId ${streamId}`);
|
|
750
|
+
},
|
|
751
|
+
|
|
752
|
+
async getOrLocateVideo(args) {
|
|
753
|
+
defaultApi.writeLog(`sdk action : getOrLocateVideo --start args : ${JSON.stringify(args)}`);
|
|
754
|
+
const videoSrc = await zbyAVSDK.getOrLocateVideo({
|
|
755
|
+
domId: args.domId,
|
|
756
|
+
isLocal: args.isLocal,
|
|
757
|
+
streamId: args.streamId || (args.userId && generateStreamId(args.userId)),
|
|
758
|
+
isTeacherNewWindowPreview: args.isTeacherNewWindowPreview
|
|
759
|
+
});
|
|
760
|
+
defaultApi.writeLog(`sdk getOrLocateVideo successfully, videoSrc : ${videoSrc} `);
|
|
761
|
+
return videoSrc;
|
|
762
|
+
},
|
|
763
|
+
|
|
764
|
+
async linkMicReport(args) {
|
|
765
|
+
defaultApi.writeLog(`sdk action : linkMicReport args : ${JSON.stringify(args)}`);
|
|
766
|
+
const {name, pull_uid, trace_id} = args;
|
|
767
|
+
let pull_uid1 = [];
|
|
768
|
+
pull_uid.forEach( item => {
|
|
769
|
+
pull_uid1.push(item+'');
|
|
770
|
+
});
|
|
771
|
+
if (dataReport.hasOwnProperty(name)) {
|
|
772
|
+
dataReport[name]({pull_uid:pull_uid1,trace_id});
|
|
773
|
+
};
|
|
774
|
+
},
|
|
775
|
+
|
|
776
|
+
async startPushFlow(streamid, idx) {
|
|
777
|
+
defaultApi.writeLog(`sdk action : startPushFlow streamId:${streamid} idx: ${idx}`);
|
|
778
|
+
try {
|
|
779
|
+
// dataReport.startPublish({publish_streamid:window.zbyAVSDK_init_params.rtc.streamId});
|
|
780
|
+
streamid&&idx ? dataReport.startPublish({publish_rtc_streamid:streamid}) : dataReport.startPublish() ;
|
|
781
|
+
} catch (e) {};
|
|
782
|
+
await zbyAVSDK.startPushFlow(streamid, idx);
|
|
783
|
+
// 不重新推流此情况不适用,推流状态跟着设备开关情况改变,以下仅用作数据上报
|
|
784
|
+
// console.log('push_type000',this.deviceStatus.camera,this.deviceStatus.microphone);
|
|
785
|
+
if(this.deviceStatus.camera && this.deviceStatus.microphone) {
|
|
786
|
+
this.deviceStatus.stream_type = 'both';
|
|
787
|
+
} else if(!this.deviceStatus.camera && this.deviceStatus.microphone) {
|
|
788
|
+
this.deviceStatus.stream_type = 'audio';
|
|
789
|
+
} else if(this.deviceStatus.camera && !this.deviceStatus.microphone) {
|
|
790
|
+
this.deviceStatus.stream_type = 'video';
|
|
791
|
+
} else {
|
|
792
|
+
this.deviceStatus.stream_type = 'none';
|
|
793
|
+
}
|
|
794
|
+
// console.log('push_type111',this.deviceStatus,this.deviceStatus.stream_type);
|
|
795
|
+
const initParams = window.zby_sdk_init_params;
|
|
796
|
+
// initParams.role === 'teacher' && zbyAVSDK.turnPush('start');
|
|
797
|
+
if (window.zbyAVSDK_init_sdk_type === 'zego' && initParams.role === 'student') {
|
|
798
|
+
//仅当学生为zego类型时,才确保推流成功之后再发join消息
|
|
799
|
+
return new Promise((resolve, reject) => {
|
|
800
|
+
let timer = setInterval(() => {
|
|
801
|
+
if (window.zegoHasPushFlow) {
|
|
802
|
+
// window.zegoHasPushFlow = 0
|
|
803
|
+
clearInterval(timer);
|
|
804
|
+
resolve();
|
|
805
|
+
}
|
|
806
|
+
}, 300);
|
|
807
|
+
}).then(() => {
|
|
808
|
+
userAndDeviceStatusInfo.isPushingFlow = true;
|
|
809
|
+
//需要确保处于推流状态才能发送AddStream
|
|
810
|
+
CHANNEL.sendAddStream(initParams);
|
|
811
|
+
}, err => {
|
|
812
|
+
reject(err);
|
|
813
|
+
}).catch(err => {
|
|
814
|
+
console.log(err);
|
|
815
|
+
});
|
|
816
|
+
} else {
|
|
817
|
+
//rtc同屏流不走信道 !1
|
|
818
|
+
if(!idx) {
|
|
819
|
+
CHANNEL.sendAddStream(initParams);
|
|
820
|
+
userAndDeviceStatusInfo.isPushingFlow = true;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
|
|
825
|
+
async stopPushFlow(idx, streamid) {
|
|
826
|
+
defaultApi.writeLog(`sdk action : stopPushFlow streamid:${streamid} idx:${idx}`);
|
|
827
|
+
await zbyAVSDK.stopPushFlow(idx, streamid);
|
|
828
|
+
try {
|
|
829
|
+
streamid && idx ? dataReport.stopPublish({ stop_rtc_streamid: streamid }) : dataReport.stopPublish();
|
|
830
|
+
// dataReport.stopPublish({});
|
|
831
|
+
} catch (error) { };
|
|
832
|
+
if(window.zby_sdk_init_params.isTurnPush) {
|
|
833
|
+
zbyAVSDK.turnPush('stop');
|
|
834
|
+
};
|
|
835
|
+
if(!idx) {
|
|
836
|
+
userAndDeviceStatusInfo.isPushingFlow = false;
|
|
837
|
+
CHANNEL.sendRemoveStream(window.zby_sdk_init_params);
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
|
|
841
|
+
async initPullFlow(args) {
|
|
842
|
+
defaultApi.writeLog(`sdk action : initPullFlow ,${JSON.stringify(args)}`);
|
|
843
|
+
const streamId = args.streamId || generateStreamId(args.userId, args.groupId);
|
|
844
|
+
let {mute, audioOnly} = args;
|
|
845
|
+
let streamType = 'none';
|
|
846
|
+
|
|
847
|
+
if(mute && audioOnly) {
|
|
848
|
+
streamType = 'none';
|
|
849
|
+
} else if (mute && !audioOnly) {
|
|
850
|
+
streamType = 'video';
|
|
851
|
+
} else if (!mute && audioOnly) {
|
|
852
|
+
streamType = 'audio';
|
|
853
|
+
} else {
|
|
854
|
+
streamType = 'both';
|
|
855
|
+
};
|
|
856
|
+
const result = zbyAVSDK.initPullFlow({
|
|
857
|
+
...args,
|
|
858
|
+
streamId
|
|
859
|
+
});
|
|
860
|
+
// defaultApi.writeLog(`sdk action : initPullFlow——result ,${JSON.stringify(result)}`);
|
|
861
|
+
try {
|
|
862
|
+
dataReport.startPull({pull_uid: args.userId || util.getUidByStreamId(streamId), pull_streamid: streamId, stream_type: streamType});
|
|
863
|
+
} catch (e) {};
|
|
864
|
+
const {
|
|
865
|
+
videoSrc,
|
|
866
|
+
playerId
|
|
867
|
+
} = await result.videoSrc;
|
|
868
|
+
defaultApi.writeLog(`sdk initPullFlow ${JSON.stringify(args)}, streamId : ${streamId}, result :${result.sdk_type}: ${videoSrc} type:${streamType} playerId:${playerId}`);
|
|
869
|
+
if (args.needPlayerId) {
|
|
870
|
+
return {
|
|
871
|
+
videoSrc,
|
|
872
|
+
playerId,
|
|
873
|
+
streamId,
|
|
874
|
+
...args
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
return videoSrc;
|
|
878
|
+
},
|
|
879
|
+
|
|
880
|
+
async startPullFlow(userId, groupId) {
|
|
881
|
+
if (typeof userId !== 'number' && typeof userId !== 'string') {
|
|
882
|
+
defaultApi.writeLog(`sdk action : startPullFlow ,userId : ${JSON.stringify(userId)}, param error`);
|
|
883
|
+
return;
|
|
884
|
+
} else {
|
|
885
|
+
defaultApi.writeLog(`sdk action : startPullFlow ,userId : ${JSON.stringify(userId)}, begin`);
|
|
886
|
+
}
|
|
887
|
+
const streamId = generateStreamId(userId, groupId);
|
|
888
|
+
await zbyAVSDK.startPullFlow(streamId);
|
|
889
|
+
// userAndDeviceStatusInfo.ignoreList.delete(userId)
|
|
890
|
+
noticeStreamStatus(userId, 'stream_recover');
|
|
891
|
+
defaultApi.writeLog(`sdk action : startPullFlow ,userId ${userId}, notice: stream_recover`);
|
|
892
|
+
},
|
|
893
|
+
|
|
894
|
+
async stopPullFlow(userId, groupId, recovery, streamid) {
|
|
895
|
+
// const {userId, groupId, recovery, streamid} = args;
|
|
896
|
+
if (typeof userId !== 'number' && typeof userId !== 'string') {
|
|
897
|
+
defaultApi.writeLog(`sdk action : stopPullFlow ,userId : ${userId}, groupId: ${groupId}, param error`);
|
|
898
|
+
return;
|
|
899
|
+
} else {
|
|
900
|
+
defaultApi.writeLog(`sdk action : stopPullFlow ,userId : ${userId}, groupId: ${groupId}, begin`);
|
|
901
|
+
}
|
|
902
|
+
const streamId = streamid || generateStreamId(userId, groupId);
|
|
903
|
+
await zbyAVSDK.stopPullFlow(streamId, recovery);
|
|
904
|
+
try {
|
|
905
|
+
dataReport.stopPull({pull_uid:userId,pull_streamid:streamId});
|
|
906
|
+
} catch (e) {};
|
|
907
|
+
noticeStreamStatus(userId, 'stream_stopped');
|
|
908
|
+
defaultApi.writeLog(`sdk action : stopPullFlow ,userId : ${userId}, groupId: ${groupId}, notice: stream_stopped`);
|
|
909
|
+
},
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* @function 暂停拉所有的流
|
|
913
|
+
* @return Promise | void
|
|
914
|
+
*/
|
|
915
|
+
async stopAllPullFlow() {
|
|
916
|
+
defaultApi.writeLog('sdk action : stopAllPullFlow begin');
|
|
917
|
+
await zbyAVSDK.stopAllPullFlow();
|
|
918
|
+
defaultApi.writeLog('sdk action : stopAllPullFlow end');
|
|
919
|
+
},
|
|
920
|
+
|
|
921
|
+
async playDestroy(userId, groupId) {
|
|
922
|
+
if (typeof userId !== 'number' && typeof userId !== 'string') {
|
|
923
|
+
defaultApi.writeLog(`sdk action : playDestroy ,userId : ${userId}, groupId: ${groupId}, param error`);
|
|
924
|
+
return;
|
|
925
|
+
} else {
|
|
926
|
+
defaultApi.writeLog(`sdk action : playDestroy ,userId : ${userId}, groupId: ${groupId}, begin`);
|
|
927
|
+
}
|
|
928
|
+
const streamId = generateStreamId(userId, groupId);
|
|
929
|
+
await zbyAVSDK.playDestroy(streamId);
|
|
930
|
+
noticeStreamStatus(userId, 'stream_destroy');
|
|
931
|
+
defaultApi.writeLog(`sdk action : playDestroy ,userId : ${userId}, groupId: ${groupId}, notice: stream_destroy`);
|
|
932
|
+
},
|
|
933
|
+
|
|
934
|
+
async changePullFlow(args) {
|
|
935
|
+
defaultApi.writeLog(`sdk action : changePullFlow ,${JSON.stringify(args)}`);
|
|
936
|
+
const streamId = generateStreamId(args.userId, args.groupId);
|
|
937
|
+
const toStreamId = generateStreamId(args.toUserId, args.toGroupId);
|
|
938
|
+
const result = zbyAVSDK.changePullFlow({
|
|
939
|
+
toDomId: args.toDomId,
|
|
940
|
+
streamId,
|
|
941
|
+
toStreamId
|
|
942
|
+
});
|
|
943
|
+
const {
|
|
944
|
+
videoSrc,
|
|
945
|
+
playerId
|
|
946
|
+
} = await result;
|
|
947
|
+
defaultApi.writeLog(`sdk changePullFlow ${JSON.stringify(args)}, streamId : ${streamId}, toStreamId : ${toStreamId}, result :${result.sdk_type}: ${videoSrc}`);
|
|
948
|
+
if (args.needPlayerId) {
|
|
949
|
+
return {
|
|
950
|
+
videoSrc,
|
|
951
|
+
playerId
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
return videoSrc;
|
|
955
|
+
},
|
|
956
|
+
|
|
957
|
+
async getSpeakerDeviceList() {
|
|
958
|
+
defaultApi.writeLog('sdk action : getSpeakerDeviceList');
|
|
959
|
+
return await zbyAVSDK.getSpeakerDeviceList();
|
|
960
|
+
},
|
|
961
|
+
|
|
962
|
+
async setSpeakerDevice(deviceId) {
|
|
963
|
+
defaultApi.writeLog(`sdk action : setSpeakerDevice deviceId:${deviceId}`);
|
|
964
|
+
await zbyAVSDK.setSpeakerDevice(deviceId, 'client');
|
|
965
|
+
},
|
|
966
|
+
|
|
967
|
+
async getSpeakerVolume() {
|
|
968
|
+
defaultApi.writeLog('sdk action : getSpeakerVolume ');
|
|
969
|
+
return await zbyAVSDK.getSpeakerVolume();
|
|
970
|
+
},
|
|
971
|
+
|
|
972
|
+
async setSpeakerVolume(volume) {
|
|
973
|
+
await zbyAVSDK.setSpeakerVolume(volume);
|
|
974
|
+
defaultApi.writeLog(`sdk action : setSpeakerVolume ${volume}`);
|
|
975
|
+
|
|
976
|
+
},
|
|
977
|
+
|
|
978
|
+
async setSpeakerMute(mute) {
|
|
979
|
+
await zbyAVSDK.setSpeakerMute(mute);
|
|
980
|
+
try {
|
|
981
|
+
dataReport.deviceChange({
|
|
982
|
+
device_type: 3,
|
|
983
|
+
code: mute ? 0 :1,
|
|
984
|
+
device_name: window.zbyAVSDK_device_checker_init.speaker.name,
|
|
985
|
+
device_id: window.zbyAVSDK_device_checker_init.speaker.use
|
|
986
|
+
});
|
|
987
|
+
} catch (e){};
|
|
988
|
+
defaultApi.writeLog(`sdk action : setSpeakerMute ${mute}`);
|
|
989
|
+
},
|
|
990
|
+
|
|
991
|
+
async openOrCloseCameraAndMicrophone(type) {
|
|
992
|
+
await zbyAVSDK.openOrCloseCameraAndMicrophone(type);
|
|
993
|
+
defaultApi.writeLog(`sdk action : openOrCloseCameraAndMicrophone ${type}`);
|
|
994
|
+
},
|
|
995
|
+
|
|
996
|
+
async getAppVolume() {
|
|
997
|
+
const volume = await zbyAVSDK.getAppVolume();
|
|
998
|
+
defaultApi.writeLog(`sdk action : getAppVolume ${volume}`);
|
|
999
|
+
return volume;
|
|
1000
|
+
},
|
|
1001
|
+
|
|
1002
|
+
async setAppVolume(volume) {
|
|
1003
|
+
await zbyAVSDK.setAppVolume(volume);
|
|
1004
|
+
defaultApi.writeLog(`sdk action : setAppVolume ${volume}`);
|
|
1005
|
+
|
|
1006
|
+
},
|
|
1007
|
+
|
|
1008
|
+
async setAppMute(mute) {
|
|
1009
|
+
await zbyAVSDK.setAppMute(mute);
|
|
1010
|
+
defaultApi.writeLog(`sdk action : setAppMute ${mute}`);
|
|
1011
|
+
},
|
|
1012
|
+
|
|
1013
|
+
async getMicrophoneDeviceList() {
|
|
1014
|
+
const microPhoneList = await zbyAVSDK.getMicrophoneDeviceList();
|
|
1015
|
+
defaultApi.writeLog(`sdk action : getMicrophoneDeviceList ${JSON.stringify(microPhoneList)}`);
|
|
1016
|
+
return microPhoneList;
|
|
1017
|
+
},
|
|
1018
|
+
|
|
1019
|
+
async setMicrophoneDevice(deviceId) {
|
|
1020
|
+
await zbyAVSDK.setMicrophoneDevice(deviceId, 'client');
|
|
1021
|
+
defaultApi.writeLog(`sdk action : setMicrophoneDevice ${deviceId}`);
|
|
1022
|
+
},
|
|
1023
|
+
|
|
1024
|
+
async openOrCloseMicrophone(operation) {
|
|
1025
|
+
defaultApi.writeLog(`sdk action : openOrCloseMicrophone ${operation} --start`);
|
|
1026
|
+
await zbyAVSDK.openOrCloseMicrophone(operation);
|
|
1027
|
+
try {
|
|
1028
|
+
dataReport.deviceChange({
|
|
1029
|
+
device_type: 2,
|
|
1030
|
+
code: operation ? 1 : 0,
|
|
1031
|
+
device_name: window.zbyAVSDK_device_checker_init.microphone.name,
|
|
1032
|
+
device_id: window.zbyAVSDK_device_checker_init.microphone.use
|
|
1033
|
+
});
|
|
1034
|
+
} catch (e){};
|
|
1035
|
+
userAndDeviceStatusInfo.microPhone = operation;
|
|
1036
|
+
//记录麦克风状态,用作推流类型上报,是否推声音
|
|
1037
|
+
this.deviceStatus.microphone = operation;
|
|
1038
|
+
sdk_status === 1 && sendDeviceStatus('audio', operation);
|
|
1039
|
+
defaultApi.writeLog(`sdk action : openOrCloseMicrophone ${operation} --end`);
|
|
1040
|
+
|
|
1041
|
+
},
|
|
1042
|
+
|
|
1043
|
+
//听或不听指定用户的声音
|
|
1044
|
+
async setAudioMute(userId, operation, groupId, streamid) {
|
|
1045
|
+
const streamId = streamid || generateStreamId(userId, groupId);
|
|
1046
|
+
await zbyAVSDK.setAudioMute(streamId, operation);
|
|
1047
|
+
defaultApi.writeLog(`sdk action : setAudioMute userId ${userId}, operation ${operation}, groupId ${groupId}, streamid ${streamid}`);
|
|
1048
|
+
},
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* @function 是否拉取音频流--通过播放器id控制
|
|
1052
|
+
* @param operation:Boolean,必选,true | false
|
|
1053
|
+
* @param playerId:Number,必选,播放器id
|
|
1054
|
+
* @return Promise | void
|
|
1055
|
+
*/
|
|
1056
|
+
async pullAudioFlow(playerId, operation, streamid) {
|
|
1057
|
+
defaultApi.writeLog(`sdk action : pullAudioFlow --start playerId ${playerId}, ${operation}, streamid ${streamid}`);
|
|
1058
|
+
const streamId = streamid ? streamid : undefined;
|
|
1059
|
+
console.log('pullAudioFlow-streamId',streamId)
|
|
1060
|
+
await zbyAVSDK.pullAudioFlow(playerId, operation, streamId);
|
|
1061
|
+
defaultApi.writeLog(`sdk action : pullAudioFlow playerId ${playerId}, ${operation}`);
|
|
1062
|
+
|
|
1063
|
+
},
|
|
1064
|
+
|
|
1065
|
+
async getMicrophoneVolume() {
|
|
1066
|
+
defaultApi.writeLog('sdk action : getMicrophoneVolume');
|
|
1067
|
+
return await zbyAVSDK.getMicrophoneVolume();
|
|
1068
|
+
},
|
|
1069
|
+
|
|
1070
|
+
async setMicrophoneVolume(volume, mute) {
|
|
1071
|
+
await zbyAVSDK.setMicrophoneVolume(volume, mute);
|
|
1072
|
+
defaultApi.writeLog(`sdk action : setMicrophoneVolume ${volume} ${mute}`);
|
|
1073
|
+
|
|
1074
|
+
},
|
|
1075
|
+
|
|
1076
|
+
async setMicrophoneMute(mute) {
|
|
1077
|
+
await zbyAVSDK.setMicrophoneMute(mute);
|
|
1078
|
+
defaultApi.writeLog(`sdk action : setMicrophoneMute ${mute}`);
|
|
1079
|
+
},
|
|
1080
|
+
|
|
1081
|
+
async leaveRoom() {
|
|
1082
|
+
//未初始化完成,无须卸载
|
|
1083
|
+
// if (sdk_status === -1) {
|
|
1084
|
+
// zbysdk.notice({
|
|
1085
|
+
// type: 'error',
|
|
1086
|
+
// data: {
|
|
1087
|
+
// message: 'should not leaveRoom before init finished'
|
|
1088
|
+
// }
|
|
1089
|
+
// });
|
|
1090
|
+
// return;
|
|
1091
|
+
// }
|
|
1092
|
+
defaultApi.writeLog('sdk action : leaveRoom');
|
|
1093
|
+
// if (window.zby_sdk_init_params.role === 'student') {
|
|
1094
|
+
CHANNEL.sendRemoveStream(window.zby_sdk_init_params);
|
|
1095
|
+
// }
|
|
1096
|
+
CHANNEL.sendLeave(window.zby_sdk_init_params);
|
|
1097
|
+
CHANNEL.leaveRoom();
|
|
1098
|
+
// 重置设备检测初始化状态
|
|
1099
|
+
deviceCheckerInitStatus = -1;
|
|
1100
|
+
await zbyAVSDK.leaveRoom();
|
|
1101
|
+
|
|
1102
|
+
windowObjArr[0].concat(windowObjArr[1]).forEach(item => {
|
|
1103
|
+
localStorage.removeItem(item);
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
sdk_status = -1;
|
|
1107
|
+
try {
|
|
1108
|
+
dataReport.leaveRoom();
|
|
1109
|
+
} catch (e) {};
|
|
1110
|
+
defaultApi.writeLog('sdk leaveRoom end ,sdk status : uninstall_finished');
|
|
1111
|
+
//通知业务层,卸载完成
|
|
1112
|
+
NOTICE.sdkStatus({
|
|
1113
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
1114
|
+
status: 'uninstall_finished'
|
|
1115
|
+
});
|
|
1116
|
+
},
|
|
1117
|
+
|
|
1118
|
+
//崩溃后的销毁引擎,反初始化
|
|
1119
|
+
async deinit() {
|
|
1120
|
+
defaultApi.writeLog('sdk action : deinit');
|
|
1121
|
+
await zbyAVSDK.deinit();
|
|
1122
|
+
},
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* @function 转推,录课
|
|
1126
|
+
* @param type:String 动作类型,必选,'start' | 'stop' | 'pause' | 'resume'
|
|
1127
|
+
* @return Promise | void
|
|
1128
|
+
*/
|
|
1129
|
+
async turnPush(cmd) {
|
|
1130
|
+
await zbyAVSDK.turnPush(cmd);
|
|
1131
|
+
defaultApi.writeLog(`sdk action : turnPush ${cmd}`);
|
|
1132
|
+
},
|
|
1133
|
+
|
|
1134
|
+
openMicVolumeCb(open) {
|
|
1135
|
+
zbyAVSDK.openMicVolumeCb(open);
|
|
1136
|
+
defaultApi.writeLog(`sdk action : openMicVolumeCb ${open}`);
|
|
1137
|
+
},
|
|
1138
|
+
// 开始混流--已废弃
|
|
1139
|
+
startMixtStream(args) {
|
|
1140
|
+
zbyAVSDK.startMixtStream(args);
|
|
1141
|
+
defaultApi.writeLog(`sdk action : startMixtStream, args: ${JSON.stringify(args)}`);
|
|
1142
|
+
},
|
|
1143
|
+
// 结束混流--已废弃
|
|
1144
|
+
stopMixtStream(args) {
|
|
1145
|
+
zbyAVSDK.stopMixtStream(args);
|
|
1146
|
+
defaultApi.writeLog(`sdk action : stopMixtStream, args: ${JSON.stringify(args)}`);
|
|
1147
|
+
},
|
|
1148
|
+
|
|
1149
|
+
mixedstuVideo(stuArray) {
|
|
1150
|
+
zbyAVSDK.mixedstuVideo(stuArray);
|
|
1151
|
+
defaultApi.writeLog(`sdk action : mixedstuVideo, stuArray: ${stuArray}`);
|
|
1152
|
+
},
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* @function 单路流录制
|
|
1156
|
+
* @param args:Object
|
|
1157
|
+
* {
|
|
1158
|
+
* type: String,必选,'start' | 'stop'
|
|
1159
|
+
* groupId: String, 可选,分组id
|
|
1160
|
+
* userId: String, 可选,用户id
|
|
1161
|
+
* }
|
|
1162
|
+
*/
|
|
1163
|
+
singleRecord(args) {
|
|
1164
|
+
args.streamId = this.getStreamInfo(args.userId, args.groupId).streamId;
|
|
1165
|
+
zbyAVSDK.singleRecord(args);
|
|
1166
|
+
defaultApi.writeLog(`sdk action : singleRecord, args: ${JSON.stringify(args)}`);
|
|
1167
|
+
},
|
|
1168
|
+
//开启拉流音量监听
|
|
1169
|
+
startSoundLevelMonitor() {
|
|
1170
|
+
defaultApi.writeLog('sdk action : startSoundLevelMonitor --start');
|
|
1171
|
+
zbyAVSDK.startSoundLevelMonitor();
|
|
1172
|
+
defaultApi.writeLog('sdk action : startSoundLevelMonitor --end');
|
|
1173
|
+
},
|
|
1174
|
+
/**
|
|
1175
|
+
* @function 多路转推
|
|
1176
|
+
* @param args:Object
|
|
1177
|
+
* {
|
|
1178
|
+
* type: String,必选,'start' | 'stop'
|
|
1179
|
+
* groupId: String, 可选,分组id
|
|
1180
|
+
* userId: String, 可选,用户id
|
|
1181
|
+
* }
|
|
1182
|
+
*/
|
|
1183
|
+
async recordPublish(args) {
|
|
1184
|
+
args.streamId = this.getStreamInfo(args.userId, args.groupId).streamId;
|
|
1185
|
+
zbyAVSDK.recordPublishTarget(args);
|
|
1186
|
+
defaultApi.writeLog(`sdk action : recordPublish, args: ${JSON.stringify(args)}`);
|
|
1187
|
+
},
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* @function 获取视频快照截图所需的 id 数据
|
|
1191
|
+
* @param userId:String 用户 ID
|
|
1192
|
+
* @param roomId:String 房间 ID
|
|
1193
|
+
*/
|
|
1194
|
+
getStreamInfo(userId, roomId) {
|
|
1195
|
+
const streamId = generateStreamId(userId, roomId);
|
|
1196
|
+
defaultApi.writeLog(`sdk action :getStreamInfo --start, userId : ${userId}, roomId: ${roomId}`);
|
|
1197
|
+
if (!userId || userId == window.zby_sdk_init_params.userId) {
|
|
1198
|
+
console.log('getStreamInfo',userId,streamId);
|
|
1199
|
+
switch (window.current_sdk_type) {
|
|
1200
|
+
case 'rtc':
|
|
1201
|
+
try{
|
|
1202
|
+
dataReport.takeSnapShot({snapshootId:streamId});
|
|
1203
|
+
}catch(e){}
|
|
1204
|
+
return {
|
|
1205
|
+
streamId,
|
|
1206
|
+
snapshootId: streamId
|
|
1207
|
+
};
|
|
1208
|
+
break;
|
|
1209
|
+
case 'zego':
|
|
1210
|
+
try{
|
|
1211
|
+
dataReport.takeSnapShot({getStreamInfoZego:streamId,snapshootId:-1});
|
|
1212
|
+
}catch(e){}
|
|
1213
|
+
return {
|
|
1214
|
+
streamId,
|
|
1215
|
+
snapshootId: -1
|
|
1216
|
+
};
|
|
1217
|
+
break;
|
|
1218
|
+
case 'talrtc':
|
|
1219
|
+
try {
|
|
1220
|
+
dataReport.takeSnapShot({snapshootId:streamId});
|
|
1221
|
+
} catch (e) {}
|
|
1222
|
+
return {
|
|
1223
|
+
streamId,
|
|
1224
|
+
snapshootId: -2
|
|
1225
|
+
};
|
|
1226
|
+
case 'trtc':
|
|
1227
|
+
try {
|
|
1228
|
+
console.log('拍照上墙trtc',streamId)
|
|
1229
|
+
dataReport.takeSnapShot({snapshootId:streamId});
|
|
1230
|
+
} catch (e) {}
|
|
1231
|
+
return {
|
|
1232
|
+
streamId,
|
|
1233
|
+
snapshootId: -3
|
|
1234
|
+
};
|
|
1235
|
+
default:
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
let snapshootId = zbyAVSDK.getSnapshootId(streamId);
|
|
1240
|
+
defaultApi.writeLog(`sdk action :getStreamInfo, userId : ${userId}, snapshootId: ${snapshootId}`);
|
|
1241
|
+
return {
|
|
1242
|
+
streamId,
|
|
1243
|
+
snapshootId
|
|
1244
|
+
};
|
|
1245
|
+
},
|
|
1246
|
+
|
|
1247
|
+
getAllChannelIndex() {
|
|
1248
|
+
let channelMap = zbyAVSDK.getAllChannelIndex();
|
|
1249
|
+
return channelMap;
|
|
1250
|
+
},
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* @function 记录日志
|
|
1254
|
+
* @param productName:String 产品名称,必选
|
|
1255
|
+
* @param type:String 日志类型,可选,default : 'info', 'debug' | 'info' | 'warnning' | 'error' | 'critical',
|
|
1256
|
+
* @param content:String | Object 日志记录主要内容
|
|
1257
|
+
*/
|
|
1258
|
+
log(productName, content, type = 'info') {
|
|
1259
|
+
if (!productName) {
|
|
1260
|
+
defaultApi.writeLog('sdk action :log methods invoked error, no productName');
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
defaultApi.writeLog(content, productName, type);
|
|
1264
|
+
},
|
|
1265
|
+
/**
|
|
1266
|
+
* @function 设置摄像头参数
|
|
1267
|
+
* @param width:Number 分辨率宽,必选,推荐 1280
|
|
1268
|
+
* @param height:Number 分辨率高,必选,推荐 720
|
|
1269
|
+
* @param frameRate:Number 帧率,必选,推荐 15
|
|
1270
|
+
* @return Promise | void
|
|
1271
|
+
*/
|
|
1272
|
+
setCameraParams(args) {
|
|
1273
|
+
defaultApi.writeLog(`sdk action: setCameraParam, args: ${JSON.stringify(args)}`);
|
|
1274
|
+
return zbyAVSDK.setCameraParams(args);
|
|
1275
|
+
},
|
|
1276
|
+
|
|
1277
|
+
setEncodeParams(args) {
|
|
1278
|
+
defaultApi.writeLog(`sdk action: setEncodeParams, args: ${JSON.stringify(args)}`);
|
|
1279
|
+
return zbyAVSDK.setEncodeParams(args);
|
|
1280
|
+
},
|
|
1281
|
+
|
|
1282
|
+
setBitRate(bitrate) {
|
|
1283
|
+
defaultApi.writeLog(`sdk action: setBitRate, bitrate: ${bitrate}`);
|
|
1284
|
+
return zbyAVSDK.setBitRate(bitrate);
|
|
1285
|
+
},
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* @function 本地视频录制
|
|
1289
|
+
* @param type 开始/结束
|
|
1290
|
+
* @param path 录制路径
|
|
1291
|
+
* @return Promise | void
|
|
1292
|
+
*/
|
|
1293
|
+
localRecordVideo(type, path) {
|
|
1294
|
+
defaultApi.writeLog(`sdk action: localRecordVideo, type: ${type}, path ${path}`);
|
|
1295
|
+
return zbyAVSDK.localRecordVideo(type, path);
|
|
1296
|
+
},
|
|
1297
|
+
/**
|
|
1298
|
+
* @function 本地音频录制
|
|
1299
|
+
* @param type 开始/结束
|
|
1300
|
+
* @param path 录制路径
|
|
1301
|
+
* @return Promise | void
|
|
1302
|
+
*/
|
|
1303
|
+
localRecordAudio(type, path) {
|
|
1304
|
+
defaultApi.writeLog(`sdk action: localRecordAudio, type: ${type}, path ${path}`);
|
|
1305
|
+
return zbyAVSDK.localRecordAudio(type, path);
|
|
1306
|
+
},
|
|
1307
|
+
/**
|
|
1308
|
+
* @function 开始连麦
|
|
1309
|
+
* @param mode:number 采集器默认, 默认0=站立 1=坐立
|
|
1310
|
+
* @return Promise | void
|
|
1311
|
+
*/
|
|
1312
|
+
async teacherStartLinkMic(mode) {
|
|
1313
|
+
defaultApi.writeLog(`sdk action: teacherStartLinkMic, mode: ${mode}`);
|
|
1314
|
+
try {
|
|
1315
|
+
dataReport.avConnect({
|
|
1316
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
1317
|
+
type: 1,
|
|
1318
|
+
mode
|
|
1319
|
+
});
|
|
1320
|
+
} catch (e) {};
|
|
1321
|
+
await zbyAVSDK.teacherStartLinkMic(mode);
|
|
1322
|
+
if (mode === 0) {
|
|
1323
|
+
await zbyAVSDK.startPreview();
|
|
1324
|
+
}
|
|
1325
|
+
return this.startPushFlow();
|
|
1326
|
+
},
|
|
1327
|
+
/**
|
|
1328
|
+
* @function 结束连麦
|
|
1329
|
+
* @param mode:number 采集器默认, 默认0=站立 1=坐立
|
|
1330
|
+
* @return Promise | void
|
|
1331
|
+
*/
|
|
1332
|
+
async teacherStopLinkMic(mode) {
|
|
1333
|
+
defaultApi.writeLog(`sdk action: teacherStopLinkMic, mode: ${mode}`);
|
|
1334
|
+
try {
|
|
1335
|
+
dataReport.avConnect({
|
|
1336
|
+
sdk_type: window.zbyAVSDK_init_sdk_type,
|
|
1337
|
+
type: 0,
|
|
1338
|
+
mode
|
|
1339
|
+
});
|
|
1340
|
+
} catch (e) {};
|
|
1341
|
+
await zbyAVSDK.teacherStopLinkMic(mode);
|
|
1342
|
+
if (mode === 0) {
|
|
1343
|
+
await zbyAVSDK.stopPreview();
|
|
1344
|
+
}
|
|
1345
|
+
return this.stopPushFlow();
|
|
1346
|
+
},
|
|
1347
|
+
getSdkStatus() {
|
|
1348
|
+
return sdk_status;
|
|
1349
|
+
},
|
|
1350
|
+
// 获取截屏窗位置
|
|
1351
|
+
//设置采集扬声器声音
|
|
1352
|
+
setSpeakerCapture(deviceId, speaker){
|
|
1353
|
+
defaultApi.writeLog(`sdk action: setSpeakerCapture, deviceId: ${deviceId}, speaker: ${speaker}`);
|
|
1354
|
+
return zbyAVSDK.setSpeakerCapture(deviceId, speaker);
|
|
1355
|
+
},
|
|
1356
|
+
/**
|
|
1357
|
+
* @function 设置混流和背景色
|
|
1358
|
+
* @param { number } type 0=不拼接/1=截屏窗+背景图/2=截屏窗+背景图+头像
|
|
1359
|
+
* @param { number } id 需要混合的采集器id
|
|
1360
|
+
* @param { object } rgb
|
|
1361
|
+
* @param { number } rgb.r
|
|
1362
|
+
* @param { number } rgb.g
|
|
1363
|
+
* @param { number } rgb.b
|
|
1364
|
+
* @return: Promise
|
|
1365
|
+
*/
|
|
1366
|
+
setMixStream(type, id, rgb) {
|
|
1367
|
+
defaultApi.writeLog(`sdk action: setMixStream, type: ${type}, id: ${id}, rgb: ${JSON.stringify(rgb)}`);
|
|
1368
|
+
return zbyAVSDK.setMixStream(type, id, rgb);
|
|
1369
|
+
},
|
|
1370
|
+
/**
|
|
1371
|
+
* @function 采集器截图
|
|
1372
|
+
* @param { string } fileName 文件名,需要后缀名。例如:333.jpg
|
|
1373
|
+
* @return: Promise
|
|
1374
|
+
*/
|
|
1375
|
+
captureSnapShot(fileName) {
|
|
1376
|
+
defaultApi.writeLog(`sdk action: captureSnapShot, fileName: ${fileName}`);
|
|
1377
|
+
return zbyAVSDK.captureSnapShot(fileName);
|
|
1378
|
+
},
|
|
1379
|
+
/**
|
|
1380
|
+
* @function 播放器截图
|
|
1381
|
+
* @param { number } id 播放器id
|
|
1382
|
+
* @param { string } fileName 文件名,需要后缀名。例如:333.jpg
|
|
1383
|
+
* @return: Promise
|
|
1384
|
+
*/
|
|
1385
|
+
playerSnapShot(id, fileName) {
|
|
1386
|
+
defaultApi.writeLog(`sdk action: playerSnapShot, id: ${id} fileName: ${fileName}`);
|
|
1387
|
+
return zbyAVSDK.playerSnapShot(id, fileName);
|
|
1388
|
+
},
|
|
1389
|
+
/**
|
|
1390
|
+
* @function 保存图片至桌面
|
|
1391
|
+
* @param { string } buf //base64编码图片数据
|
|
1392
|
+
* @param { string } fileName //图片文件名(带格式后缀)
|
|
1393
|
+
* @return: Promise
|
|
1394
|
+
*/
|
|
1395
|
+
saveImgToDesktop(buf, fileName) {
|
|
1396
|
+
defaultApi.writeLog(`sdk action: saveImgToDesktop, buf: ${buf} fileName: ${fileName}`);
|
|
1397
|
+
return toolBaseApi.saveImgToDesktop(buf, fileName);
|
|
1398
|
+
},
|
|
1399
|
+
//获取设备状态
|
|
1400
|
+
async getDevicePermissions(devicename, devicetype) {
|
|
1401
|
+
defaultApi.writeLog(`sdk action : getDevicePermissions devicename: ${devicename} devicetype: ${devicetype}`);
|
|
1402
|
+
try {
|
|
1403
|
+
let res =await getDevicePermissionsFun(devicename, devicetype);
|
|
1404
|
+
return res;
|
|
1405
|
+
} catch (error){};
|
|
1406
|
+
return 'error';
|
|
1407
|
+
},
|
|
1408
|
+
|
|
1409
|
+
//打开摄像头&麦克风权限(需要关端重启)
|
|
1410
|
+
async setMediaPermission(caremaPermission,microPhonePermission) {
|
|
1411
|
+
defaultApi.writeLog(`sdk action : setMediaPermission caremaPermission: ${caremaPermission} microPhonePermission: ${microPhonePermission}`);
|
|
1412
|
+
return setMediaPermissionFun(caremaPermission,microPhonePermission);
|
|
1413
|
+
},
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* @function 设置预览镜像状态
|
|
1417
|
+
* @param { boolean } type true=开启 false=关闭
|
|
1418
|
+
* @return: Promise
|
|
1419
|
+
*/
|
|
1420
|
+
setMirrorStatus(type) {
|
|
1421
|
+
defaultApi.writeLog(`sdk action: setMirrorStatus, type: ${type}`);
|
|
1422
|
+
return zbyAVSDK.setMirrorStatus(type);
|
|
1423
|
+
},
|
|
1424
|
+
/**
|
|
1425
|
+
* @function 设置拉流镜像状态
|
|
1426
|
+
* @param { boolean } type true=开启 false=关闭
|
|
1427
|
+
* @return: Promise
|
|
1428
|
+
*/
|
|
1429
|
+
setPlayViewMirror(type, id) {
|
|
1430
|
+
defaultApi.writeLog(`sdk action: setPlayViewMirror, type: ${type}, id: ${id}`);
|
|
1431
|
+
return zbyAVSDK.setPlayViewMirror(type, id);
|
|
1432
|
+
},
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* @function 设置推流镜像状态
|
|
1436
|
+
* @param { boolean } id 采集器Id
|
|
1437
|
+
* @param { boolean } mode 1=开启 0=关闭
|
|
1438
|
+
* @return: Promise
|
|
1439
|
+
*/
|
|
1440
|
+
setPushViewMirror(mode) {
|
|
1441
|
+
defaultApi.writeLog(`sdk action: setPushViewMirror, mode: ${mode}`);
|
|
1442
|
+
return zbyAVSDK.setPushViewMirror(mode);
|
|
1443
|
+
},
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* @function 开启美颜
|
|
1447
|
+
* @return: Promise
|
|
1448
|
+
*/
|
|
1449
|
+
startSenseMe() {
|
|
1450
|
+
defaultApi.writeLog('sdk action: startSenseMe');
|
|
1451
|
+
return zbyAVSDK.startSenseMe();
|
|
1452
|
+
},
|
|
1453
|
+
/**
|
|
1454
|
+
* @function 设置美颜参数
|
|
1455
|
+
* * @param { number } type //美颜类型,1、红润强度,3、磨皮强度,4、美白强度,5、大眼,6、瘦脸,7、小脸,8、对比度强度,9、饱和度强度
|
|
1456
|
+
* * @param { number } value //美颜数值,有效值范围0~100
|
|
1457
|
+
* @return: Promise
|
|
1458
|
+
*/
|
|
1459
|
+
setBeautifyParam(type, value) {
|
|
1460
|
+
defaultApi.writeLog(`sdk action: setBeautifyParam, type: ${type},value: ${value}`);
|
|
1461
|
+
return zbyAVSDK.setBeautifyParam(type, value);
|
|
1462
|
+
},
|
|
1463
|
+
/**
|
|
1464
|
+
* @function 关闭美颜
|
|
1465
|
+
* @return: Promise
|
|
1466
|
+
*/
|
|
1467
|
+
endSenseMe() {
|
|
1468
|
+
defaultApi.writeLog('sdk action: endSenseMe');
|
|
1469
|
+
return zbyAVSDK.endSenseMe();
|
|
1470
|
+
},
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* @function zego40路拉流混音接口
|
|
1474
|
+
* @param { number } mixMode //混流模式 0=关闭混流 1=开启混流
|
|
1475
|
+
* @param { array } userIdArr //要突出声音的userId的数组集合
|
|
1476
|
+
* @return: Promise
|
|
1477
|
+
*/
|
|
1478
|
+
setAudioMixMode(mixMode, userIdArr) {
|
|
1479
|
+
let streamIdArr = [];
|
|
1480
|
+
if(userIdArr.length > 0) {
|
|
1481
|
+
userIdArr.forEach(item => {
|
|
1482
|
+
streamIdArr.push(generateStreamId(item));
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
defaultApi.writeLog(`sdk action: setAudioMixMode mixMode:${mixMode} userIdArr:${userIdArr} streamIdArr:${streamIdArr}`);
|
|
1486
|
+
return zbyAVSDK.setAudioMixMode(mixMode, streamIdArr);
|
|
1487
|
+
},
|
|
1488
|
+
|
|
1489
|
+
//获取TalMedia.dll版本号&&获取zegoAvkit.dll版本号
|
|
1490
|
+
getSDKVersion() {
|
|
1491
|
+
defaultApi.writeLog('sdk action: getSDKVersion');
|
|
1492
|
+
return zbyAVSDK.getSDKVersion();
|
|
1493
|
+
},
|
|
1494
|
+
|
|
1495
|
+
//获取摄像头所支持的分辨率
|
|
1496
|
+
getCameraSupportedResolution(deviceId) {
|
|
1497
|
+
defaultApi.writeLog(`sdk action: getCameraSupportedResolution deviceId: ${deviceId}`);
|
|
1498
|
+
return zbyAVSDK.getCameraSupportedResolution(deviceId);
|
|
1499
|
+
},
|
|
1500
|
+
//开启rtc同屏
|
|
1501
|
+
startMultiScreen() {
|
|
1502
|
+
defaultApi.writeLog('sdk action: startMultiScreen');
|
|
1503
|
+
return zbyAVSDK.startMultiScreen();
|
|
1504
|
+
},
|
|
1505
|
+
//开启高光时刻
|
|
1506
|
+
startHighlight(enable) {
|
|
1507
|
+
defaultApi.writeLog(`sdk action: startHighlight enable:${enable}`);
|
|
1508
|
+
return zbyAVSDK.enableHighlight(enable);
|
|
1509
|
+
},
|
|
1510
|
+
//开启外部音频采集
|
|
1511
|
+
startAudioExCapture() {
|
|
1512
|
+
defaultApi.writeLog('sdk action: startAudioExCapture');
|
|
1513
|
+
return zbyAVSDK.startAudioExCapture();
|
|
1514
|
+
},
|
|
1515
|
+
|
|
1516
|
+
//RTC同屏 辅助通道音频类型
|
|
1517
|
+
setAUXAudioType(type) {
|
|
1518
|
+
defaultApi.writeLog('sdk action: setAUXAudioType');
|
|
1519
|
+
return zbyAVSDK.setAUXAudioType(type);
|
|
1520
|
+
},
|
|
1521
|
+
|
|
1522
|
+
//发送sei
|
|
1523
|
+
sendMediaSideInfo(info) {
|
|
1524
|
+
defaultApi.writeLog('sdk action: sendMediaSideInfo');
|
|
1525
|
+
return zbyAVSDK.sendMediaSideInfo(info);
|
|
1526
|
+
},
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* @function 切换sdk类型
|
|
1530
|
+
* @return: Promise
|
|
1531
|
+
*/
|
|
1532
|
+
// async changeSdkType(institutionId, sdkName, roomId) {
|
|
1533
|
+
// defaultApi.writeLog(`sdk action: changeSdkType, institutionId: ${institutionId}, sdkName: ${sdkName}, roomId: ${roomId}`);
|
|
1534
|
+
// let code;
|
|
1535
|
+
// let param = {
|
|
1536
|
+
// institutionId,
|
|
1537
|
+
// sdkName,
|
|
1538
|
+
// roomId,
|
|
1539
|
+
// workCode:0
|
|
1540
|
+
// };
|
|
1541
|
+
// let res = await changeSdkInRoom(param);
|
|
1542
|
+
// defaultApi.writeLog(`sdk action: changeSdkType, sdk切换${res.code == 0 ? '成功' : '失败'}, ${JSON.stringify(res)}`);
|
|
1543
|
+
// code = res.code == 0 ? 0 : 1; //0切换成功 ,1切换失败
|
|
1544
|
+
// return code ;
|
|
1545
|
+
// },
|
|
1546
|
+
async changeSdkType(institutionId, sdkName, teacherId, liveId) {
|
|
1547
|
+
defaultApi.writeLog(`sdk action: changeSdkType, institutionId: ${institutionId}, sdkName: ${sdkName}, teacherId: ${teacherId}, liveId: ${liveId}`);
|
|
1548
|
+
let code;
|
|
1549
|
+
let param = {
|
|
1550
|
+
institutionId,
|
|
1551
|
+
sdkName,
|
|
1552
|
+
lectureStreamId:`lecturer_${teacherId}_${liveId}`,
|
|
1553
|
+
workCode:0
|
|
1554
|
+
};
|
|
1555
|
+
let res = await changeSdkInRoom(param);
|
|
1556
|
+
defaultApi.writeLog(`sdk action: changeSdkType, sdk切换${res.code == 0 ? '成功' : '失败'}, ${JSON.stringify(res)}`);
|
|
1557
|
+
code = res.code == 0 ? 0 : 1; //0切换成功 ,1切换失败
|
|
1558
|
+
return code ;
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
window.zbysdk = zbysdk;
|
|
1563
|
+
|
|
1564
|
+
export default zbysdk;
|