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.
Files changed (51) hide show
  1. package/.babelrc +5 -5
  2. package/.editorconfig +13 -13
  3. package/.eslintrc.js +29 -29
  4. package/CHANGELOG.md +419 -377
  5. package/README.md +276 -276
  6. package/dist/zby-live-sdk.cjs.js +3 -4
  7. package/dist/zby-live-sdk.esm.js +3 -4
  8. package/dist/zby-live-sdk.umd.js +3 -4
  9. package/package.json +1 -1
  10. package/src/channel/getSendMsgParams.js +66 -66
  11. package/src/channel/index.js +138 -138
  12. package/src/channel/pomelo/index.js +184 -184
  13. package/src/channel/pomelo/latestQueue.js +151 -151
  14. package/src/channel/pomelo/polemo.js +749 -749
  15. package/src/channel/pomelo/util.js +54 -54
  16. package/src/channel/sdk-cb.js +73 -73
  17. package/src/channel/stream-msg.js +97 -97
  18. package/src/channel/zby/index.js +74 -74
  19. package/src/channel/zby/interactWithChannel.js +4 -4
  20. package/src/channel/zby/interactWithChannelControl.js +1568 -1568
  21. package/src/channel/zby/interactWithChannelEntry.js +318 -318
  22. package/src/config/config.js +153 -153
  23. package/src/default/base.js +70 -70
  24. package/src/default/extend.js +36 -36
  25. package/src/default/index.js +9 -9
  26. package/src/live/base.js +42 -42
  27. package/src/live/call-method.js +9 -9
  28. package/src/live/extend.js +53 -53
  29. package/src/live/index.js +9 -9
  30. package/src/network/api.js +50 -50
  31. package/src/network/commonFetch.js +66 -66
  32. package/src/network/dataReport.js +429 -429
  33. package/src/notice.js +400 -394
  34. package/src/tool/base.js +74 -74
  35. package/src/tool/call-method.js +9 -9
  36. package/src/tool/extend.js +42 -42
  37. package/src/tool/index.js +9 -9
  38. package/src/util/bridge.js +87 -87
  39. package/src/util/bridge1.js +46 -46
  40. package/src/util/dict.js +51 -51
  41. package/src/util/sessionStorage.js +29 -29
  42. package/src/util/sha256.js +482 -482
  43. package/src/util/util.js +308 -308
  44. package/src/zby-av-sdk/agora-sdk.js +711 -711
  45. package/src/zby-av-sdk/device.js +145 -145
  46. package/src/zby-av-sdk/rtc-sdk.js +2845 -2839
  47. package/src/zby-av-sdk/talrtc-sdk.js +2394 -2392
  48. package/src/zby-av-sdk/trtc-sdk.js +1801 -1801
  49. package/src/zby-av-sdk/zby-av-sdk.js +1901 -1891
  50. package/src/zby-av-sdk/zego-sdk.js +3002 -2987
  51. package/src/zby-live-sdk.js +1564 -1561
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zby-live-sdk",
3
- "version": "1.0.49-beta-talrtc1014",
3
+ "version": "1.0.49-beta-1222-1",
4
4
  "main": "dist/zby-live-sdk.cjs.js",
5
5
  "module": "dist/zby-live-sdk.esm.js",
6
6
  "browsers": "dist/zby-live-sdk.umd.js",
@@ -1,66 +1,66 @@
1
- import util from '../util/util';
2
-
3
- function getParams(baseInfo) {
4
- const {userId, target, userName, role, roomId, institutionId} = baseInfo;
5
- return {
6
- appId: institutionId,
7
- actorId: userId,
8
- actorName: userName,
9
- actorType: role,
10
- roomId,
11
- streamUrl: util.getStreamId(baseInfo),
12
- streamService: window.zbyAVSDK_init_sdk_type,
13
- version: 1,
14
- target
15
- };
16
- };
17
-
18
- export default {
19
- sendJoinAck(baseInfo) {
20
- const data = {
21
- 'api':'joinAck',
22
- ...getParams(baseInfo)
23
- };
24
- //无target代表广播消息,target代表有定向发送消息
25
- return data;
26
- },
27
- sendAddStream(baseInfo) {
28
- const data = {
29
- 'api': 'addStream',
30
- 'playMode': '2', //播放流的模式,1全屏播放,2在其视频区正常播放3.只播放音频不播放视频
31
- ...getParams(baseInfo)
32
- };
33
- return data;
34
- },
35
- sendUpdateStreamDeviceStatus(baseInfo) {
36
- const {deviceType, deviceStatus} = baseInfo;
37
- const data ={
38
- 'api':'updateStreamDeviceStatus',
39
- 'streamType': deviceType, // string 流设备对应类型:1:视频 2:音频 3:音视频 4:截屏 5:截屏+视频 6:截屏+音频
40
- 'status': deviceStatus, // string 流设备状态 1开启 2关闭 3未找到
41
- ...getParams(baseInfo)
42
- };
43
- return data;
44
- },
45
- sendRemoveStream(baseInfo) {
46
- let data = {
47
- 'api':'removeStream',
48
- ...getParams(baseInfo)
49
- };
50
- return data;
51
- },
52
- sendJoin(baseInfo) {
53
- const data = {
54
- 'api':'join',
55
- ...getParams(baseInfo)
56
- };
57
- return data;
58
- },
59
- sendLeave(baseInfo) {
60
- const data = {
61
- 'api':'leave',
62
- ...getParams(baseInfo)
63
- };
64
- return data;
65
- }
66
- };
1
+ import util from '../util/util';
2
+
3
+ function getParams(baseInfo) {
4
+ const {userId, target, userName, role, roomId, institutionId} = baseInfo;
5
+ return {
6
+ appId: institutionId,
7
+ actorId: userId,
8
+ actorName: userName,
9
+ actorType: role,
10
+ roomId,
11
+ streamUrl: util.getStreamId(baseInfo),
12
+ streamService: window.zbyAVSDK_init_sdk_type,
13
+ version: 1,
14
+ target
15
+ };
16
+ };
17
+
18
+ export default {
19
+ sendJoinAck(baseInfo) {
20
+ const data = {
21
+ 'api':'joinAck',
22
+ ...getParams(baseInfo)
23
+ };
24
+ //无target代表广播消息,target代表有定向发送消息
25
+ return data;
26
+ },
27
+ sendAddStream(baseInfo) {
28
+ const data = {
29
+ 'api': 'addStream',
30
+ 'playMode': '2', //播放流的模式,1全屏播放,2在其视频区正常播放3.只播放音频不播放视频
31
+ ...getParams(baseInfo)
32
+ };
33
+ return data;
34
+ },
35
+ sendUpdateStreamDeviceStatus(baseInfo) {
36
+ const {deviceType, deviceStatus} = baseInfo;
37
+ const data ={
38
+ 'api':'updateStreamDeviceStatus',
39
+ 'streamType': deviceType, // string 流设备对应类型:1:视频 2:音频 3:音视频 4:截屏 5:截屏+视频 6:截屏+音频
40
+ 'status': deviceStatus, // string 流设备状态 1开启 2关闭 3未找到
41
+ ...getParams(baseInfo)
42
+ };
43
+ return data;
44
+ },
45
+ sendRemoveStream(baseInfo) {
46
+ let data = {
47
+ 'api':'removeStream',
48
+ ...getParams(baseInfo)
49
+ };
50
+ return data;
51
+ },
52
+ sendJoin(baseInfo) {
53
+ const data = {
54
+ 'api':'join',
55
+ ...getParams(baseInfo)
56
+ };
57
+ return data;
58
+ },
59
+ sendLeave(baseInfo) {
60
+ const data = {
61
+ 'api':'leave',
62
+ ...getParams(baseInfo)
63
+ };
64
+ return data;
65
+ }
66
+ };
@@ -1,138 +1,138 @@
1
- import zbyChannelObj from './zby';
2
- import pomeloChannelObj from './pomelo';
3
- import getSendMsgParams from './getSendMsgParams';
4
- import dict from '../util/dict';
5
- import defaultApi from '../default';
6
- import {
7
- userAndDeviceStatusInfo
8
- } from '../zby-live-sdk.js';
9
- import {
10
- getCloudData
11
- } from '../network/api';
12
- import zbysdk from '../zby-live-sdk';
13
-
14
- const channelObjs = {
15
- 1: zbyChannelObj,
16
- 2: pomeloChannelObj
17
- };
18
-
19
- let channelObj = null;
20
-
21
- class ChannelClient {
22
- constructor() {
23
- this.initParams = null;
24
- }
25
- // 加入房间
26
- /**
27
- *
28
- * @param {object} params
29
- * @param {string} params.userId 用户id
30
- * @param {string} params.roomId 房间id
31
- * @param {string} params.host 信道链接地址
32
- * @param {string} params.userName 用户名
33
- * @param {string} params.role 角色 teacher/student/assitant
34
- * @param {string} params.institutionId 机构
35
- * @param {function} cb 回调函数
36
- * @param {number} channelType 信道类型 1=直播云信道 2=pomelo
37
- */
38
- async joinRoom(params, cb, channelType = 1) {
39
- // 设置初始化参数
40
- this.initParams = params;
41
- // 设置当前信道对象,使用直播云还是pomelo
42
- channelObj = channelObjs[channelType];
43
- defaultApi.writeLog('channel_log : choose channel and start joining ......');
44
- // 加入房间
45
- channelObj.joinRoom(params, cb);
46
- this.sendJoin(params);
47
- }
48
- // 离开房间
49
- async leaveRoom() {
50
- if (!channelObj) {
51
- console.log('channel has not init');
52
- defaultApi.writeLog('channel has not init');
53
- return;
54
- }
55
- // 离开房间
56
- channelObj.leaveRoom();
57
- }
58
- // 发送信道消息
59
- sendChannelMsg(msg) {
60
- if (!channelObj) {
61
- console.log('channel has not init');
62
- defaultApi.writeLog('channel has not init');
63
- return;
64
- }
65
- channelObj.sendChannelMsg(msg);
66
- }
67
- // 发送进房消息,是自己加入房间群发的消息
68
- sendJoin(args) {
69
- this.sendChannelMsg(getSendMsgParams.sendJoin(args));
70
- }
71
- // 发送离开房间消息,是收到别人进入房间然后定向发的消息
72
- sendLeave(args) {
73
- this.sendChannelMsg(getSendMsgParams.sendLeave(args));
74
- }
75
- // 发送进房ack消息
76
- sendJoinAck(args) {
77
- this.sendChannelMsg(getSendMsgParams.sendJoinAck(args));
78
- }
79
- // 发送推流消息,addstream自己推流成功会发,如果有个人进来你会单独给他发,没有ack
80
- sendAddStream(args) {
81
- this.sendChannelMsg(getSendMsgParams.sendAddStream(args));
82
- }
83
- // 发送设备状态更新消息
84
- sendUpdateStreamDeviceStatus(args) {
85
- this.sendChannelMsg(getSendMsgParams.sendUpdateStreamDeviceStatus(args));
86
- }
87
- // 发送停止推流消息
88
- sendRemoveStream(args) {
89
- this.sendChannelMsg(getSendMsgParams.sendRemoveStream(args));
90
- }
91
- //断线重连时,加入小组
92
- async reJoin() {
93
- //获取当前小组sdk类型
94
- const cloudResponse = await getCloudData(window.zby_sdk_req_get_cloud_params);
95
- const new_target_sdk_type = cloudResponse.data.sdkName;
96
-
97
- if (window.target_sdk_type) {
98
- //正在切换中,等待切换
99
- defaultApi.writeLog('reJoin changing -- wait_changed');
100
- return;
101
- } else if (!window.target_sdk_type && window.current_sdk_type !== new_target_sdk_type) {
102
- //未在切换中,且当前SDK类型和小组不一致:进行切换SDK
103
- console.log('info', `断线重连,准备执行切换 SDK to ${new_target_sdk_type}`);
104
- defaultApi.writeLog(`reJoin : 断线重连,准备执行切换 SDK to ${new_target_sdk_type}`);
105
- zbysdk.changeSDK(1);
106
- } else {
107
- const {roomId, userId, userName, institutionId, role} = this.initParams;
108
- //一致:重进
109
- defaultApi.writeLog('reJoin : SDK一致, 重进');
110
- const baseInfo = {
111
- roomId,
112
- userId,
113
- userName,
114
- institutionId,
115
- role
116
- };
117
- this.sendJoin(baseInfo);
118
- this.sendAddStream(baseInfo);
119
- this.sendUpdateStreamDeviceStatus(Object.assign({}, baseInfo, {
120
- deviceType: dict.getDeviceTypeKey('video'),
121
- deviceStatus: dict.getDeviceStatusKey(userAndDeviceStatusInfo && userAndDeviceStatusInfo.camera ? 'open' : 'closed'),
122
- }));
123
- this.sendUpdateStreamDeviceStatus(Object.assign({}, baseInfo, {
124
- deviceType: dict.getDeviceTypeKey('audio'),
125
- deviceStatus: dict.getDeviceStatusKey(userAndDeviceStatusInfo && userAndDeviceStatusInfo.microPhone ? 'open' : 'closed'),
126
- }));
127
- }
128
- }
129
- }
130
-
131
- const channelClient = new ChannelClient();
132
-
133
-
134
-
135
-
136
-
137
- export default channelClient;
138
-
1
+ import zbyChannelObj from './zby';
2
+ import pomeloChannelObj from './pomelo';
3
+ import getSendMsgParams from './getSendMsgParams';
4
+ import dict from '../util/dict';
5
+ import defaultApi from '../default';
6
+ import {
7
+ userAndDeviceStatusInfo
8
+ } from '../zby-live-sdk.js';
9
+ import {
10
+ getCloudData
11
+ } from '../network/api';
12
+ import zbysdk from '../zby-live-sdk';
13
+
14
+ const channelObjs = {
15
+ 1: zbyChannelObj,
16
+ 2: pomeloChannelObj
17
+ };
18
+
19
+ let channelObj = null;
20
+
21
+ class ChannelClient {
22
+ constructor() {
23
+ this.initParams = null;
24
+ }
25
+ // 加入房间
26
+ /**
27
+ *
28
+ * @param {object} params
29
+ * @param {string} params.userId 用户id
30
+ * @param {string} params.roomId 房间id
31
+ * @param {string} params.host 信道链接地址
32
+ * @param {string} params.userName 用户名
33
+ * @param {string} params.role 角色 teacher/student/assitant
34
+ * @param {string} params.institutionId 机构
35
+ * @param {function} cb 回调函数
36
+ * @param {number} channelType 信道类型 1=直播云信道 2=pomelo
37
+ */
38
+ async joinRoom(params, cb, channelType = 1) {
39
+ // 设置初始化参数
40
+ this.initParams = params;
41
+ // 设置当前信道对象,使用直播云还是pomelo
42
+ channelObj = channelObjs[channelType];
43
+ defaultApi.writeLog('channel_log : choose channel and start joining ......');
44
+ // 加入房间
45
+ channelObj.joinRoom(params, cb);
46
+ this.sendJoin(params);
47
+ }
48
+ // 离开房间
49
+ async leaveRoom() {
50
+ if (!channelObj) {
51
+ console.log('channel has not init');
52
+ defaultApi.writeLog('channel has not init');
53
+ return;
54
+ }
55
+ // 离开房间
56
+ channelObj.leaveRoom();
57
+ }
58
+ // 发送信道消息
59
+ sendChannelMsg(msg) {
60
+ if (!channelObj) {
61
+ console.log('channel has not init');
62
+ defaultApi.writeLog('channel has not init');
63
+ return;
64
+ }
65
+ channelObj.sendChannelMsg(msg);
66
+ }
67
+ // 发送进房消息,是自己加入房间群发的消息
68
+ sendJoin(args) {
69
+ this.sendChannelMsg(getSendMsgParams.sendJoin(args));
70
+ }
71
+ // 发送离开房间消息,是收到别人进入房间然后定向发的消息
72
+ sendLeave(args) {
73
+ this.sendChannelMsg(getSendMsgParams.sendLeave(args));
74
+ }
75
+ // 发送进房ack消息
76
+ sendJoinAck(args) {
77
+ this.sendChannelMsg(getSendMsgParams.sendJoinAck(args));
78
+ }
79
+ // 发送推流消息,addstream自己推流成功会发,如果有个人进来你会单独给他发,没有ack
80
+ sendAddStream(args) {
81
+ this.sendChannelMsg(getSendMsgParams.sendAddStream(args));
82
+ }
83
+ // 发送设备状态更新消息
84
+ sendUpdateStreamDeviceStatus(args) {
85
+ this.sendChannelMsg(getSendMsgParams.sendUpdateStreamDeviceStatus(args));
86
+ }
87
+ // 发送停止推流消息
88
+ sendRemoveStream(args) {
89
+ this.sendChannelMsg(getSendMsgParams.sendRemoveStream(args));
90
+ }
91
+ //断线重连时,加入小组
92
+ async reJoin() {
93
+ //获取当前小组sdk类型
94
+ const cloudResponse = await getCloudData(window.zby_sdk_req_get_cloud_params);
95
+ const new_target_sdk_type = cloudResponse.data.sdkName;
96
+
97
+ if (window.target_sdk_type) {
98
+ //正在切换中,等待切换
99
+ defaultApi.writeLog('reJoin changing -- wait_changed');
100
+ return;
101
+ } else if (!window.target_sdk_type && window.current_sdk_type !== new_target_sdk_type) {
102
+ //未在切换中,且当前SDK类型和小组不一致:进行切换SDK
103
+ console.log('info', `断线重连,准备执行切换 SDK to ${new_target_sdk_type}`);
104
+ defaultApi.writeLog(`reJoin : 断线重连,准备执行切换 SDK to ${new_target_sdk_type}`);
105
+ zbysdk.changeSDK(1);
106
+ } else {
107
+ const {roomId, userId, userName, institutionId, role} = this.initParams;
108
+ //一致:重进
109
+ defaultApi.writeLog('reJoin : SDK一致, 重进');
110
+ const baseInfo = {
111
+ roomId,
112
+ userId,
113
+ userName,
114
+ institutionId,
115
+ role
116
+ };
117
+ this.sendJoin(baseInfo);
118
+ this.sendAddStream(baseInfo);
119
+ this.sendUpdateStreamDeviceStatus(Object.assign({}, baseInfo, {
120
+ deviceType: dict.getDeviceTypeKey('video'),
121
+ deviceStatus: dict.getDeviceStatusKey(userAndDeviceStatusInfo && userAndDeviceStatusInfo.camera ? 'open' : 'closed'),
122
+ }));
123
+ this.sendUpdateStreamDeviceStatus(Object.assign({}, baseInfo, {
124
+ deviceType: dict.getDeviceTypeKey('audio'),
125
+ deviceStatus: dict.getDeviceStatusKey(userAndDeviceStatusInfo && userAndDeviceStatusInfo.microPhone ? 'open' : 'closed'),
126
+ }));
127
+ }
128
+ }
129
+ }
130
+
131
+ const channelClient = new ChannelClient();
132
+
133
+
134
+
135
+
136
+
137
+ export default channelClient;
138
+