larksr_websdk 3.3.102 → 3.3.104

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 (42) hide show
  1. package/dist/doc/en/config.md +99 -99
  2. package/dist/doc/en/dev.md +21 -21
  3. package/dist/doc/en/event_codes.md +117 -117
  4. package/dist/doc/en/events.md +72 -72
  5. package/dist/doc/en/functions.md +239 -239
  6. package/dist/doc/en/index.md +1 -1
  7. package/dist/doc/en/member_variables.md +116 -120
  8. package/dist/doc/en/multi_media_3_2_401.md +20 -20
  9. package/dist/doc/en/sdkid_encryption.md +14 -14
  10. package/dist/doc/en/update.md +462 -462
  11. package/dist/doc/zh_CN/config.md +1 -1
  12. package/dist/doc/zh_CN/event_codes.md +1 -1
  13. package/dist/doc/zh_CN/functions.md +2 -2
  14. package/dist/doc/zh_CN/index.md +1 -1
  15. package/dist/doc/zh_CN/multi_media_3_2_401.md +1 -1
  16. package/dist/doc/zh_CN/update.md +579 -579
  17. package/dist/larksr-web-sdk.min.js +1 -1
  18. package/dist/types/api.d.ts +2 -0
  19. package/dist/types/appli_params.d.ts +14 -0
  20. package/dist/types/lark/application.d.ts +2 -1
  21. package/dist/types/lark/message.d.ts +1 -0
  22. package/dist/types/larksr.d.ts +83 -4
  23. package/dist/types/localization/ui.d.ts +2 -0
  24. package/dist/types/operation/keyboard_handler.d.ts +25 -0
  25. package/dist/types/utils/lock_pointer.d.ts +2 -1
  26. package/package.json +72 -72
  27. package/types/api.d.ts +2 -0
  28. package/types/appli_params.d.ts +14 -0
  29. package/types/lark/application.d.ts +2 -1
  30. package/types/lark/message.d.ts +1 -0
  31. package/types/larksr.d.ts +83 -4
  32. package/types/localization/ui.d.ts +2 -0
  33. package/types/operation/keyboard_handler.d.ts +25 -0
  34. package/types/utils/lock_pointer.d.ts +2 -1
  35. package/dist/types/lark/custom.d.ts +0 -7
  36. package/dist/types/lark/webcodecs.generated.d.ts +0 -417
  37. package/dist/types/protobuf/cloudlark.d.ts +0 -9674
  38. package/dist/types/utils/ios-inner-height.d.ts +0 -4
  39. package/types/lark/custom.d.ts +0 -7
  40. package/types/lark/webcodecs.generated.d.ts +0 -417
  41. package/types/protobuf/cloudlark.d.ts +0 -9674
  42. package/types/utils/ios-inner-height.d.ts +0 -4
@@ -1,27 +1,27 @@
1
- # LarkSR 对象成员方法
1
+ # LarkSR Object Member Methods
2
2
 
3
- LarkSR 对象成员方法主要分为以下三类
3
+ LarkSR object member methods are mainly divided into the following three categories
4
4
 
5
- ## 控制流程方法,包括启动,关闭,重启,注册授权码等。
5
+ ## Control flow methods, including start, stop, restart, register authorization code, etc.
6
6
 
7
7
  ```typescript
8
8
  /**
9
- * 单独设置服务器地址,作用同 config 中的 serverAddress 字段
10
- * 在进入应用之前都可以更新。
11
- * @param serverAddress 服务器地址,如 http://192.168.0.55:8181/
9
+ * Set the server address separately, same as the serverAddress field in config
10
+ * Can be updated before entering the application.
11
+ * @param serverAddress Server address, e.g., http://192.168.0.55:8181/
12
12
  */
13
13
  updateServerAddress(serverAddress: string): void;
14
14
  /**
15
15
  *
16
- * @param id sdk id 初始化sdkid
16
+ * @param id sdk id Initialize sdk id
17
17
  * @returns
18
18
  */
19
19
  initSDKAuthCode(id: string): Promise<void>;
20
20
  /**
21
- * 使用平行云托管平台时,使用 connectWithPxyHost 连接云端应用
22
- * 托管平台 https://www.pingxingyun.com/console/#/
23
- * @param params connect 方法
24
- * @return connect 方法
21
+ * When using the Pingxingyun hosting platform, use connectWithPxyHost to connect to the cloud application
22
+ * Hosting platform https://www.pingxingyun.com/console/#/
23
+ * @param params Same as connect method
24
+ * @return Same as connect method
25
25
  */
26
26
  connectWithPxyHost(params: {
27
27
  appliId: string;
@@ -33,30 +33,30 @@ connectWithPxyHost(params: {
33
33
  groupId?: string;
34
34
  }): Promise<void>;
35
35
  /**
36
- * 连接云端渲染资源
37
- * @params appID 云端资源的 ID
38
- * @returns Promise 调用接口并校验授权通过返回成功并自动开始连接
39
- * Promise 返回的错误对象:
36
+ * Connect to cloud rendering resources
37
+ * @params appID Cloud resource ID
38
+ * @returns Promise Call the interface and verify the authorization to return success and automatically start the connection
39
+ * Promise returned error object:
40
40
  * {
41
- // type 0 渲染资源不足导致的错误,1 其他错误, 可用 type == 0 判断是否是渲染资源不足类型的错误
41
+ // type 0 Error caused by insufficient rendering resources, 1 Other errors, can use type == 0 to determine if it is an insufficient rendering resource error
42
42
  type: 0,
43
43
 
44
- // 渲染资源不足时的事件类型,其他情况可能不返回,比如网络错误
44
+ // Event type when rendering resources are insufficient, may not return in other cases, such as network errors
45
45
  eventType?:LarkSRClientEvent.RESOURCE_NOT_ENOUGH,
46
46
 
47
- // 服务端返回的错误码,服务端请求正确返回时存在。需要注意渲染资源不足类型的错误码。
48
- // 可用 type == 0 判断是否是渲染资源不足类型的错误,再用 code 进行细节处理,或者只用 type == 0 进行处理。
49
- // 813=当前应用的运行数量已达到最大值:{0},请稍后再试
50
- // 814=同一appKey下的应用运行数量达到最大值:{0},请稍后再试
51
- // 815=应用运行数量已达到最大授权并发数量,请稍后再试
52
- // 816=VR应用运行数量已达到最大授权并发数量,请稍后再试
53
- // 817=渲染资源不足,请稍后再试
54
- // 820=暂无活跃的GPU节点
55
- // 821=节点资源使用率已达到设置的阈值
56
- // 823=单节点运行应用数量已达到单节点最大授权并发数量,请稍后再试
47
+ // Error code returned by the server, present when the server request is correct. Pay attention to the error codes for insufficient rendering resources.
48
+ // Can use type == 0 to determine if it is an insufficient rendering resource error, then use code for detailed handling, or just use type == 0 for handling.
49
+ // 813=The current number of running applications has reached the maximum: {0}, please try again later
50
+ // 814=The number of running applications under the same appKey has reached the maximum: {0}, please try again later
51
+ // 815=The number of running applications has reached the maximum authorized concurrency, please try again later
52
+ // 816=The number of running VR applications has reached the maximum authorized concurrency, please try again later
53
+ // 817=Insufficient rendering resources, please try again later
54
+ // 820=No active GPU nodes
55
+ // 821=Node resource usage has reached the set threshold
56
+ // 823=The number of running applications on a single node has reached the maximum authorized concurrency, please try again later
57
57
  code?: 817,
58
58
 
59
- // 错误信息
59
+ // Error message
60
60
  message:? "",
61
61
  }
62
62
  *
@@ -76,122 +76,122 @@ connect(params: {
76
76
  signature?: string;
77
77
  } | any): Promise<void>;
78
78
  /**
79
- * 重新开始云渲染流程
79
+ * Restart the cloud rendering process
80
80
  */
81
81
  restart(): void;
82
82
  /**
83
- * 重新启动云端应用
83
+ * Restart the cloud application
84
84
  */
85
85
  restartApp(): void;
86
86
  /**
87
- * 主动关闭连接
87
+ * Actively close the connection
88
88
  */
89
89
  close(): void;
90
90
  ```
91
91
 
92
- ## 输入输出相关方法,包括鼠标,键盘,手柄,触摸
92
+ ## Input and output related methods, including mouse, keyboard, gamepad, touch
93
93
 
94
94
  ```typescript
95
95
  /**
96
- * 切换当前操作者
97
- * @param uid 用户id
96
+ * Switch the current operator
97
+ * @param uid User id
98
98
  */
99
99
  changeOperater(uid: number): void;
100
100
  /**
101
- * 向云端应用发送文字。当云端应用出现输入框时,可以将本地文本填写进去.
102
- * @param text 文字
101
+ * Send text to the cloud application. When the cloud application has an input box, you can fill in the local text.
102
+ * @param text Text
103
103
  */
104
104
  inputText(text: string): void;
105
105
  /**
106
- * 操作相关事件
107
- * 所有事件坐标相对于云端应用,不相对于网页
108
- * CloudLark.IClientInput 是所有操作指令接口对象的合集
109
- * 可以单独使用下面 moseMove 等接口
110
- * @param input 操作指令
106
+ * Operation related events
107
+ * All event coordinates are relative to the cloud application, not the webpage
108
+ * CloudLark.IClientInput is a collection of all operation command interface objects
109
+ * You can use the following moseMove interfaces separately
110
+ * @param input Operation command
111
111
  */
112
112
  sendInput(input: CloudLark.IClientInput): void;
113
113
  /**
114
- * 向云端发送鼠标移动事件
115
- * 事件坐标相对于云端应用,不相对于网页
116
- * 计算方式可以参考 https://github.com/pingxingyun/lark_sr_websdk_demos 例子中 v_cursor.vue getVMouseTouchPosition 方法
117
- * 原理是通过 LarkSR 对象的成员 screenState.operateScale 获取相对的缩放,
118
- * 本地坐标 X larksr.screenState.operateScale.scaleX / scaleY 即可得到相对云端的坐标
114
+ * Send mouse move event to the cloud
115
+ * Event coordinates are relative to the cloud application, not the webpage
116
+ * Calculation method can refer to the getVMouseTouchPosition method in v_cursor.vue in the example https://github.com/ParaverseTechnology/lark_sr_websdk_demos
117
+ * The principle is to obtain the relative scale through the screenState.operateScale member of the LarkSR object,
118
+ * Local coordinates X larksr.screenState.operateScale.scaleX / scaleY to get the coordinates relative to the cloud
119
119
  *
120
- * @param PosX 相对云端鼠标 X 点坐标
121
- * @param PosY 相对云端鼠标 Y 点坐标
122
- * @param DeltaX 相对云端鼠标 X 轴移动距离
123
- * @param DeltaY 相对云端鼠标 X 轴移动距离
120
+ * @param PosX Mouse X coordinate relative to the cloud
121
+ * @param PosY Mouse Y coordinate relative to the cloud
122
+ * @param DeltaX Mouse X axis movement distance relative to the cloud
123
+ * @param DeltaY Mouse Y axis movement distance relative to the cloud
124
124
  */
125
125
  mouseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
126
126
  /**
127
- * 向云端发送鼠标移动事件
128
- * 事件坐标相对于云端应用,不相对于网页
129
- * 计算方式可以参考 https://github.com/pingxingyun/lark_sr_websdk_demos 例子中 v_cursor.vue getVMouseTouchPosition 方法
130
- * 原理是通过 LarkSR 对象的成员 screenState.operateScale 获取相对的缩放,
131
- * 本地坐标 X larksr.screenState.operateScale.scaleX / scaleY 即可得到相对云端的坐标
127
+ * Send mouse move event to the cloud
128
+ * Event coordinates are relative to the cloud application, not the webpage
129
+ * Calculation method can refer to the getVMouseTouchPosition method in v_cursor.vue in the example https://github.com/ParaverseTechnology/lark_sr_websdk_demos
130
+ * The principle is to obtain the relative scale through the screenState.operateScale member of the LarkSR object,
131
+ * Local coordinates X larksr.screenState.operateScale.scaleX / scaleY to get the coordinates relative to the cloud
132
132
  *
133
- * @param PosX 相对云端鼠标 X 点坐标
134
- * @param PosY 相对云端鼠标 Y 点坐标
135
- * @param DeltaX 相对云端鼠标 X 轴移动距离
136
- * @param DeltaY 相对云端鼠标 X 轴移动距离
133
+ * @param PosX Mouse X coordinate relative to the cloud
134
+ * @param PosY Mouse Y coordinate relative to the cloud
135
+ * @param DeltaX Mouse X axis movement distance relative to the cloud
136
+ * @param DeltaY Mouse Y axis movement distance relative to the cloud
137
137
  */
138
138
  moseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
139
139
  /**
140
- * 向云端发送鼠标单击事件
141
- * X Y 坐标计算方式同 mouseMove
140
+ * Send mouse click event to the cloud
141
+ * X Y coordinate calculation method is the same as mouseMove
142
142
  *
143
- * @param PosX 相对云端鼠标 X 点坐标
144
- * @param PosY 相对云端鼠标 Y 点坐标
143
+ * @param PosX Mouse X coordinate relative to the cloud
144
+ * @param PosY Mouse Y coordinate relative to the cloud
145
145
  * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
146
146
  */
147
147
  mouseTap(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
148
148
  /**
149
- * 向云端发送鼠标按下事件
150
- * X Y 坐标计算方式同 mouseMove
149
+ * Send mouse down event to the cloud
150
+ * X Y coordinate calculation method is the same as mouseMove
151
151
  *
152
- * @param PosX 相对云端鼠标 X 点坐标
153
- * @param PosY 相对云端鼠标 Y 点坐标
152
+ * @param PosX Mouse X coordinate relative to the cloud
153
+ * @param PosY Mouse Y coordinate relative to the cloud
154
154
  * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
155
155
  */
156
156
  mouseDown(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
157
157
  /**
158
- * 向云端发送鼠标抬起事件
159
- * X Y 坐标计算方式同 mouseMove
158
+ * Send mouse up event to the cloud
159
+ * X Y coordinate calculation method is the same as mouseMove
160
160
  *
161
- * @param PosX 相对云端鼠标 X 点坐标
162
- * @param PosY 相对云端鼠标 Y 点坐标
161
+ * @param PosX Mouse X coordinate relative to the cloud
162
+ * @param PosY Mouse Y coordinate relative to the cloud
163
163
  * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
164
164
  */
165
165
  mouseUp(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
166
166
  /**
167
- * 向云端发送鼠标滚轮事件
168
- * X Y 坐标计算方式同 mouseMove
167
+ * Send mouse wheel event to the cloud
168
+ * X Y coordinate calculation method is the same as mouseMove
169
169
  *
170
- * @param PosX 相对云端鼠标 X 点坐标
171
- * @param PosY 相对云端鼠标 Y 点坐标
172
- * @param Delata 120/-120 鼠标滚轮滚动的数值
170
+ * @param PosX Mouse X coordinate relative to the cloud
171
+ * @param PosY Mouse Y coordinate relative to the cloud
172
+ * @param Delata 120/-120 Mouse wheel scroll value
173
173
  */
174
174
  mouseWheel(PosX: number, PosY: number, Delata: number): void;
175
175
  /**
176
- * 向云端发送键盘按键按下事件
177
- * @param key KeyboardEvent.code 字段,具体内容参考 Chrome https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
178
- * @param isRepeat KeyboardEvent.repeat 字段,参考https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
179
- * @returns 是否发送成功,如果key参数传递错误可能发送失败
176
+ * Send keyboard key down event to the cloud
177
+ * @param key KeyboardEvent.code field, specific content refer to Chrome https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
178
+ * @param isRepeat KeyboardEvent.repeat field, refer to https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
179
+ * @returns Whether the sending is successful, if the key parameter is passed incorrectly, the sending may fail
180
180
  */
181
181
  keyDown(key: string, isRepeat: boolean): void;
182
182
  /**
183
- * 向云端发送键盘按键抬起事件
184
- * @param key KeyboardEvent.code 字段,具体内容参考 Chrome https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
185
- * @returns 是否发送成功,如果key参数传递错误可能发送失败
183
+ * Send keyboard key up event to the cloud
184
+ * @param key KeyboardEvent.code field, specific content refer to Chrome https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
185
+ * @returns Whether the sending is successful, if the key parameter is passed incorrectly, the sending may fail
186
186
  */
187
187
  keyUp(key: string): void;
188
- /**
189
- * 手柄接口消息按照 windows xbox 360 手柄标准定义,即包含 xbox 360 手柄的功能,如按钮,摇杆,扳机键。windows 上最多支持4个手柄,
190
- * 当前版本服务端只处理1个手柄,后续会放开多个手柄的支持。接口中发送的按键值为对应的 windows 中定义的按键值。
191
- * 向云端发送手柄按钮按下事件
192
- * 參考 js 中获取手柄事件,参考 https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
193
- * @param userIndex 手柄的索引,硬件设备索引 0-3. 第一个连接的手柄为0,第二个为1,以此类推。
194
- * @param button 按鍵 @see https://docs.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad
188
+ /**
189
+ * Gamepad interface messages are defined according to the Windows Xbox 360 gamepad standard, including the functions of the Xbox 360 gamepad, such as buttons, joysticks, and trigger keys. Windows supports up to 4 gamepads,
190
+ * The current version of the server only handles 1 gamepad, and support for multiple gamepads will be released later. The key values sent in the interface are the corresponding key values defined in Windows.
191
+ * Send gamepad button down event to the cloud
192
+ * Refer to js to get gamepad events, refer to https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
193
+ * @param userIndex Gamepad index, hardware device index 0-3. The first connected gamepad is 0, the second is 1, and so on.
194
+ * @param button Button @see https://docs.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad
195
195
  * export const enum XINPUT_BUTTONS {
196
196
  * XINPUT_GAMEPAD_DPAD_UP = 0x0001,
197
197
  * XINPUT_GAMEPAD_DPAD_DOWN = 0x0002,
@@ -209,395 +209,395 @@ keyUp(key: string): void;
209
209
  * XINPUT_GAMEPAD_Y = 0x8000,
210
210
  * XINPUT_UNKNOWN = -1,
211
211
  * }
212
- * @param isRepeat 是否重复按下
212
+ * @param isRepeat Whether to repeat
213
213
  * @returns
214
214
  */
215
215
  gamepadButtonDown(userIndex: number, button: number, isRepeat: boolean): void;
216
216
  /**
217
- * 向云端发送手柄按钮抬起事件
218
- * 參考 https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
219
- * @param userIndex 手柄的索引
220
- * @param button 按鍵
217
+ * Send gamepad button up event to the cloud
218
+ * Refer to https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
219
+ * @param userIndex Gamepad index
220
+ * @param button Button
221
221
  * @returns
222
222
  */
223
223
  gamepadButtonUp(userIndex: number, button: number): void;
224
224
  /**
225
- * 向云端发送手柄按trigger键事件
226
- * 參考 https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
227
- * @param userIndex 手柄的索引
228
- * @param isleft 是否是左trigger
229
- * @param value trigger的值 扳机键的值 0-255
225
+ * Send gamepad trigger key event to the cloud
226
+ * Refer to https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
227
+ * @param userIndex Gamepad index
228
+ * @param isleft Whether it is the left trigger
229
+ * @param value Trigger value 0-255
230
230
  * @returns
231
231
  */
232
232
  gamepadTrigger(userIndex: number, isleft: boolean, value: number): void;
233
233
  /**
234
- * 向云端发送手柄按摇杆的值,即 axes
234
+ * Send gamepad joystick values to the cloud, i.e., axes values
235
235
  * win MAX
236
236
  * |
237
237
  * MIN-------------MAX
238
238
  * |
239
239
  * MIN
240
- * js 中获取硬件手柄參考 https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
241
- * @param userIndex 手柄的索引
242
- * @param thumblx 左摇杆 X 值,-32767 32767
243
- * @param thumbly 左摇杆 Y 值,-32767 32767
244
- * @param thumbrx 右摇杆 X 值,-32767 32767
245
- * @param thumbry 右摇杆 Y 值,-32767 32767
240
+ * Refer to js to get hardware gamepad https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
241
+ * @param userIndex Gamepad index
242
+ * @param thumblx Left joystick X value, -32767 to 32767
243
+ * @param thumbly Left joystick Y value, -32767 to 32767
244
+ * @param thumbrx Right joystick X value, -32767 to 32767
245
+ * @param thumbry Right joystick Y value, -32767 to 32767
246
246
  * @returns
247
247
  */
248
248
  joystick(userIndex: number, thumblx: number, thumbly: number, thumbrx: number, thumbry: number): void;
249
249
  /**
250
- * 向云端发送触摸按下事件
251
- * 坐标位置与 mouseMove 相同,相对与云端的鼠标移动位置
252
- * @param id 手指的id
253
- * @param x 相对云端的x轴坐标
254
- * @param y 相对云端的y轴坐标
250
+ * Send touch down event to the cloud
251
+ * Coordinate position is the same as mouseMove, relative to the cloud mouse move position
252
+ * @param id Finger id
253
+ * @param x X coordinate relative to the cloud
254
+ * @param y Y coordinate relative to the cloud
255
255
  * @returns
256
256
  */
257
257
  touchDown(id: number, x: number, y: number): void;
258
258
  /**
259
- * 向云端发送触摸移动事件
260
- * 坐标位置与 mouseMove 相同,相对与云端的鼠标移动位置
261
- * @param id 手指的id
262
- * @param x 相对云端的x轴坐标
263
- * @param y 相对云端的y轴坐标
259
+ * Send touch move event to the cloud
260
+ * Coordinate position is the same as mouseMove, relative to the cloud mouse move position
261
+ * @param id Finger id
262
+ * @param x X coordinate relative to the cloud
263
+ * @param y Y coordinate relative to the cloud
264
264
  * @returns
265
265
  */
266
266
  touchMove(id: number, x: number, y: number): void;
267
267
  /**
268
- * 向云端发送触摸抬起事件
269
- * 坐标位置与 mouseMove 相同,相对与云端的鼠标移动位置
270
- * @param id 手指的id
271
- * @param x 相对云端的x轴坐标
272
- * @param y 相对云端的y轴坐标
268
+ * Send touch up event to the cloud
269
+ * Coordinate position is the same as mouseMove, relative to the cloud mouse move position
270
+ * @param id Finger id
271
+ * @param x X coordinate relative to the cloud
272
+ * @param y Y coordinate relative to the cloud
273
273
  * @returns
274
274
  */
275
275
  touchUp(id: number, x: number, y: number): void;
276
276
  /**
277
- * 字符串转换为输入的鼠标按键值
277
+ * Convert string to input mouse button value
278
278
  * @param button 'left' | 'mid' | 'right'
279
279
  * @returns LEFT = 0,RIGHT = 1,MIDDLE = 2
280
280
  */
281
281
  getMouseButtonType(button: 'left' | 'mid' | 'right'): CloudLark.MouseKey;
282
282
  ```
283
283
 
284
- ## 数据通道扩展,向云端应用数据通道发送数据
284
+ ## Data channel extension, send data to the cloud application data channel
285
285
 
286
286
  ```typescript
287
287
  /**
288
- * 发送文字消息给数据通道
289
- * 注意 云端应用要继承数据通道功能
290
- * > V3.2.314 版本对应服务器版本和数据通道版本为 3.2.5.1 及以上
291
- * @param text 文字
288
+ * Send text message to data channel
289
+ * Note that the cloud application needs to inherit the data channel function
290
+ * > V3.2.314 version corresponds to server version and data channel version 3.2.5.1 and above
291
+ * @param text Text
292
292
  */
293
293
  sendTextToDataChannel(text: string): void;
294
294
  /**
295
- * 发送字节消息给数据通道
296
- * 注意 云端应用要继承数据通道功能
297
- * @param binary 字节消息
295
+ * Send binary message to data channel
296
+ * Note that the cloud application needs to inherit the data channel function
297
+ * @param binary Binary message
298
298
  */
299
299
  sendBinaryToDataChannel(binary: Uint8Array): void;
300
300
  ```
301
301
 
302
- ## 智能语音相关接口
302
+ ## Intelligent voice related interfaces
303
303
 
304
304
  ```typescript
305
305
  /**
306
- * 开始智能语音对话文本输入
307
- * 应在只能语音为开始状态下开始输入
308
- * @param text 输入的文本
309
- * @returns 返回对话 ID
306
+ * Start intelligent voice dialogue text input
307
+ * Should start input when intelligent voice is in the start state
308
+ * @param text Input text
309
+ * @returns Return dialogue ID
310
310
  */
311
311
  aiDmTextInput(text: string): number;
312
312
  /**
313
- * 开始智能语音对话语音输入,自动请求录音权限
314
- * 应在只能语音为开始状态下开始输入
315
- * @returns 成功返回对话id,失败返回异常
313
+ * Start intelligent voice dialogue voice input, automatically request recording permission
314
+ * Should start input when intelligent voice is in the start state
315
+ * @returns Success returns dialogue id, failure returns exception
316
316
  */
317
317
  startAiDmVoiceInput(): Promise<number>;
318
318
  /**
319
- * 停止智能语音输入,通知语音引擎当前用户输入对话结束
320
- * @returns 返回当前对话的id
319
+ * Stop intelligent voice input, notify the voice engine that the current user input dialogue is over
320
+ * @returns Return the current dialogue id
321
321
  */
322
322
  stopAiDmVoiceInput(): number;
323
323
  ```
324
324
 
325
- LarkSR 添加如下事件来获取智能语音服务状态:
325
+ LarkSR adds the following events to get the status of the intelligent voice service:
326
326
 
327
327
  ```typescript
328
328
  larksr.on('aivoicestatus', (e) => {
329
- // 智能语音服务状态
329
+ // Intelligent voice service status
330
330
  });
331
331
 
332
332
  larksr.on('aivoiceasrresult', (e) => {
333
- // 智能语音转文字识别结果
333
+ // Intelligent voice to text recognition result
334
334
  });
335
335
 
336
336
  larksr.on('aivoicedmresult', (e) => {
337
- // 智能语音对话结果
337
+ // Intelligent voice dialogue result
338
338
  });
339
339
  ```
340
340
 
341
- ## 麦克风输入接口
341
+ ## Microphone input interface
342
342
 
343
- 客户端打开后云端应用可直接通过读取声卡上的麦克风接收到音频。
343
+ After the client is turned on, the cloud application can directly receive audio by reading the microphone on the sound card.
344
344
 
345
- > 该功能匹配的服务端版本最低为 V3.2.51
346
- > 使用该功能要注意在后台开启语音输入功能
347
- > 注意要在连接成功之后打开媒体设备。即 `mediaPlayed` 之后调用才有效
345
+ > The minimum server version that matches this feature is V3.2.51
346
+ > To use this feature, make sure to enable the voice input feature in the backend
347
+ > Note that the media device should be turned on after the connection is successful. That is, it is effective after calling `mediaPlayed`
348
348
 
349
349
  ```typescript
350
350
  /**
351
- * 打开一个音频设备,要注意浏览器限制在 https 或者 localhost 下才能打开音频
352
- * @param deviceId 音频设备id,如果不传将打开默认设备。@see getConnectedAudioinputDevices
351
+ * Turn on an audio device, note that the browser restricts it to https or localhost to open audio
352
+ * @param deviceId Audio device id, if not passed, the default device will be opened. @see getConnectedAudioinputDevices
353
353
  * @returns
354
354
  */
355
355
  openAudio(deviceId?: string);
356
356
  /**
357
- * 关闭当前的音频设备
357
+ * Turn off the current audio device
358
358
  * @returns
359
359
  */
360
360
  closeAudio(): boolean | undefined;
361
361
  /**
362
- * 暂停发送音频
362
+ * Pause sending audio
363
363
  * @returns
364
364
  */
365
365
  pauseAudioSending(): any;
366
366
  /**
367
- * 恢复发送音频
367
+ * Resume sending audio
368
368
  * @returns
369
369
  */
370
370
  resumeAudioSending(): any;
371
371
  /**
372
- * 返回已连接的音频设备列表,设备列表中的设备的 deviceId 可用来打开某个音频设备
372
+ * Return the list of connected audio devices, the device id in the device list can be used to open a specific audio device
373
373
  * @returns
374
374
  */
375
375
  getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
376
376
  /**
377
- * 设置当前已开启的音频track是否启用状态
378
- * @param enable 是否启用
377
+ * Set whether the currently opened audio track is enabled
378
+ * @param enable Whether to enable
379
379
  * @returns
380
380
  */
381
381
  setAudioEnable(enable: boolean): void | undefined;
382
382
 
383
383
  /**
384
- * 请求浏览器打开媒体并且打开上传到服务器通道。
385
- * 要注意的是在服务器连接成功之后请求打开
386
- * @param constraints 参考 navigator.mediaDevices.getUserMedia(constraints)
387
- * @param reset 是否重制媒体通道。true 的情况下重制整个 peerconnection
388
- * @returns 打开的通道的绑定信息。管理媒体通道如关闭暂停或恢复使用。
384
+ * Request the browser to open the media and open the upload channel to the server.
385
+ * Note that the request should be made after the server connection is successful
386
+ * @param constraints Refer to navigator.mediaDevices.getUserMedia(constraints)
387
+ * @param reset Whether to reset the media channel. If true, reset the entire peerconnection
388
+ * @returns The binding information of the opened channel. Manage the media channel such as closing, pausing, or resuming use.
389
389
  */
390
390
  openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
391
391
  ```
392
392
 
393
- larksr 配置项自动打开麦克风配置,在`new LarkSR({ ... 此处省略其他配置 ... audioInputAutoStart: true})` 时传入,
393
+ LarkSR configuration item to automatically open the microphone configuration, passed in when `new LarkSR({ ... other configurations omitted ... audioInputAutoStart: true})`,
394
394
 
395
- > 手动传入的 `audioInputAutoStart` 优先级高于后台配置
395
+ > Manually passed `audioInputAutoStart` has a higher priority than the backend configuration
396
396
 
397
397
  ```javascript
398
398
  /**
399
- * 当启用音频输入功能,是否自动连入音频设备。
400
- * 默认关闭。
401
- * 需要注意默认打开的是系统中默认的音频设备。
399
+ * When the audio input function is enabled, whether to automatically connect to the audio device.
400
+ * Disabled by default.
401
+ * Note that the default audio device of the system is enabled by default.
402
402
  */
403
403
  audioInputAutoStart?: boolean;
404
404
  ```
405
405
 
406
- 获取当前打开音频设备的状态, `larksr.audioPaused`
406
+ Get the status of the currently opened audio device, such as `larksr.audioPaused`
407
407
 
408
408
  ```javascript
409
409
  /**
410
- * 当前打开的音频设备 ID,如果打开时没指定为空
410
+ * The ID of the currently opened audio device, if not specified when opened, it is empty
411
411
  */
412
412
  get audioDeviceId(): string | null | undefined;
413
413
  /**
414
- * 当前打开音频的track对象,未打开状态为空
414
+ * The track object of the currently opened audio, if not opened, it is empty
415
415
  */
416
416
  get audioTrack(): MediaStreamTrack | null | undefined;
417
417
  /**
418
- * 音频通道是否暂停
418
+ * Whether the audio channel is paused
419
419
  */
420
420
  get audioPaused(): boolean | undefined;
421
421
  ```
422
422
 
423
- ## 视频输入接口
423
+ ## Video input interface
424
424
 
425
- 客户端打开后云端应用可直接通过读取服务端的摄像头读取视频数据。
425
+ After the client is turned on, the cloud application can directly read video data by reading the camera on the server.
426
426
 
427
- > 该功能匹配的服务端版本最低为 V3.2.61
428
- > 使用该功能要注意在后台应用管理中开启视频输入功能
429
- > 注意要在连接成功之后打开媒体设备。即 `mediaPlayed` 之后调用才有效
427
+ > The minimum server version that matches this feature is V3.2.61
428
+ > To use this feature, make sure to enable the video input feature in the backend application management
429
+ > Note that the media device should be turned on after the connection is successful. That is, it is effective after calling `mediaPlayed`
430
430
 
431
431
  ```typescript
432
432
  /**
433
- * 打开一个视频设备,要注意浏览器限制在 https 或者 localhost 下才能打开视频
434
- * @param audio boolean 是否同时开启音频
435
- * @param cameraId 视频设备id,如果不传将打开默认设备。@see getConnectedVideoinputDevices
436
- * @param width 限制打开设备的宽
437
- * @param height 限制打开设备的高
433
+ * Turn on a video device, note that the browser restricts it to https or localhost to open video
434
+ * @param audio boolean Whether to turn on audio at the same time
435
+ * @param cameraId Video device id, if not passed, the default device will be opened. @see getConnectedVideoinputDevices
436
+ * @param width Limit the width of the device to be opened
437
+ * @param height Limit the height of the device to be opened
438
438
  * @returns Promise
439
439
  */
440
440
  openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number): Promise<any>;
441
441
  /**
442
- * 打开摄像头设备
443
- * @param cameraId 摄像头设备ID,@see getConnectedVideoinputDevices
444
- * @param minWidth 限制打开设备的宽
445
- * @param minHeight 限制打开设备的高
442
+ * Turn on the camera device
443
+ * @param cameraId Camera device ID, @see getConnectedVideoinputDevices
444
+ * @param minWidth Limit the width of the device to be opened
445
+ * @param minHeight Limit the height of the device to be opened
446
446
  * @returns @see openUserMedia
447
447
  */
448
448
  openCamera(cameraId: string, minWidth?: number, minHeight?: number): Promise<any>;
449
449
  /**
450
- * 打开默认媒体设备,要注意浏览器限制在 https 或者 localhost
451
- * 如果需要指定特殊的媒体设备请单独使用 @see openAudio @see openVideo
452
- * @param video 是否包含视频
453
- * @param audio 是否包含音频
450
+ * Turn on the default media device, note that the browser restricts it to https or localhost
451
+ * If you need to specify a specific media device, please use @see openAudio @see openVideo separately
452
+ * @param video Whether to include video
453
+ * @param audio Whether to include audio
454
454
  * @returns Promise
455
455
  */
456
- openDefaultMedia(video?: boolean, audio?: boolean)>;
456
+ openDefaultMedia(video?: boolean, audio?: boolean): Promise<any>;
457
457
  /**
458
- * 返回已连接的视频设备
458
+ * Return the list of connected video devices
459
459
  * @returns Promise<MediaDeviceInfo[]>
460
460
  */
461
- getConnectedVideoinputDevices();
461
+ getConnectedVideoinputDevices(): Promise<MediaDeviceInfo[]>;
462
462
  /**
463
- * 设置当前已开启的视频track是否启用状态
464
- * @param enable 是否启用
463
+ * Set whether the currently opened video track is enabled
464
+ * @param enable Whether to enable
465
465
  * @returns void
466
466
  */
467
- setVideoEnable(enable: boolean);
467
+ setVideoEnable(enable: boolean): void;
468
468
 
469
469
  /**
470
- * 暂停发送视频
470
+ * Pause sending video
471
471
  * @returns
472
472
  */
473
473
  pauseVideoSending(): any;
474
474
  /**
475
- * 恢复发送视频
475
+ * Resume sending video
476
476
  * @returns
477
477
  */
478
478
  resumeVideoSending(): any;
479
479
 
480
480
  /**
481
- * 关闭当前已打开的视频设备
481
+ * Turn off the currently opened video device
482
482
  * @returns
483
483
  */
484
484
  closeVideo(): any;
485
485
  /**
486
- * 关闭当前已打开的共享设备如共享的标签页等
486
+ * Turn off the currently opened shared device, such as a shared tab, etc.
487
487
  * @returns
488
488
  */
489
489
  closeShare(): any;
490
490
  /**
491
- * 请求浏览器打开媒体并且打开上传到服务器通道。
492
- * 要注意的是在服务器连接成功之后请求打开
493
- * @param constraints 参考 navigator.mediaDevices.getUserMedia(constraints)
494
- * @param reset 是否重制媒体通道。true 的情况下重制整个 peerconnection
495
- * @returns 打开的通道的绑定信息。管理媒体通道如关闭暂停或恢复使用。
491
+ * Request the browser to open the media and open the upload channel to the server.
492
+ * Note that the request should be made after the server connection is successful
493
+ * @param constraints Refer to navigator.mediaDevices.getUserMedia(constraints)
494
+ * @param reset Whether to reset the media channel. If true, reset the entire peerconnection
495
+ * @returns The binding information of the opened channel. Manage the media channel such as closing, pausing, or resuming use.
496
496
  */
497
497
  openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
498
498
  ```
499
499
 
500
- larksr 配置项自动打开视频输入配置,在`new LarkSR({ ... 此处省略其他配置 ... videoInputAutoStart: true})` 时传入
500
+ LarkSR configuration item to automatically open the video input configuration, passed in when `new LarkSR({ ... other configurations omitted ... videoInputAutoStart: true})`,
501
501
 
502
- > 手动传入的 `videoInputAutoStart` 优先级高于后台配置
502
+ > Manually passed `videoInputAutoStart` has a higher priority than the backend configuration
503
503
 
504
504
  ```javascript
505
505
  /**
506
- * 当启用视频输入功能,是否自动连入视频设备。
507
- * 默认关闭。
508
- * 需要注意默认打开的是系统中默认的视频设备。
506
+ * When the video input function is enabled, whether to automatically connect to the video device.
507
+ * Disabled by default.
508
+ * Note that the default video device of the system is enabled by default.
509
509
  */
510
510
  videoInputAutoStart?: boolean;
511
511
  ```
512
512
 
513
- 获取当前打开视频设备的状态,如 `larksr.videoPaused`
513
+ Get the status of the currently opened video device, such as `larksr.videoPaused`
514
514
 
515
515
  ```javascript
516
516
  /**
517
- * 当前打开视频设备 ID,如果打开时没指定特设备id为空
517
+ * The ID of the currently opened video device, if not specified when opened, it is empty
518
518
  */
519
519
  get videoDeviceId(): string | null | undefined;
520
520
  /**
521
- * 当前打开视频track对象,未打开状态为空
521
+ * The track object of the currently opened video, if not opened, it is empty
522
522
  */
523
523
  get videoTrack(): MediaStreamTrack | null | undefined;
524
524
  /**
525
- * 视频通道是否暂停
525
+ * Whether the video channel is paused
526
526
  */
527
527
  get videoPaused(): boolean | undefined;
528
528
  ```
529
529
 
530
- ## 云端直播推流功能
530
+ ## Cloud live streaming function
531
531
 
532
- > 服务端 3.2.7.0 添加, 要注意使用云端直播推流功能要在后台应用管理中开启该功能
532
+ > Server 3.2.7.0 added, note that to use the cloud live streaming function, you need to enable this function in the backend application management
533
533
 
534
534
  ```javascript
535
535
  /**
536
- * 启动云端推流功能
536
+ * Start the cloud live streaming function
537
537
  * @param params {
538
- * // rtmp push url 必须填
538
+ * // rtmp push url must be filled
539
539
  * path: "",
540
540
  * //rtmp push key
541
541
  * key: "",
542
- * // 推流的宽
542
+ * // Push stream width
543
543
  * width: 1280,
544
- * // 推流的高
544
+ * // Push stream height
545
545
  * height: 720,
546
546
  * framerate: 30,
547
547
  * // kbps
548
548
  * bitrate: 1024 * 2,
549
- * // 是否支持断线重连
549
+ * // Whether to support reconnection
550
550
  * reconnect: true,
551
- * //最大重连次数
551
+ * //Maximum number of reconnections
552
552
  * reconnectRetries: 3,
553
- * //是否串流麦克风(语音输入支持的情况)
553
+ * //Whether to stream the microphone (if voice input is supported)
554
554
  * voice: audioInput,
555
555
  * }
556
556
  * @returns Promise
557
557
  */
558
558
  StartCloudLiveStreaming(params: CloudLark.IRtmp_Start): Promise<void> | undefined;
559
559
  /**
560
- * 关闭云端推流功能
560
+ * Turn off the cloud live streaming function
561
561
  * @returns
562
562
  */
563
563
  StopLiveStreaming(): void | undefined;
564
564
  ```
565
565
 
566
- 云端直播的相关状态参考 `RTMP_STREAM_STATE` `RTMP_STREAM_ERROR` 两个事件
566
+ The relevant status of cloud live streaming refers to the two events `RTMP_STREAM_STATE` and `RTMP_STREAM_ERROR`
567
567
 
568
568
  ```javascript
569
569
  /**
570
- * 服务端 3.2.7.0 添加
571
- * rtmp 直播推流状态
570
+ * Server 3.2.7.0 added
571
+ * rtmp live streaming status
572
572
  */
573
573
  RTMP_STREAM_STATE = "rtmpstreamstate",
574
574
  /**
575
- * 服务端 3.2.7.0 添加
576
- * rtmp 直播推流出错
575
+ * Server 3.2.7.0 added
576
+ * rtmp live streaming error
577
577
  */
578
578
  RTMP_STREAM_ERROR = "rtmpstreamerror"
579
579
  ```
580
580
 
581
- ## 其他
581
+ ## Other
582
582
 
583
583
  ```typescript
584
584
  /**
585
- * 采集一帧图像
586
- * @params data: any 抛出采集事件时抛出的附加data,比如采集的时间戳
587
- * @params option: { width: number, height: number } 截图的宽高,如果未设置则使用云端应用窗口的宽高
588
- * @return { data: any, base64: base64string } 返回传入的 data 和采集的 base64 字符串
585
+ * Capture a frame of image
586
+ * @params data: any Additional data thrown when the capture event is thrown, such as the capture timestamp
587
+ * @params option: { width: number, height: number } Screenshot width and height, if not set, use the width and height of the cloud application window
588
+ * @return { data: any, base64: base64string } Return the passed data and the captured base64 string
589
589
  */
590
590
  captrueFrame(data: any, option?: { width: number; height: number;})
591
591
 
592
592
  /**
593
- * 设置是否强制横屏显示内容.
594
- * handelRootElementSize 必须设置为 true 才有作用。
595
- * 要注意强制横屏模式下网页的坐标系xy和视觉上相反,如果通过外部输入 input 事件。要注意调整
596
- * @param force 是否强制横屏
593
+ * Set whether to force landscape display content.
594
+ * handelRootElementSize must be set to true to be effective.
595
+ * Note that in forced landscape mode, the coordinate system xy of the webpage is opposite to the visual, if input events are input through external input. Pay attention to adjustment
596
+ * @param force Whether to force landscape
597
597
  */
598
598
  setMobileForceLandScape(force: boolean): void;
599
599
  /**
600
- * DOM种删除渲染组件,注意删除渲染组件之后将无法再次进入应用,所有状态将失效,不可恢复,只能重新new LarkSR
600
+ * Remove the rendering component from the DOM, note that after the rendering component is removed, it will not be possible to enter the application again, all states will be invalid, and cannot be restored, only new LarkSR can be used
601
601
  */
602
602
  destroy(): void;
603
603
  ```