@xylink/xy-rtc-sdk 2.1.2 → 3.8.0-beta.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 (48) hide show
  1. package/README.MD +37 -37
  2. package/lib/{src/action → action}/index.d.ts +237 -236
  3. package/lib/{src/enum → enum}/contraints.d.ts +116 -116
  4. package/lib/{src/enum → enum}/errorCode.d.ts +880 -880
  5. package/lib/{src/enum → enum}/index.d.ts +137 -133
  6. package/lib/{src/index.d.ts → index.d.ts} +34 -34
  7. package/lib/{src/main → main}/client.d.ts +878 -808
  8. package/lib/{src/main → main}/deviceManager.d.ts +164 -164
  9. package/lib/{src/main → main}/helper.d.ts +51 -51
  10. package/lib/{src/main → main}/iauth.d.ts +33 -33
  11. package/lib/{src/main → main}/layoutManager.d.ts +214 -214
  12. package/lib/{src/main → main}/peer.d.ts +311 -311
  13. package/lib/{src/main → main}/qualityManager.d.ts +39 -39
  14. package/lib/{src/main → main}/stream.d.ts +263 -243
  15. package/lib/{src/main → main}/videoManager.d.ts +65 -65
  16. package/lib/{src/tools → tools}/audioLevel.d.ts +23 -23
  17. package/lib/{src/tools → tools}/browser.d.ts +55 -55
  18. package/lib/{src/tools → tools}/config.d.ts +12 -12
  19. package/lib/{src/tools → tools}/db.d.ts +85 -85
  20. package/lib/{src/tools → tools}/detect.d.ts +44 -45
  21. package/lib/{src/tools → tools}/emmitter.d.ts +15 -15
  22. package/lib/{src/tools → tools}/enum.d.ts +6 -6
  23. package/lib/{src/tools → tools}/httpClient.d.ts +64 -64
  24. package/lib/{src/tools → tools}/i18n.d.ts +8 -8
  25. package/lib/{src/tools → tools}/index.d.ts +8 -8
  26. package/lib/{src/tools → tools}/logger.d.ts +151 -151
  27. package/lib/{src/tools → tools}/socket.d.ts +53 -53
  28. package/lib/{src/tools → tools}/store.d.ts +15 -15
  29. package/lib/{src/tools → tools}/template.d.ts +14 -14
  30. package/lib/{src/tools → tools}/utils.d.ts +73 -67
  31. package/lib/{src/tools → tools}/verify.d.ts +7 -7
  32. package/lib/{src/type → type}/base.d.ts +71 -71
  33. package/lib/{src/type → type}/client.d.ts +1121 -1106
  34. package/lib/{src/type → type}/device.d.ts +77 -77
  35. package/lib/{src/type → type}/index.d.ts +11 -11
  36. package/lib/{src/type → type}/quality.d.ts +77 -77
  37. package/lib/{src/type → type}/stream.d.ts +426 -426
  38. package/lib/xyrtc.cjs.js +1 -0
  39. package/lib/xyrtc.umd.js +1 -0
  40. package/package.json +119 -130
  41. package/scripts/build_lib.js +16 -0
  42. package/scripts/utils.js +27 -0
  43. package/scripts/webpack.common.js +139 -0
  44. package/scripts/webpack.dev.js +27 -0
  45. package/scripts/webpack.sdk.js +68 -0
  46. package/tsconfig.lib.json +37 -0
  47. package/lib/index.es.js +0 -3
  48. package/lib/index.js +0 -3
@@ -1,164 +1,164 @@
1
- /**
2
- * XYLink WebRTC Device & Permission Manager Lib
3
- *
4
- * @summary device and permission manager
5
- * @email luojinghui424@gmail.com
6
- * @author jinghui-luo、chengfei
7
- *
8
- * Created at : 2020-11-26 14:41:51
9
- * Last modified : 2022-06-09 17:33:47
10
- */
11
- import Logger from '../tools/logger';
12
- import Emmitter from '../tools/emmitter';
13
- import { IDeviceList, ISelectedDevice, ICurrentPermission } from '../type';
14
- /**
15
- * DeviceManager模块,用于管理枚举设备列表、监听设备变动、处理设备权限等功能
16
- *
17
- * @class DeviceManager
18
- * @extends Emmitter 事件发送器
19
- */
20
- declare class DeviceManager extends Emmitter {
21
- private navigator;
22
- private currentDeviceList;
23
- private nextDeviceList;
24
- private currentUsedDevice;
25
- private currentPermission;
26
- private permissionCameraStatus;
27
- private permissionPhoneStatus;
28
- logger: Logger;
29
- constructor(logger?: Logger);
30
- /**
31
- * 获取设备权限数据
32
- */
33
- getDevicePermission(): ICurrentPermission;
34
- /**
35
- * 获取当前设备列表
36
- * @returns
37
- */
38
- getNextDeviceList(): IDeviceList;
39
- /**
40
- * 设置当前正在使用的设备信息
41
- * 1. 此信息可能从stream中获取
42
- *
43
- * @param devices 设备数据
44
- */
45
- setCurrentUsedDevice(currentDevice: ISelectedDevice): Promise<void>;
46
- /**
47
- * 设置当前正在使用的设备信息
48
- * 切换设备时,需重新设置此值,为下次diffDevice 使用
49
- * @param type
50
- * @param deviceId
51
- */
52
- setCurrentUsedDeviceByType(type: 'audio' | 'video', deviceId: string): void;
53
- /**
54
- * 设置输出设备
55
- *
56
- * @param element video元素节点
57
- * @param outputDeviceId 设备id
58
- */
59
- setAudioOutputDevice(element: any, outputDeviceId: string): void;
60
- /**
61
- * 向外提供权限信息
62
- */
63
- emmitDevices(): Promise<void>;
64
- /**
65
- * 初始化构造器函数
66
- */
67
- init(): Promise<void>;
68
- /**
69
- * 销毁设备管理器实例
70
- */
71
- destroy(): void;
72
- /**
73
- * 获取设备列表
74
- *
75
- * @private
76
- * @returns { IDeviceList } list
77
- */
78
- private getPrivateDevices;
79
- /**
80
- * 获取设备列表数据
81
- */
82
- getDevices(): Promise<IDeviceList>;
83
- setPermission(permission: ICurrentPermission): void;
84
- /**
85
- * 【私有方法】
86
- * 向外提供权限信息
87
- */
88
- private emmitPermission;
89
- /**
90
- * 【私有方法】
91
- * 查询权限接口
92
- *
93
- * @param type 需要检测的设备类型 'microphone' | 'camera'
94
- */
95
- private query;
96
- /**
97
- * 【私有方法】
98
- * 监听权限变更
99
- *
100
- * @param e 回调权限数据
101
- */
102
- private handlePermissionCameraStateChanged;
103
- /**
104
- * 【私有方法】
105
- * 监听权限变更
106
- *
107
- * @param e 回调权限数据
108
- */
109
- private handlePermissionPhoneStateChanged;
110
- /**
111
- * 获取摄像头和麦克风权限方法,初始化时直接调用
112
- *
113
- * TODO:兼容方式通过获取devices设备去检测是否授予了权限
114
- * TODO:可以通过looping的形式检测,后续在处理
115
- */
116
- getPermission(): Promise<ICurrentPermission>;
117
- /**
118
- * 【私有方法】
119
- * 如果有音频设备插入,则选取最新设备
120
- * 如果有音频设备拔出,则选默认设备
121
- * 如果有音频设备进行切换,则以切换为主
122
- *
123
- * @param preList
124
- * @param nextList
125
- */
126
- private diffAudioDevice;
127
- /**
128
- * 【私有方法】
129
- * 获取最新的摄像头设备数据
130
- * 1. 默认采用新加入的摄像头设备
131
- * 2. 如果当前使用的设备被拔出,采用第0个设备数据
132
- *
133
- * @param preVideoInList 上一次的摄像头列表数据
134
- * @param nextVideoInList 设备变化后的摄像头列表数据
135
- */
136
- private diffVideoDevice;
137
- /**
138
- * 【私有方法】
139
- * 通过和最新的设备数据对比,得到设备差异
140
- * 用于切换到最新的设备
141
- *
142
- * @param currentDevices 当前设备列表
143
- * @param nextDevices 设备变化后的列表
144
- */
145
- private diffDevices;
146
- /**
147
- * 【私有方法】
148
- * 设备变化监听函数
149
- * 1. detail: 最新的设备列表数据
150
- * 2. nextDevice: 需要切换的设备数据
151
- */
152
- private mediaDevicesChange;
153
- /**
154
- * 【私有方法】
155
- * 初始化设备监听函数
156
- */
157
- private initDeviceEvent;
158
- /**
159
- * 【私有方法】
160
- * 移除设备监听函数
161
- */
162
- private removeDeviceEvent;
163
- }
164
- export default DeviceManager;
1
+ /**
2
+ * XYLink WebRTC Device & Permission Manager Lib
3
+ *
4
+ * @summary device and permission manager
5
+ * @email luojinghui424@gmail.com
6
+ * @author jinghui-luo、chengfei
7
+ *
8
+ * Created at : 2020-11-26 14:41:51
9
+ * Last modified : 2022-06-09 17:33:47
10
+ */
11
+ import Logger from '../tools/logger';
12
+ import Emmitter from '../tools/emmitter';
13
+ import { IDeviceList, ISelectedDevice, ICurrentPermission } from '../type';
14
+ /**
15
+ * DeviceManager模块,用于管理枚举设备列表、监听设备变动、处理设备权限等功能
16
+ *
17
+ * @class DeviceManager
18
+ * @extends Emmitter 事件发送器
19
+ */
20
+ declare class DeviceManager extends Emmitter {
21
+ private navigator;
22
+ private currentDeviceList;
23
+ private nextDeviceList;
24
+ private currentUsedDevice;
25
+ private currentPermission;
26
+ private permissionCameraStatus;
27
+ private permissionPhoneStatus;
28
+ logger: Logger;
29
+ constructor(logger?: Logger);
30
+ /**
31
+ * 获取设备权限数据
32
+ */
33
+ getDevicePermission(): ICurrentPermission;
34
+ /**
35
+ * 获取当前设备列表
36
+ * @returns
37
+ */
38
+ getNextDeviceList(): IDeviceList;
39
+ /**
40
+ * 设置当前正在使用的设备信息
41
+ * 1. 此信息可能从stream中获取
42
+ *
43
+ * @param devices 设备数据
44
+ */
45
+ setCurrentUsedDevice(currentDevice: ISelectedDevice): Promise<void>;
46
+ /**
47
+ * 设置当前正在使用的设备信息
48
+ * 切换设备时,需重新设置此值,为下次diffDevice 使用
49
+ * @param type
50
+ * @param deviceId
51
+ */
52
+ setCurrentUsedDeviceByType(type: 'audio' | 'video', deviceId: string): void;
53
+ /**
54
+ * 设置输出设备
55
+ *
56
+ * @param element video元素节点
57
+ * @param outputDeviceId 设备id
58
+ */
59
+ setAudioOutputDevice(element: any, outputDeviceId: string): void;
60
+ /**
61
+ * 向外提供权限信息
62
+ */
63
+ emmitDevices(): Promise<void>;
64
+ /**
65
+ * 初始化构造器函数
66
+ */
67
+ init(): Promise<void>;
68
+ /**
69
+ * 销毁设备管理器实例
70
+ */
71
+ destroy(): void;
72
+ /**
73
+ * 获取设备列表
74
+ *
75
+ * @private
76
+ * @returns { IDeviceList } list
77
+ */
78
+ private getPrivateDevices;
79
+ /**
80
+ * 获取设备列表数据
81
+ */
82
+ getDevices(): Promise<IDeviceList>;
83
+ setPermission(permission: ICurrentPermission): void;
84
+ /**
85
+ * 【私有方法】
86
+ * 向外提供权限信息
87
+ */
88
+ private emmitPermission;
89
+ /**
90
+ * 【私有方法】
91
+ * 查询权限接口
92
+ *
93
+ * @param type 需要检测的设备类型 'microphone' | 'camera'
94
+ */
95
+ private query;
96
+ /**
97
+ * 【私有方法】
98
+ * 监听权限变更
99
+ *
100
+ * @param e 回调权限数据
101
+ */
102
+ private handlePermissionCameraStateChanged;
103
+ /**
104
+ * 【私有方法】
105
+ * 监听权限变更
106
+ *
107
+ * @param e 回调权限数据
108
+ */
109
+ private handlePermissionPhoneStateChanged;
110
+ /**
111
+ * 获取摄像头和麦克风权限方法,初始化时直接调用
112
+ *
113
+ * TODO:兼容方式通过获取devices设备去检测是否授予了权限
114
+ * TODO:可以通过looping的形式检测,后续在处理
115
+ */
116
+ getPermission(): Promise<ICurrentPermission>;
117
+ /**
118
+ * 【私有方法】
119
+ * 如果有音频设备插入,则选取最新设备
120
+ * 如果有音频设备拔出,则选默认设备
121
+ * 如果有音频设备进行切换,则以切换为主
122
+ *
123
+ * @param preList
124
+ * @param nextList
125
+ */
126
+ private diffAudioDevice;
127
+ /**
128
+ * 【私有方法】
129
+ * 获取最新的摄像头设备数据
130
+ * 1. 默认采用新加入的摄像头设备
131
+ * 2. 如果当前使用的设备被拔出,采用第0个设备数据
132
+ *
133
+ * @param preVideoInList 上一次的摄像头列表数据
134
+ * @param nextVideoInList 设备变化后的摄像头列表数据
135
+ */
136
+ private diffVideoDevice;
137
+ /**
138
+ * 【私有方法】
139
+ * 通过和最新的设备数据对比,得到设备差异
140
+ * 用于切换到最新的设备
141
+ *
142
+ * @param currentDevices 当前设备列表
143
+ * @param nextDevices 设备变化后的列表
144
+ */
145
+ private diffDevices;
146
+ /**
147
+ * 【私有方法】
148
+ * 设备变化监听函数
149
+ * 1. detail: 最新的设备列表数据
150
+ * 2. nextDevice: 需要切换的设备数据
151
+ */
152
+ private mediaDevicesChange;
153
+ /**
154
+ * 【私有方法】
155
+ * 初始化设备监听函数
156
+ */
157
+ private initDeviceEvent;
158
+ /**
159
+ * 【私有方法】
160
+ * 移除设备监听函数
161
+ */
162
+ private removeDeviceEvent;
163
+ }
164
+ export default DeviceManager;
@@ -1,51 +1,51 @@
1
- /**
2
- * Common Helper Function Lib
3
- *
4
- * @author jinghui-Luo
5
- * @email luojinghui424@gmail.com
6
- *
7
- * Created at : 2021-01-09 14:45:46
8
- * Last modified : 2022-06-09 17:35:24
9
- */
10
- import { ILayout, IVideoManagerState, IRotationInfoTotalItem } from '../type';
11
- export declare const getLayoutItemState: (item: ILayout | ILayout, stream: MediaStream | null, vmState: IVideoManagerState) => "REQUEST" | "MUTE" | "NORMAL" | "AUDIO_TEL" | "AUDIO_ONLY" | "AUDIO_CONTENT";
12
- /**
13
- * Get video real display size and rotate of transform infos
14
- * @param width video real width of resolution
15
- * @param height video real height of resolution
16
- * @param containerHeight display video container size
17
- * @param containerWidth display video container size
18
- * @param rotate video real ratio
19
- */
20
- export declare const getVideoInfoByRotation: (width: number, height: number, containerHeight: number, containerWidth: number, rotate: number) => {
21
- realWidth: number;
22
- realHeight: number;
23
- realRotate: number;
24
- };
25
- /**
26
- * 通过旋转信息配合画面容器计算应该旋转的角度和宽高
27
- *
28
- * @param item rotateInfo 设备旋转item,通过rotate-info接口回调获取
29
- * @param containerWidth 当前参会者画面容器的宽度
30
- * @param containerHeight 当前参会者画面容器的高度
31
- */
32
- export declare const getLayoutRotateInfo: (item: IRotationInfoTotalItem, containerWidth: number, containerHeight: number) => {};
33
- /**
34
- * 获取可支持的编解码
35
- *
36
- * @public
37
- * @returns { Promise<Object> }
38
- */
39
- export declare const getSendSupportedCodec: () => Object;
40
- /**
41
- * WebRTC 内外网探测
42
- *
43
- * @public
44
- * @returns { Promise<Object> }
45
- */
46
- export declare const detectLocator: ({ extId, clientId, clientSecret, httpServer }: {
47
- extId: string;
48
- clientId: string;
49
- clientSecret: string;
50
- httpServer?: string | undefined;
51
- }) => Promise<string>;
1
+ /**
2
+ * Common Helper Function Lib
3
+ *
4
+ * @author jinghui-Luo
5
+ * @email luojinghui424@gmail.com
6
+ *
7
+ * Created at : 2021-01-09 14:45:46
8
+ * Last modified : 2022-06-09 17:35:24
9
+ */
10
+ import { ILayout, IVideoManagerState, IRotationInfoTotalItem } from '../type';
11
+ export declare const getLayoutItemState: (item: ILayout | ILayout, stream: MediaStream | null, vmState: IVideoManagerState) => "REQUEST" | "NORMAL" | "AUDIO_ONLY" | "MUTE" | "AUDIO_TEL" | "AUDIO_CONTENT";
12
+ /**
13
+ * Get video real display size and rotate of transform infos
14
+ * @param width video real width of resolution
15
+ * @param height video real height of resolution
16
+ * @param containerHeight display video container size
17
+ * @param containerWidth display video container size
18
+ * @param rotate video real ratio
19
+ */
20
+ export declare const getVideoInfoByRotation: (width: number, height: number, containerHeight: number, containerWidth: number, rotate: number) => {
21
+ realWidth: number;
22
+ realHeight: number;
23
+ realRotate: number;
24
+ };
25
+ /**
26
+ * 通过旋转信息配合画面容器计算应该旋转的角度和宽高
27
+ *
28
+ * @param item rotateInfo 设备旋转item,通过rotate-info接口回调获取
29
+ * @param containerWidth 当前参会者画面容器的宽度
30
+ * @param containerHeight 当前参会者画面容器的高度
31
+ */
32
+ export declare const getLayoutRotateInfo: (item: IRotationInfoTotalItem, containerWidth: number, containerHeight: number) => {};
33
+ /**
34
+ * 获取可支持的编解码
35
+ *
36
+ * @public
37
+ * @returns { Promise<Object> }
38
+ */
39
+ export declare const getSendSupportedCodec: () => Object;
40
+ /**
41
+ * WebRTC 内外网探测
42
+ *
43
+ * @public
44
+ * @returns { Promise<Object> }
45
+ */
46
+ export declare const detectLocator: ({ extId, clientId, clientSecret, httpServer }: {
47
+ extId: string;
48
+ clientId: string;
49
+ clientSecret: string;
50
+ httpServer?: string | undefined;
51
+ }) => Promise<string>;
@@ -1,33 +1,33 @@
1
- /**
2
- * 登录模块
3
- *
4
- */
5
- import { ILoginExtAccount, ISdkUserInfo, ILoginInfo } from '../type';
6
- import Logger from '../tools/logger';
7
- declare class IAuth {
8
- private logger;
9
- private loginInfo;
10
- constructor(logger: Logger);
11
- getLoginInfo(): ILoginInfo;
12
- setLoginInfo(loginInfo: ILoginInfo): void;
13
- /**
14
- * 第三方登录方法
15
- *
16
- * @public
17
- * @param { ILoginExtAccount } params 参数
18
- * @return { Promise<Object> } 登录结果
19
- */
20
- loginExternalAccount(params: ILoginExtAccount): Promise<Object>;
21
- /**
22
- * 登录
23
- *
24
- * @param { ISdkUserInfo } sdkUserInfo
25
- * @param { ILoginExtAccount } params
26
- */
27
- login(sdkUserInfo: ISdkUserInfo, params?: ILoginExtAccount): Promise<{
28
- code: string;
29
- msg: string;
30
- detail: any;
31
- }>;
32
- }
33
- export default IAuth;
1
+ /**
2
+ * 登录模块
3
+ *
4
+ */
5
+ import { ILoginExtAccount, ISdkUserInfo, ILoginInfo } from '../type';
6
+ import Logger from '../tools/logger';
7
+ declare class IAuth {
8
+ private logger;
9
+ private loginInfo;
10
+ constructor(logger: Logger);
11
+ getLoginInfo(): ILoginInfo;
12
+ setLoginInfo(loginInfo: ILoginInfo): void;
13
+ /**
14
+ * 第三方登录方法
15
+ *
16
+ * @public
17
+ * @param { ILoginExtAccount } params 参数
18
+ * @return { Promise<Object> } 登录结果
19
+ */
20
+ loginExternalAccount(params: ILoginExtAccount): Promise<Object>;
21
+ /**
22
+ * 登录
23
+ *
24
+ * @param { ISdkUserInfo } sdkUserInfo
25
+ * @param { ILoginExtAccount } params
26
+ */
27
+ login(sdkUserInfo: ISdkUserInfo, params?: ILoginExtAccount): Promise<{
28
+ code: string;
29
+ msg: string;
30
+ detail: any;
31
+ }>;
32
+ }
33
+ export default IAuth;