larksr_websdk 3.2.13 → 3.2.30

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/README.md CHANGED
@@ -21,6 +21,11 @@ SDK 功能包括:
21
21
  * 处理全屏模式,并可配置
22
22
  * 自动处理横屏模式,手机端强制横屏模式,并可配置
23
23
 
24
+ ### 注意
25
+
26
+ > V3.2.30 开始仅支持服务端 [V3.2.3.1](https://www.pingxingyun.com/devCenter.html) 以上版本。
27
+ > [老版本 SDK Demo 下载](https://github.com/pingxingyun/lark_sr_websdk_demos/releases/tag/V3.2.10)
28
+
24
29
  ## 快速接入
25
30
 
26
31
  ### 安装
@@ -42,7 +47,7 @@ npm i larksr_websdk
42
47
  使用前应准备好
43
48
 
44
49
  1. Lark 服务器前台可访问的地址, 如:http://222.128.6.137:8181/
45
- 2. SDK 授权码,联系 business@pingxingyun.com 获取,注意是 SDK 本身的授权码,不是服务器上的授权
50
+ 2. SDK 授权码,联系 business@pingxingyun.com 获取, 注意是 SDK 本身的授权码,不是服务器上的授权
46
51
  3. 系统中获取的应用 ID,如 http://222.128.6.137:8181/ 系统下的 879408743551336448
47
52
 
48
53
  ```javascript
@@ -53,36 +58,29 @@ var client = new LarkSR({
53
58
  // 服务器地址,实际使用中填写您的服务器地址
54
59
  // 如:http://222.128.6.137:8181/
55
60
  // 当使用平行云托管服务时服务器地址自动分配,可留空。
56
- // 使用平行云托管服务时使用 CreateLarkSRClientFromePXYHost 或 larksr.connectWithPxyHost 进入应用
61
+ // larksr.connectWithPxyHost 进入应用
57
62
  serverAddress: "Lark 服务器前台地址",
58
63
  // SDK ID 也可在 initSDKAuthCode 设置
59
- // authCode: '您的 SDK ID',
64
+ authCode: '您的 SDK ID',
60
65
  // 测试载入背景图
61
66
  // loadingBgUrl: 'https://home-obs.pingxingyun.com/homePage_4_0/bg.jpg',
62
67
  });
63
68
 
64
- // 授权码,验证成功之后才能调用 connect
65
- client.initSDKAuthCode('您的 SDK ID')
69
+ // start connect;
70
+ // 使用平行云托管服务时,用 connectWithPxyHost 进入应用并自动分配服务器.
71
+ client.connect({
72
+ // 要使用的云端资源的应用 ID,从后云雀后台接口获取
73
+ // 参考查询应用一栏文档
74
+ // https://www.pingxingyun.com/online/api3_2.html?id=476
75
+ // 如 222.128.6.137:8181 系统下的 879408743551336448 应用
76
+ appliId: "应用ID"
77
+ })
66
78
  .then(() => {
67
- // start connect;
68
- // 使用平行云托管服务时,用 connectWithPxyHost 进入应用并自动分配服务器.
69
- client.connect({
70
- // 要使用的云端资源的应用 ID,从后云雀后台接口获取
71
- // 参考查询应用一栏文档
72
- // https://www.pingxingyun.com/online/api3_2.html?id=476
73
- // 如 222.128.6.137:8181 系统下的 879408743551336448 应用
74
- appliId: "应用ID"
75
- })
76
- .then(() => {
77
- console.log('enter success');
78
- })
79
- .catch((e) => {
80
- console.error(e);
81
- });
79
+ console.log('enter success');
82
80
  })
83
81
  .catch((e) => {
84
82
  console.error(e);
85
- });
83
+ });
86
84
  // ...
87
85
  // 主动关闭并清理资源
88
86
  // client.close();
@@ -26,6 +26,7 @@ interface ILarkSRConfig {
26
26
  authCode?: string;
27
27
  /**
28
28
  * 可选项,授权是否成功
29
+ * @deprecated 目前不会回调该参数。如果SDK验证失败将在 connect 返回失败
29
30
  */
30
31
  authCodeCallback?: (isSuccess: boolean, e: any) => void;
31
32
  /**
package/dist/doc/index.md CHANGED
@@ -18,70 +18,19 @@ npm i larksr_websdk
18
18
 
19
19
  ## 使用
20
20
 
21
- 主要使用 LarkSR 对象实例,所有基本操作和事件通过该实例实现。创建该对象一般通过 `CreateLarkSRClientFromeAPI` , `CreateLarkSRClientFromePXYHost`, `CreateLarkSRClientFromeUrl` 函数创建 LarkSR 实例。
21
+ ### 注意
22
22
 
23
- ```typescript
24
- /**
25
- * 通过调用后台接口获取云端应用参数
26
- * @param config 传入 config @see ILarkSRConfig
27
- * @param params 进入应用接口参数。appliId 为必填项
28
- * @returns Promise 创建 larksr client 是否成功
29
- */
30
- export declare function CreateLarkSRClientFromeAPI(config: ILarkSRConfig, params: {
31
- appliId: string,
32
- // 互动模式
33
- //启动模式:0:普通模式, 1:互动模式(一人操作多人观看),2: 多人协同(键盘鼠标放开,需要应用配合)
34
- playerMode?: number,
35
- //Task所有者:1 / 观察者:0
36
- userType?: number,
37
- //口令:8位唯一码,写入TaskInfo
38
- roomCode?: string,
39
- taskId?: string,
40
- // groups
41
- clientMac?: string,
42
- groupId?: string,
43
- regionId?: string,
44
- //指定节点分配
45
- targetServerIp?: string,
46
- // keys
47
- appKey?: string,
48
- timestamp?: string,
49
- signature?: string,
50
- }): Promise<LarkSR>;
23
+ > V3.2.30 开始仅支持服务端 [V3.2.3.1](https://www.pingxingyun.com/devCenter.html) 以上版本。
24
+ > [老版本 SDK Demo 下载](https://github.com/pingxingyun/lark_sr_websdk_demos/releases/tag/V3.2.10)
51
25
 
52
- /**
53
- * 通过从url参数中获取云端应用相关参数
54
- * @param config 传入 config @see ILarkSRConfig
55
- * @returns Promise 创建 larksr client 是否成功
56
- */
57
- export declare function CreateLarkSRClientFromeUrl(config: ILarkSRConfig): Promise<LarkSR>;
58
-
59
- /**
60
- * 通过平行云托管平台创建客户端并启动应用
61
- * @param config 传入 config @see ILarkSRConfig
62
- * @param params 进入应用接口参数。appliId 为必填项
63
- * @returns Promise 创建 larksr client 是否成功
64
- */
65
- export declare function CreateLarkSRClientFromePXYHost(config: ILarkSRConfig, params: {
66
- appliId: string;
67
- playerMode?: number;
68
- userType?: number;
69
- roomCode?: string;
70
- taskId?: string;
71
- nickname?: string;
72
- }): Promise<LarkSR>;
73
- ```
74
-
75
- ## 手动创建
26
+ ## 创建 LarkSR 实例
76
27
 
77
28
  ```typescript
78
29
  /**
79
30
  * LarkSR 客户端。所有操作和事件通过该类传递
80
- * @see CreateLarkSRClientFromeAPI, CreateLarkSRClientFromeUrl, CreateLarkSRClientFromePXYHost
81
- * @param config 本地配置,如果有 IAppliParams 相同的配置项,优先级最高
82
- * @param params 云端应用参数等,通过后台接口或者url参数获取。
31
+ * @param config 本地配置, 优先级最高
83
32
  */
84
- constructor(config: ILarkSRConfig, params?: IAppliParams);
33
+ constructor(config: ILarkSRConfig);
85
34
  ```
86
35
 
87
36
  example:
@@ -93,34 +42,30 @@ var client = new LarkSR({
93
42
  rootElement: document.getElementById('container'),
94
43
  // 服务器地址,实际使用中填写您的服务器地址
95
44
  // 如:http://222.128.6.137:8181/
45
+ // 当使用平行云托管服务时服务器地址自动分配,可留空。
46
+ // larksr.connectWithPxyHost 进入应用
96
47
  serverAddress: "Lark 服务器前台地址",
97
48
  // SDK ID 也可在 initSDKAuthCode 设置
98
- // authCode: '您的 SDK ID',
49
+ authCode: '您的 SDK ID',
99
50
  // 测试载入背景图
100
51
  // loadingBgUrl: 'https://home-obs.pingxingyun.com/homePage_4_0/bg.jpg',
101
52
  });
102
53
 
103
- // 授权码,验证成功之后才能调用 connect
104
- client.initSDKAuthCode('您的 SDK ID')
54
+ // start connect;
55
+ // 使用平行云托管服务时,用 connectWithPxyHost 进入应用并自动分配服务器.
56
+ client.connect({
57
+ // 要使用的云端资源的应用 ID,从后云雀后台接口获取
58
+ // 参考查询应用一栏文档
59
+ // https://www.pingxingyun.com/online/api3_2.html?id=476
60
+ // 如 222.128.6.137:8181 系统下的 879408743551336448 应用
61
+ appliId: "应用ID"
62
+ })
105
63
  .then(() => {
106
- // start connect;
107
- client.connect({
108
- // 要使用的云端资源的应用 ID,从后云雀后台接口获取
109
- // 参考查询应用一栏文档
110
- // https://www.pingxingyun.com/online/api3_2.html?id=476
111
- // 如 222.128.6.137:8181 系统下的 879408743551336448 应用
112
- appliId: "应用ID"
113
- })
114
- .then(() => {
115
- console.log('enter success');
116
- })
117
- .catch((e) => {
118
- console.error(e);
119
- });
64
+ console.log('enter success');
120
65
  })
121
66
  .catch((e) => {
122
67
  console.error(e);
123
- });
68
+ });
124
69
  // ...
125
70
  // 主动关闭并清理资源
126
71
  // client.close();
@@ -132,3 +77,5 @@ client.initSDKAuthCode('您的 SDK ID')
132
77
  ### [LarkSR 对象方法](./functons.md)
133
78
  ### [LarkSR 事件](./events.md)
134
79
  ### [LarkSR 对象成员](./member_variables.md)
80
+ ### [SDK ID 加密](./sdkid_encryption.md)
81
+ ### [SDK 更新](./update.md)
@@ -0,0 +1,40 @@
1
+ # SDK ID 加密配置
2
+
3
+ 使用 larksr SDK 首先需要从平行云商务 business@pingxingyun.com 或者在 https://www.pingxingyun.com/console 获取 SDK 授权码(注意不是服务器端的授权码)。
4
+
5
+ 通过 larksr config 传入 `authCode` 或者通过 larksr.initSDKAuthCode('您的SDKID') 方法设置授权码。
6
+
7
+ 为保护 SDK ID 的安全性,可以从服务端 3.2.3.0 开始可以对 SDK ID 进行加密配置。
8
+
9
+ 配置 SDK 加密:
10
+
11
+ 1. 首先在 larkxr 平台后台登陆,找到系统设定->接入管理->SDKID密钥管理生成 SDK ID 加密 KEY
12
+
13
+ 2. 对 SDK ID 进行加密
14
+
15
+ 以下 java 代码为例:
16
+
17
+ ```java
18
+ public static void main(String[] args) {
19
+ /**
20
+ * @param res 被加密的原生字符串
21
+ * @param key 16位字符作为加密的key
22
+ */
23
+ try {
24
+ String res = "被加密的原生字符串";
25
+ String key = "16位字符作为加密的key";
26
+ String ALGORITHM = "AES";
27
+ String CHARSET = "UTF-8";
28
+ SecretKeySpec sks = new SecretKeySpec(key.getBytes(CHARSET), ALGORITHM);
29
+ Cipher cipher = Cipher.getInstance(ALGORITHM);
30
+ cipher.init(cipher.ENCRYPT_MODE, sks);
31
+ byte[] result = cipher.doFinal(res.getBytes());
32
+ // BASE64Encoder encoder = new BASE64Encoder(); //java8
33
+ Base64.Encoder encoder = Base64.getEncoder(); //java9+
34
+ System.out.println(encoder.encodeToString(result));
35
+ }catch (Exception e){
36
+ }
37
+ }
38
+ ```
39
+
40
+ 3. 获取到加密好的字符串传入 lark 配置中即可。
@@ -0,0 +1,10 @@
1
+ # 更新
2
+
3
+ ## V3.2.30
4
+
5
+ > V3.2.30 仅支持服务端 [V3.2.3.1](https://www.pingxingyun.com/devCenter.html) 以上版本。
6
+ > [老版本 SDK Demo 下载](https://github.com/pingxingyun/lark_sr_websdk_demos/releases/tag/V3.2.10)
7
+
8
+ 1. [添加像素流送支持](https://docs.unrealengine.com/4.27/zh-CN/SharingAndReleasing/PixelStreaming/PixelStreamingIntro/)。
9
+ 2. 完善安全性, 添加 SDK ID 加密配置。
10
+ 3. 移除 CreateLarkSRClientFromePXYHost,CreateLarkSRClientFromeAPI, CreateLarkSRClientFromeUrl 函数。直接使用 `new LarkSR(config: ILarkSRConfig)` 方式创建对象。