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,462 +1,462 @@
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. 移除 CreateLarkSRClientFromePXYHostCreateLarkSRClientFromeAPI, CreateLarkSRClientFromeUrl 函数。直接使用 `new LarkSR(config: ILarkSRConfig)` 方式创建对象。
11
-
12
- ## V3.2.33
13
-
14
- 1. 添加智能语音相关接口支持
15
-
16
- LarkSR 对象添加:
17
-
18
- ```typescript
19
- /**
20
- * 开始智能语音对话文本输入
21
- * 应在只能语音为开始状态下开始输入
22
- * @param text 输入的文本
23
- * @returns 返回对话 ID
24
- */
25
- public aiDmTextInput(text: string) {
26
- /**
27
- * 开始智能语音对话语音输入,自动请求录音权限
28
- * 应在只能语音为开始状态下开始输入
29
- * @returns 成功返回对话id,失败返回异常
30
- */
31
- public startAiDmVoiceInput() {
32
-
33
- /**
34
- * 停止智能语音输入,通知语音引擎当前用户输入对话结束
35
- * @returns 返回当前对话的id
36
- */
37
- public stopAiDmVoiceInput() {
38
- ```
39
-
40
- LarkSR 添加如下事件:
41
-
42
- ```typescript
43
- larksr.on('aivoicestatus', (e) => {
44
- // 智能语音服务状态
45
- });
46
-
47
- larksr.on('aivoiceasrresult', (e) => {
48
- // 智能语音转文字识别结果
49
- });
50
-
51
- larksr.on('aivoicedmresult', (e) => {
52
- // 智能语音对话结果
53
- });
54
- ```
55
-
56
- ## V3.2.37
57
-
58
- ```typescript
59
- /**
60
- * 设置是否强制横屏显示内容.
61
- * handelRootElementSize 必须设置为 true 才有作用。
62
- * 要注意强制横屏模式下网页的坐标系xy和视觉上相反,如果通过外部输入 input 事件。要注意调整
63
- * @param force 是否强制横屏
64
- */
65
- setMobileForceLandScape(force: boolean): void;
66
- ```
67
-
68
- ## V3.2.311
69
-
70
- 新增麦克风输入接口。客户端打开后云端应用可直接通过读取声卡上的麦克风接收到音频。
71
-
72
- > 该功能匹配的服务端版本最低为 V3.2.51
73
- > 使用该功能要注意在后台应用管理中开启音频输入功能
74
- > 注意要在连接成功之后打开媒体设备。即 `mediaPlayed` 之后调用才有效
75
-
76
- ```typescript
77
- /**
78
- * 打开一个音频设备,要注意浏览器限制在 https 或者 localhost 下才能打开音频
79
- * @param deviceId 音频设备id,如果不传将打开默认设备。@see getConnectedAudioinputDevices
80
- * @returns
81
- */
82
- openAudio(deviceId?: string);
83
- /**
84
- * 关闭当前的音频设备
85
- * @returns
86
- */
87
- closeAudio(): boolean | undefined;
88
- /**
89
- * 返回已连接的音频设备列表,设备列表中的设备的 deviceId 可用来打开某个音频设备
90
- * @returns
91
- */
92
- getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
93
- /**
94
- * 设置当前已开启的音频track是否启用状态
95
- * @param enable 是否启用
96
- * @returns
97
- */
98
- setAudioEnable(enable: boolean): void | undefined;
99
- ```
100
-
101
- larksr 配置项新增自动打开麦克风配置,在`new LarkSR({ ... 此处省略其他配置 ... audioInputAutoStart: true})` 时传入,
102
-
103
- > 手动传入的 `audioInputAutoStart` 优先级高于后台配置
104
-
105
- ```javascript
106
- /**
107
- * 当启用音频输入功能,是否自动连入音频设备。
108
- * 默认关闭。
109
- * 需要注意默认打开的是系统中默认的音频设备。
110
- */
111
- audioInputAutoStart?: boolean;
112
- ```
113
-
114
- ## V3.2.319
115
-
116
- 新增视频输入接口。客户端打开后云端应用可直接通过读取服务端的摄像头读取视频数据。
117
-
118
- > 该功能匹配的服务端版本最低为 V3.2.61
119
- > 使用该功能要注意在后台应用管理中开启视频输入功能
120
- > 注意要在连接成功之后打开媒体设备。即 `mediaPlayed` 之后调用才有效
121
-
122
- ```typescript
123
- /**
124
- * 打开一个视频设备,要注意浏览器限制在 https 或者 localhost 下才能打开视频
125
- * @param audio boolean 是否同时开启音频
126
- * @param cameraId 视频设备id,如果不传将打开默认设备。@see getConnectedVideoinputDevices
127
- * @returns Promise
128
- */
129
- openVideo(audio?: boolean, cameraId?: string);
130
- /**
131
- * 打开默认媒体设备,要注意浏览器限制在 https 或者 localhost
132
- * 如果需要指定特殊的媒体设备请单独使用 @see openAudio @see openVideo
133
- * @param video 是否包含视频
134
- * @param audio 是否包含音频
135
- * @returns Promise
136
- */
137
- openDefaultMedia(video?: boolean, audio?: boolean)>;
138
- /**
139
- * 返回已连接的视频设备
140
- * @returns Promise<MediaDeviceInfo[]>
141
- */
142
- getConnectedVideoinputDevices();
143
- /**
144
- * 设置当前已开启的视频track是否启用状态
145
- * @param enable 是否启用
146
- * @returns void
147
- */
148
- setVideoEnable(enable: boolean);
149
- ```
150
-
151
- larksr 配置项新增自动打开视频输入配置,在`new LarkSR({ ... 此处省略其他配置 ... videoInputAutoStart: true})` 时传入
152
-
153
- > 手动传入的 `videoInputAutoStart` 优先级高于后台配置
154
-
155
- ```javascript
156
- /**
157
- * 当启用视频输入功能,是否自动连入视频设备。
158
- * 默认关闭。
159
- * 需要注意默认打开的是系统中默认的视频设备。
160
- */
161
- videoInputAutoStart?: boolean;
162
- ```
163
-
164
- ## V3.2.321
165
-
166
- larksr 配置项新增默认放大手势和鼠标滚轮对应关系和是否使用触摸屏模式,在`new LarkSR({ ... 此处省略其他配置 ... mouseZoomDirection: 0 touchOperateMode: "mouse"})` 时传入
167
-
168
- > 手动传入的配置优先级高于后台配置
169
-
170
- ```javascript
171
- /**
172
- * mouseZoomDirection
173
- * 用于移动端捏合缩放操作与应用鼠标缩放的对应关系
174
- * 1:鼠标滚轮向上为放大,
175
- * 0:鼠标滚轮向下为放大(default)
176
- */
177
- mouseZoomDirection?: number;
178
- /**
179
- * 触摸指令模式,对应后台应用管理->应用编辑->移动端高级设置->触摸指令模式 优先级高于后台配置
180
- * 触摸指令,移动端的触摸指令对应为云端的触屏还是鼠标
181
- * 'touchScreen' | 'mouse'
182
- */
183
- touchOperateMode?: 'touchScreen' | 'mouse';
184
- ```
185
-
186
- captrueFrame 方法会将截图和通过返回值带出来
187
-
188
- ```javascript
189
- /**
190
- * 采集一帧图像
191
- * @params data: any 抛出采集事件时抛出的附加data,比如采集的时间戳
192
- * @return { data: any, base64: base64string } 返回传入的 data 和采集的 base64 字符串
193
- */
194
- captrueFrame(data: any)
195
- ```
196
-
197
- 新增销毁方法,要注意,销毁之后 larksr 对象不再可用
198
-
199
- ```javascript
200
- /**
201
- * DOM种删除渲染组件,注意删除渲染组件之后将无法再次进入应用,所有状态将失效,不可恢复,只能重新new LarkSR
202
- */
203
- destroy(): void;
204
- ```
205
-
206
- 添加操作类中的 keyboardhandler 开放访问,可用配置拦截哪些按键的默认行为
207
-
208
- ```javascript
209
- // 设置键盘事件默认拦截浏览器默认行为。
210
- // preventKeys 中的将拦截,如果数组设置为空则全部不拦截
211
- // 默认拦截 F1 F5 F12
212
- larksr.op.keyboardHandler.preventKeys = [["F1", "F5", "F12"]];
213
- ```
214
-
215
- 操作类中添加 gestureHandler 公开访问,gestureHandler 处理将移动端触摸事件对应为鼠标事件的过程。
216
-
217
- 可用通过 gestureHandler 调节触摸事件触发参数
218
-
219
- ```javascript
220
- // 触摸事件在对应为鼠标事件中,提供的鼠标相对移动的速度。
221
- // rx = pxNew-pxOld * relativeMouseMoveSpeed
222
- // ry = pyNew-pyOld)* relativeMouseMoveSpeed
223
- // 可能会影响使用相对移动(rawInput)判断的云端应用的效果
224
- larksr.op.gestureHandler.relativeMouseMoveSpeed = 2;
225
- // 触摸模拟为鼠标事件时,模拟点击的判断范围。
226
- // 实际的鼠标事件点击时一般不会移动,而触摸操作基本上一定会触发移动事件
227
- // 如果要模拟PC上的击事件,比如单击或双击,在鼠标按下和抬起之间不应再插入鼠标移动
228
- // 当触发移动事件时,超出该判断范围才发送移动事件。
229
- // 注意,修改该值可能会导致云端应用上判断单击或双击失败,如果云端应用不包含类似操作基本影响不大
230
- larksr.op.gestureHandler.tapLimitRadius = 20;
231
- // 在该时间范围下将尝试发送单机按下事件,修改该值可能会导致单机事件的触发成功率
232
- larksr.op.gestureHandler.tapLimitTimeout = 100;
233
- ```
234
-
235
- 可用通过 gestureHandler 拦截触摸事件回调, 通过 `larksr.op.gestureHandler` 设置回调函数
236
-
237
- ## V3.2.322
238
-
239
- 1. 修复某些情况下后台设置的 LOGO 会闪一下默认 LOGO 的问题
240
- 2. 添加 `larksr.virtualCursorPosition` `larksr.virtualCursorPositionRaw` (省略 larksr 对象创建代码) 获取当前虚拟鼠标或者触摸点的位置。
241
-
242
- ## V3.2.324
243
-
244
- 1. 修复 iOS 屏幕高度判断问题
245
- 2. 添加获取应用列表接口 `API.GetAppliList(server: string, params: any);`
246
- 3. 添加获取区域列表接口 `API.RegionList(server: string, params: any);`
247
- 4. 添加获取后台配置UI接口 `larksr.getTouchCtrMapping()`
248
- 5. 添加 `RTMP_STREAM_STATE = "rtmpstreamstate"` 事件,返回云端直播推流事件
249
- 6. 添加 `RTMP_STREAM_ERROR = "rtmpstreamerror"` 事件,返回云端直播推流错误
250
- 7. 添加 `larksr.StartCloudLiveStreaming(params)` 接口,启动云端直播推流功能
251
- 8. 添加 `larksr.StopLiveStreaming()` 接口,关闭云端直播推流功能.
252
-
253
- ## V3.2.326
254
-
255
- 1. 截图接口 `captrueFrame(data: any, option?: { width: number; height: number;})` 添加 option 参数,可以设置截图的宽高
256
- 2. 添加 onlyHandleRootElementTransform 参数 `new LarkSR({ ... 此处省略其他配置 ... onlyHandleRootElementTransform: 0})`
257
-
258
- ```javascript
259
- /**
260
- * 是否只设置根的组件的旋转。只当 handleRootElementSize true 时有效。设置根组件的旋转用于 mobileForceLandscape 模式。
261
- * 默认为false,此时 SDK 会设置根组件的宽高,margin 0,padding 0
262
- * true并且handleRootElementSize也为true时,只设置根组件的旋转属性,用于强制横屏模式以及强制横屏竖屏的切换。
263
- * 要注意onlyHandleRootElementTransform开启成功时,要保证根节点的元素大小并且当根节点变化时应调用 resize 方法通知更新根节点的大小。
264
- */
265
- onlyHandleRootElementTransform?: boolean;
266
- ```
267
-
268
- ## V3.2.327
269
-
270
- 1. 添加方法 `larksr.updateServerAddress(serverAddress: string)`,可在 `new LarkSR()` 之后再更新服务器地址。用于需要异步设服务器地址的情况。
271
-
272
- ```javascript
273
- /**
274
- * 单独设置服务器地址,作用同 config 中的 serverAddress 字段
275
- * 在进入应用之前都可以更新。
276
- * @param serverAddress 服务器地址,如 http://192.168.0.55:8181/
277
- */
278
- updateServerAddress(serverAddress: string): void;
279
- ```
280
-
281
- ## V3.2.329
282
-
283
- 1. 添加自动播放参数参数 `new LarkSR({ ... 此处省略其他配置 ... autoPlay: true, showPlayButton: true})`
284
-
285
- SDK 内部添加播放按钮 UI,当自动播放失败或者手动播放模式时会显示出来,用户点击之后才会播放。
286
-
287
- 自动播放模式下会尽可能直接播放不用手动点,包括可能静音播放。
288
-
289
- ```javascript
290
- /**
291
- * 是否自动播放。默认开启。
292
- * 如果关闭,连接成功之后会有提示UI,用户手动触发。
293
- * 开启自动播放时也不能保证所有浏览器自动播放成功,当播放失败或者浏览器不支持自动播放时,
294
- * 也会显示播放按钮,用户点击播放按钮手动播放。
295
- */
296
- autoPlay?: boolean;
297
- /**
298
- * 在播放失败或者手动播放模式下是否显示播放的按钮。
299
- * 默认开启。要注意,如果关闭情况下要添加好提示或UI,引导用户点击播放。
300
- * UI中要让用户触发 larksr.videoComponent.playVideo();
301
- */
302
- showPlayButton?: boolean;
303
- ```
304
-
305
- 2. 添加语言配置参数 `new LarkSR({ ... 此处省略其他配置 ... language: true})`
306
-
307
- ```javascript
308
- /**
309
- * 语言设置,目前只支持种英文两种
310
- * zh-CN 中文 en 英文
311
- */
312
- language?: string;
313
- ```
314
-
315
- 3. 添加渲染资源不足事件,在 `larksr.connect` 方法和 `resourcenotenough` 事件时抛出。可以根据服务端返回的 code 码判断具体情况,提示用户或进行后续处理。
316
-
317
- `connect` 方法返回的 Promise:
318
-
319
- ```javascript
320
- /**
321
- * 连接云端渲染资源
322
- * @params appID 云端资源的 ID
323
- * @returns Promise 调用接口并校验授权通过返回成功并自动开始连接
324
- * Promise 返回的错误对象:
325
- * {
326
- // type 0 渲染资源不足导致的错误,1 其他错误, 可用 type == 0 判断是否是渲染资源不足类型的错误
327
- type: 0,
328
-
329
- // 渲染资源不足时的事件类型,其他情况可能不返回,比如网络错误
330
- eventType?:LarkSRClientEvent.RESOURCE_NOT_ENOUGH,
331
-
332
- // 服务端返回的错误码,服务端请求正确返回时存在。需要注意渲染资源不足类型的错误码。
333
- // 可用 type == 0 判断是否是渲染资源不足类型的错误,再用 code 进行细节处理,或者只用 type == 0 进行处理。
334
- // 813=当前应用的运行数量已达到最大值:{0},请稍后再试
335
- // 814=同一appKey下的应用运行数量达到最大值:{0},请稍后再试
336
- // 815=应用运行数量已达到最大授权并发数量,请稍后再试
337
- // 816=VR应用运行数量已达到最大授权并发数量,请稍后再试
338
- // 817=渲染资源不足,请稍后再试
339
- // 820=暂无活跃的GPU节点
340
- // 821=节点资源使用率已达到设置的阈值
341
- // 823=单节点运行应用数量已达到单节点最大授权并发数量,请稍后再试
342
- code?: 817,
343
-
344
- // 错误信息
345
- message:? "",
346
- }
347
- *
348
- */
349
- connect(params: {
350
- appliId: string;
351
- playerMode?: number;
352
- userType?: number;
353
- roomCode?: string;
354
- taskId?: string;
355
- clientMac?: string;
356
- groupId?: string;
357
- regionId?: string;
358
- targetServerIp?: string;
359
- appKey?: string;
360
- timestamp?: string;
361
- signature?: string;
362
- }): Promise<void>;
363
- ```
364
-
365
- 或者单独监听 `resourcenotenough`:
366
-
367
- ```javascript
368
- /**
369
- * 渲染资源不足
370
- * {
371
- // 服务端返回的错误码,服务端请求正确返回时存在。需要注意渲染资源不足类型的错误码。
372
- // 可用 type == 0 判断是否是渲染资源不足类型的错误,再用 code 进行细节处理,或者只用 type == 0 进行处理。
373
- // 813=当前应用的运行数量已达到最大值:{0},请稍后再试
374
- // 814=同一appKey下的应用运行数量达到最大值:{0},请稍后再试
375
- // 815=应用运行数量已达到最大授权并发数量,请稍后再试
376
- // 816=VR应用运行数量已达到最大授权并发数量,请稍后再试
377
- // 817=渲染资源不足,请稍后再试
378
- // 820=暂无活跃的GPU节点
379
- // 821=节点资源使用率已达到设置的阈值
380
- // 823=单节点运行应用数量已达到单节点最大授权并发数量,请稍后再试
381
- code?: 817,
382
-
383
- // 错误信息
384
- message:? "",
385
- }
386
- *
387
- */
388
- RESOURCE_NOT_ENOUGH = 'resourcenotenough',
389
- ```
390
-
391
- ```javascript
392
- // 此处省略 larksr 创建过程
393
- // 监听连接成功事件
394
- larksr.on('resourcenotenough', function(e) {
395
- console.log("LarkSRClientEvent RESOURCE_NOT_ENOUGH", e);
396
- });
397
- ```
398
-
399
- ## V3.2.331
400
-
401
- 1. 优化自动播放模式下播放按钮出现时机,添加载入超时设置 `new LarkSR({ ... 此处省略其他配置 ... playTimeout: 20 })`
402
- 2. 修复不支持 WebRTC 情况下未抛出错误事件的问题。对应错误码为 603, `error` 事件可能的错误码如下:
403
-
404
- ```javascript
405
- /**
406
- * 发生错误时抛出
407
- * type: error
408
- * message: 错误消息
409
- * code: 可能的错误码如下, 错误码的具体定义 @see [./event_codes]
410
- * // 连接服务器的websocket代理关闭
411
- * LK_RENDER_SERVER_CLOSE : 102
412
- * // 连接代理服务器的websocket关闭
413
- * LK_PROXY_SERVER_CLOSE : 202
414
- * // 检测版本失败,服务器和客户端的版本匹配。目前只有3.13.2大版本不匹配情况
415
- * LK_VERSION_CHECK_FAILED : 301
416
- * // 服务器返回创建Task失败
417
- * TASK_NOTFOUND-TASK_NO_GPU_RESOURCE : 401-404
418
- * // 服务端启动流媒体失败
419
- * LK_START_STREAM_PROCESS_START-FAILED-LK_START_STREAM_ENCODER_ERROR : 501-504
420
- * // RTC 连接关闭
421
- * LK_RTC_EVENT_PEERCONNECTION_CLOSED : 601
422
- * // RTC 连接出错
423
- * LK_RTC_EVENT_PEERCONNECTION_ERROR : 602
424
- * // RTC 创建出错,一般为 浏览器不支持 webrtc
425
- * LK_RTC_EVENT_PEERCONNECTION_CREATE_FAILED : 603
426
- * // 服务器主动要求客户端退出
427
- * LK_NOTIFY_CLIENT_LOGOUT_PLAYER_LOGOUT : 800
428
- * // 一人操作多人看房主退出
429
- * LK_NOTIFY_CLIENT_LOGOUT_TASKOWNER_LOGOUT : 801
430
- *
431
- */
432
- ERROR = 'error',
433
- ```
434
-
435
- ## V3.2.334
436
-
437
- 优化打开媒体通道实现流程,优化重复打开媒体设备或切换媒体设备效果。添加单独媒体上传通道(单独上传流程要求渲染服务器版本大于3290)。
438
-
439
- 1. 添加配置项, useSeparateMediaSharePeer,配置是否使用单独的媒体上传通道(摄像头麦克风上传)。默认开启,如果需要使用旧版本服务端应关闭该项。 `new LarkSR({ ... 此处省略其他配置 ... useSeparateMediaSharePeer: true })`
440
- 2. 添加 `pauseVideoSending/resumeVideoSending`,`pauseAudioSending/resumeAudioSending` 暂停和恢复摄像头或者麦克风上传。
441
- 3. 添加 `closeMediaChannel` 关闭单独的媒体上传通道。仅当 useSeparateMediaSharePeer true 时有效。
442
- 4. `openVideo` 接口添加 `openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number)` 宽高参数,限定打开摄像头设备的宽高
443
-
444
- ## V3.2.337
445
-
446
- 1. 配合服务端升级协议.
447
- 2. 修复其他问题.
448
-
449
- ## V3.3.342
450
-
451
- 1. 配合服务端升级,添加 `larksr.serverFeatures` 返回服务端支持特性
452
- 2. 移动端打开摄像头会根据屏幕旋转旋转摄像头画面方向
453
- 3. `openVideo` 接口可以传参数指定是否是前置摄像头 `openVideo(audio: boolean = false, cameraId: string = '', width: number = 0, height: number = 0, front?: boolean)`
454
- 4. 获取后台应用参数 `larksr.params.mobileKeyboardType`
455
-
456
- ## V3.2.343
457
-
458
- 1. 添加配置项 `new LarkSR({ ... 此处省略其他配置 ... enableCanvasRender: false })` 开启或关闭 canvas 渲染模式。默认关闭。要注意移动端开启 canvas 会消耗额外性能。
459
- 2. 优化显示效果。
460
- 3. 优化显示宽高计算方式。
461
-
462
- > 已知问题: iOS 在关闭 canvas 模式下,忽略宽高比的拉伸模式无效。
1
+ # Update
2
+
3
+ ## V3.2.30
4
+
5
+ > V3.2.30 only supports server versions [V3.2.3.1](https://www.pingxingyun.com/devCenter.html) and above.
6
+ > [Download old version SDK Demo](https://github.com/ParaverseTechnology/lark_sr_websdk_demos/releases/tag/V3.2.10)
7
+
8
+ 1. [Added Pixel Streaming support](https://docs.unrealengine.com/4.27/en-US/SharingAndReleasing/PixelStreaming/PixelStreamingIntro/).
9
+ 2. Improved security by adding SDK ID encryption configuration.
10
+ 3. Removed the functions CreateLarkSRClientFromePXYHost, CreateLarkSRClientFromeAPI, and CreateLarkSRClientFromeUrl. Use `new LarkSR(config: ILarkSRConfig)` to create objects directly.
11
+
12
+ ## V3.2.33
13
+
14
+ 1. Added intelligent voice-related interface support
15
+
16
+ LarkSR object additions:
17
+
18
+ ```typescript
19
+ /**
20
+ * Start intelligent voice dialogue text input
21
+ * Should start input when intelligent voice is in the start state
22
+ * @param text Input text
23
+ * @returns Returns dialogue ID
24
+ */
25
+ public aiDmTextInput(text: string) {
26
+ /**
27
+ * Start intelligent voice dialogue voice input, automatically request recording permission
28
+ * Should start input when intelligent voice is in the start state
29
+ * @returns Returns dialogue ID on success, throws an exception on failure
30
+ */
31
+ public startAiDmVoiceInput() {
32
+
33
+ /**
34
+ * Stop intelligent voice input, notify the voice engine that the current user input dialogue has ended
35
+ * @returns Returns the current dialogue ID
36
+ */
37
+ public stopAiDmVoiceInput() {
38
+ ```
39
+
40
+ LarkSR added the following events:
41
+
42
+ ```typescript
43
+ larksr.on('aivoicestatus', (e) => {
44
+ // Intelligent voice service status
45
+ });
46
+
47
+ larksr.on('aivoiceasrresult', (e) => {
48
+ // Intelligent voice to text recognition result
49
+ });
50
+
51
+ larksr.on('aivoicedmresult', (e) => {
52
+ // Intelligent voice dialogue result
53
+ });
54
+ ```
55
+
56
+ ## V3.2.37
57
+
58
+ ```typescript
59
+ /**
60
+ * Set whether to force landscape display content.
61
+ * handelRootElementSize must be set to true to take effect.
62
+ * Note that in forced landscape mode, the coordinate system of the webpage is opposite to the visual one. If input events are passed through external input, adjustments should be made.
63
+ * @param force Whether to force landscape
64
+ */
65
+ setMobileForceLandScape(force: boolean): void;
66
+ ```
67
+
68
+ ## V3.2.311
69
+
70
+ Added microphone input interface. After the client is turned on, the cloud application can directly receive audio by reading the microphone on the sound card.
71
+
72
+ > The minimum server version that matches this feature is V3.2.51
73
+ > To use this feature, enable the audio input function in the background application management
74
+ > Note that the media device should be turned on after the connection is successful. That is, it is only effective after calling `mediaPlayed`
75
+
76
+ ```typescript
77
+ /**
78
+ * Turn on an audio device. Note that the browser restricts opening audio only under https or localhost.
79
+ * @param deviceId Audio device ID. If not provided, the default device will be opened. @see getConnectedAudioinputDevices
80
+ * @returns
81
+ */
82
+ openAudio(deviceId?: string);
83
+ /**
84
+ * Turn off the current audio device
85
+ * @returns
86
+ */
87
+ closeAudio(): boolean | undefined;
88
+ /**
89
+ * Return the list of connected audio devices. The device ID in the device list can be used to open a specific audio device.
90
+ * @returns
91
+ */
92
+ getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
93
+ /**
94
+ * Set whether the currently enabled audio track is enabled
95
+ * @param enable Whether to enable
96
+ * @returns
97
+ */
98
+ setAudioEnable(enable: boolean): void or undefined;
99
+ ```
100
+
101
+ LarkSR configuration item added automatic microphone configuration. Pass in `new LarkSR({ ... other configurations omitted ... audioInputAutoStart: true})`,
102
+
103
+ > Manually passed `audioInputAutoStart` has a higher priority than background configuration
104
+
105
+ ```javascript
106
+ /**
107
+ * When the audio input function is enabled, whether to automatically connect to the audio device.
108
+ * Default is off.
109
+ * Note that the default is to open the default audio device in the system.
110
+ */
111
+ audioInputAutoStart?: boolean;
112
+ ```
113
+
114
+ ## V3.2.319
115
+
116
+ Added video input interface. After the client is turned on, the cloud application can directly receive video data by reading the camera on the server.
117
+
118
+ > The minimum server version that matches this feature is V3.2.61
119
+ > To use this feature, enable the video input function in the background application management
120
+ > Note that the media device should be turned on after the connection is successful. That is, it is only effective after calling `mediaPlayed`
121
+
122
+ ```typescript
123
+ /**
124
+ * Turn on a video device. Note that the browser restricts opening video only under https or localhost.
125
+ * @param audio boolean Whether to enable audio at the same time
126
+ * @param cameraId Video device ID. If not provided, the default device will be opened. @see getConnectedVideoinputDevices
127
+ * @returns Promise
128
+ */
129
+ openVideo(audio?: boolean, cameraId?: string);
130
+ /**
131
+ * Turn on the default media device. Note that the browser restricts opening only under https or localhost.
132
+ * If you need to specify a special media device, please use @see openAudio @see openVideo separately
133
+ * @param video Whether to include video
134
+ * @param audio Whether to include audio
135
+ * @returns Promise
136
+ */
137
+ openDefaultMedia(video?: boolean, audio?: boolean)>;
138
+ /**
139
+ * Return the list of connected video devices
140
+ * @returns Promise<MediaDeviceInfo[]>
141
+ */
142
+ getConnectedVideoinputDevices();
143
+ /**
144
+ * Set whether the currently enabled video track is enabled
145
+ * @param enable Whether to enable
146
+ * @returns void
147
+ */
148
+ setVideoEnable(enable: boolean);
149
+ ```
150
+
151
+ LarkSR configuration item added automatic video input configuration. Pass in `new LarkSR({ ... other configurations omitted ... videoInputAutoStart: true})`,
152
+
153
+ > Manually passed `videoInputAutoStart` has a higher priority than background configuration
154
+
155
+ ```javascript
156
+ /**
157
+ * When the video input function is enabled, whether to automatically connect to the video device.
158
+ * Default is off.
159
+ * Note that the default is to open the default video device in the system.
160
+ */
161
+ videoInputAutoStart?: boolean;
162
+ ```
163
+
164
+ ## V3.2.321
165
+
166
+ LarkSR configuration item added default zoom gesture and mouse wheel correspondence and whether to use touch screen mode. Pass in `new LarkSR({ ... other configurations omitted ... mouseZoomDirection: 0, touchOperateMode: "mouse"})`,
167
+
168
+ > Manually passed configuration has a higher priority than background configuration
169
+
170
+ ```javascript
171
+ /**
172
+ * mouseZoomDirection
173
+ * Used for the correspondence between pinch zoom operation on mobile and mouse zoom in the application
174
+ * 1: Mouse wheel up to zoom in,
175
+ * 0: Mouse wheel down to zoom in (default)
176
+ */
177
+ mouseZoomDirection?: number;
178
+ /**
179
+ * Touch instruction mode, corresponding to the background application management->application editing->mobile advanced settings->touch instruction mode. Has a higher priority than background configuration
180
+ * Touch instruction, the touch instruction on the mobile corresponds to the touch screen or mouse on the cloud
181
+ * 'touchScreen' | 'mouse'
182
+ */
183
+ touchOperateMode?: 'touchScreen' | 'mouse';
184
+ ```
185
+
186
+ The captrueFrame method will bring out the screenshot through the return value
187
+
188
+ ```javascript
189
+ /**
190
+ * Capture a frame of image
191
+ * @params data: any Additional data thrown when the capture event is thrown, such as the capture timestamp
192
+ * @return { data: any, base64: base64string } Returns the input data and the captured base64 string
193
+ */
194
+ captrueFrame(data: any)
195
+ ```
196
+
197
+ Added destroy method. Note that after destruction, the larksr object is no longer available
198
+
199
+ ```javascript
200
+ /**
201
+ * Remove the rendering component from the DOM. Note that after deleting the rendering component, you will not be able to enter the application again. All states will be invalid and cannot be restored. You can only re-new LarkSR
202
+ */
203
+ destroy(): void;
204
+ ```
205
+
206
+ Added keyboardhandler in the operation class for open access. You can configure which keys' default behavior to intercept
207
+
208
+ ```javascript
209
+ // Set the default interception of browser default behavior for keyboard events.
210
+ // The ones in preventKeys will be intercepted. If the array is set to empty, none will be intercepted
211
+ // Default intercepts F1 F5 F12
212
+ larksr.op.keyboardHandler.preventKeys = [["F1", "F5", "F12"]];
213
+ ```
214
+
215
+ Added gestureHandler in the operation class for open access. gestureHandler handles the process of mapping touch events on mobile to mouse events.
216
+
217
+ You can adjust the touch event trigger parameters through gestureHandler
218
+
219
+ ```javascript
220
+ // The speed of the mouse relative movement provided when the touch event is mapped to the mouse event.
221
+ // That is, rx = (pxNew-pxOld) * relativeMouseMoveSpeed
222
+ // ry = (pyNew-pyOld) * relativeMouseMoveSpeed
223
+ // May affect the effect of cloud applications that use relative movement (rawInput) judgment
224
+ larksr.op.gestureHandler.relativeMouseMoveSpeed = 2;
225
+ // When the touch event is simulated as a mouse event, the judgment range of the simulated click.
226
+ // Actual mouse events generally do not move when clicked, while touch operations will basically trigger move events
227
+ // If you want to simulate click events on a PC, such as single or double click, no mouse move should be inserted between mouse down and up
228
+ // When the move event is triggered, the move event is sent only when it exceeds this judgment range.
229
+ // Note that modifying this value may cause the cloud application to fail to judge single or double clicks. If the cloud application does not include similar operations, it will not have much impact
230
+ larksr.op.gestureHandler.tapLimitRadius = 20;
231
+ // Within this time range, a single click down event will be attempted. Modifying this value may affect the success rate of triggering single click events
232
+ larksr.op.gestureHandler.tapLimitTimeout = 100;
233
+ ```
234
+
235
+ You can intercept touch event callbacks through gestureHandler. Set the callback function through `larksr.op.gestureHandler`
236
+
237
+ ## V3.2.322
238
+
239
+ 1. Fixed the issue where the background set LOGO would flash the default LOGO in some cases
240
+ 2. Added `larksr.virtualCursorPosition` and `larksr.virtualCursorPositionRaw` (larksr object creation code omitted) to get the current position of the virtual mouse or touch point.
241
+
242
+ ## V3.2.324
243
+
244
+ 1. Fixed iOS screen height judgment issue
245
+ 2. Added get application list interface `API.GetAppliList(server: string, params: any);`
246
+ 3. Added get region list interface `API.RegionList(server: string, params: any);`
247
+ 4. Added get background configuration UI interface `larksr.getTouchCtrMapping()`
248
+ 5. Added `RTMP_STREAM_STATE = "rtmpstreamstate"` event, returns cloud live streaming event
249
+ 6. Added `RTMP_STREAM_ERROR = "rtmpstreamerror"` event, returns cloud live streaming error
250
+ 7. Added `larksr.StartCloudLiveStreaming(params)` interface, start cloud live streaming function
251
+ 8. Added `larksr.StopLiveStreaming()` interface, close cloud live streaming function.
252
+
253
+ ## V3.2.326
254
+
255
+ 1. The screenshot interface `captrueFrame(data: any, option?: { width: number; height: number;})` added option parameter, which can set the width and height of the screenshot
256
+ 2. Added onlyHandleRootElementTransform parameter `new LarkSR({ ... other configurations omitted ... onlyHandleRootElementTransform: 0})`
257
+
258
+ ```javascript
259
+ /**
260
+ * Whether to only set the rotation of the root component. Only effective when handleRootElementSize is true. Setting the rotation of the root component is used for mobileForceLandscape mode.
261
+ * Default is false. At this time, the SDK will set the width and height of the root component, margin 0, padding 0
262
+ * When true and handleRootElementSize is also true, only the rotation attribute of the root component is set, which is used for forced landscape mode and forced landscape and portrait switching.
263
+ * Note that when onlyHandleRootElementTransform is successfully enabled, the size of the root element should be ensured, and when the root element changes, the resize method should be called to notify the update of the root element size.
264
+ */
265
+ onlyHandleRootElementTransform?: boolean;
266
+ ```
267
+
268
+ ## V3.2.327
269
+
270
+ 1. Added method `larksr.updateServerAddress(serverAddress: string)`, which can update the server address after `new LarkSR()`. Used for situations where the server address needs to be set asynchronously.
271
+
272
+ ```javascript
273
+ /**
274
+ * Set the server address separately, the same effect as the serverAddress field in the config
275
+ * Can be updated before entering the application.
276
+ * @param serverAddress Server address, such as http://192.168.0.55:8181/
277
+ */
278
+ updateServerAddress(serverAddress: string): void;
279
+ ```
280
+
281
+ ## V3.2.329
282
+
283
+ 1. Added autoplay parameter `new LarkSR({ ... other configurations omitted ... autoPlay: true, showPlayButton: true})`
284
+
285
+ The SDK internally adds a play button UI. When autoplay fails or in manual play mode, it will be displayed. The user needs to click to play.
286
+
287
+ In autoplay mode, it will try to play directly without manual click, including possibly playing muted.
288
+
289
+ ```javascript
290
+ /**
291
+ * Whether to autoplay. Default is on.
292
+ * If turned off, there will be a prompt UI after the connection is successful, and the user needs to trigger it manually.
293
+ * When autoplay is enabled, it cannot guarantee that all browsers will autoplay successfully. When playback fails or the browser does not support autoplay,
294
+ * the play button will also be displayed, and the user needs to click the play button to play manually.
295
+ */
296
+ autoPlay?: boolean;
297
+ /**
298
+ * Whether to display the play button when playback fails or in manual play mode.
299
+ * Default is on. Note that if it is turned off, you need to add prompts or UI to guide the user to click to play.
300
+ * In the UI, the user needs to trigger larksr.videoComponent.playVideo();
301
+ */
302
+ showPlayButton?: boolean;
303
+ ```
304
+
305
+ 2. Added language configuration parameter `new LarkSR({ ... other configurations omitted ... language: true})`
306
+
307
+ ```javascript
308
+ /**
309
+ * Language setting, currently only supports Chinese and English
310
+ * zh-CN Chinese en English
311
+ */
312
+ language?: string;
313
+ ```
314
+
315
+ 3. Added rendering resource insufficient event, thrown when `larksr.connect` method and `resourcenotenough` event. You can judge the specific situation based on the code returned by the server, prompt the user or perform subsequent processing.
316
+
317
+ `connect` method returns a Promise:
318
+
319
+ ```javascript
320
+ /**
321
+ * Connect to cloud rendering resources
322
+ * @params appID Cloud resource ID
323
+ * @returns Promise Call the interface and verify the authorization to return success and automatically start the connection
324
+ * Promise returns an error object:
325
+ * {
326
+ // type 0 Rendering resource insufficient error, 1 Other errors, can use type == 0 to judge whether it is a rendering resource insufficient error
327
+ type: 0,
328
+
329
+ // Event type when rendering resources are insufficient, other situations may not return, such as network errors
330
+ eventType?:LarkSRClientEvent.RESOURCE_NOT_ENOUGH,
331
+
332
+ // Error code returned by the server, exists when the server request is correct. Note the error code for rendering resource insufficiency.
333
+ // Can use type == 0 to judge whether it is a rendering resource insufficient error, and then use code for detailed processing, or only use type == 0 for processing.
334
+ // 813=The number of running applications has reached the maximum value: {0}, please try again later
335
+ // 814=The number of running applications under the same appKey has reached the maximum value: {0}, please try again later
336
+ // 815=The number of running applications has reached the maximum authorized concurrency, please try again later
337
+ // 816=The number of running VR applications has reached the maximum authorized concurrency, please try again later
338
+ // 817=Rendering resources are insufficient, please try again later
339
+ // 820=No active GPU nodes
340
+ // 821=Node resource usage has reached the set threshold
341
+ // 823=The number of running applications on a single node has reached the maximum authorized concurrency, please try again later
342
+ code?: 817,
343
+
344
+ // Error message
345
+ message:? "",
346
+ }
347
+ *
348
+ */
349
+ connect(params: {
350
+ appliId: string;
351
+ playerMode?: number;
352
+ userType?: number;
353
+ roomCode?: string;
354
+ taskId?: string;
355
+ clientMac?: string;
356
+ groupId?: string;
357
+ regionId?: string;
358
+ targetServerIp?: string;
359
+ appKey?: string;
360
+ timestamp?: string;
361
+ signature?: string;
362
+ }): Promise<void>;
363
+ ```
364
+
365
+ Or listen to `resourcenotenough` separately:
366
+
367
+ ```javascript
368
+ /**
369
+ * Rendering resources are insufficient
370
+ * {
371
+ // Error code returned by the server, exists when the server request is correct. Note the error code for rendering resource insufficiency.
372
+ // Can use type == 0 to judge whether it is a rendering resource insufficient error, and then use code for detailed processing, or only use type == 0 for processing.
373
+ // 813=The number of running applications has reached the maximum value: {0}, please try again later
374
+ // 814=The number of running applications under the same appKey has reached the maximum value: {0}, please try again later
375
+ // 815=The number of running applications has reached the maximum authorized concurrency, please try again later
376
+ // 816=The number of running VR applications has reached the maximum authorized concurrency, please try again later
377
+ // 817=Rendering resources are insufficient, please try again later
378
+ // 820=No active GPU nodes
379
+ // 821=Node resource usage has reached the set threshold
380
+ // 823=The number of running applications on a single node has reached the maximum authorized concurrency, please try again later
381
+ code?: 817,
382
+
383
+ // Error message
384
+ message:? "",
385
+ }
386
+ *
387
+ */
388
+ RESOURCE_NOT_ENOUGH = 'resourcenotenough',
389
+ ```
390
+
391
+ ```javascript
392
+ // larksr creation process omitted
393
+ // Listen to the connection success event
394
+ larksr.on('resourcenotenough', function(e) {
395
+ console.log("LarkSRClientEvent RESOURCE_NOT_ENOUGH", e);
396
+ });
397
+ ```
398
+
399
+ ## V3.2.331
400
+
401
+ 1. Optimized the timing of the play button appearance in autoplay mode, added load timeout setting `new LarkSR({ ... other configurations omitted ... playTimeout: 20 })`
402
+ 2. Fixed the issue where an error event was not thrown when WebRTC was not supported. The corresponding error code is 603, and the possible error codes for the `error` event are as follows:
403
+
404
+ ```javascript
405
+ /**
406
+ * Thrown when an error occurs
407
+ * type: error
408
+ * message: Error message
409
+ * code: Possible error codes are as follows, the specific definition of error codes @see [./event_codes]
410
+ * // The websocket proxy connected to the server is closed
411
+ * LK_RENDER_SERVER_CLOSE : 102
412
+ * // The websocket connected to the proxy server is closed
413
+ * LK_PROXY_SERVER_CLOSE : 202
414
+ * // Version check failed, the server and client versions do not match. Currently, only major version mismatches between 3.1 and 3.2
415
+ * LK_VERSION_CHECK_FAILED : 301
416
+ * // The server returns a failure to create a Task
417
+ * TASK_NOTFOUND-TASK_NO_GPU_RESOURCE : 401-404
418
+ * // The server failed to start the streaming process
419
+ * LK_START_STREAM_PROCESS_START-FAILED-LK_START_STREAM_ENCODER_ERROR : 501-504
420
+ * // RTC connection closed
421
+ * LK_RTC_EVENT_PEERCONNECTION_CLOSED : 601
422
+ * // RTC connection error
423
+ * LK_RTC_EVENT_PEERCONNECTION_ERROR : 602
424
+ * // RTC creation error, generally the browser does not support webrtc
425
+ * LK_RTC_EVENT_PEERCONNECTION_CREATE_FAILED : 603
426
+ * // The server actively requests the client to log out
427
+ * LK_NOTIFY_CLIENT_LOGOUT_PLAYER_LOGOUT : 800
428
+ * // The host exits in one-person operation and multi-person viewing
429
+ * LK_NOTIFY_CLIENT_LOGOUT_TASKOWNER_LOGOUT : 801
430
+ *
431
+ */
432
+ ERROR = 'error',
433
+ ```
434
+
435
+ ## V3.2.334
436
+
437
+ Optimized the implementation process of opening the media channel, optimized the effect of repeatedly opening media devices or switching media devices. Added a separate media upload channel (the separate upload process requires the rendering server version to be greater than 3290).
438
+
439
+ 1. Added configuration item, useSeparateMediaSharePeer, configure whether to use a separate media upload channel (camera and microphone upload). Default is on. If you need to use the old version of the server, you should turn off this item. `new LarkSR({ ... other configurations omitted ... useSeparateMediaSharePeer: true })`
440
+ 2. Added `pauseVideoSending/resumeVideoSending`, `pauseAudioSending/resumeAudioSending` to pause and resume camera or microphone upload.
441
+ 3. Added `closeMediaChannel` to close the separate media upload channel. Only effective when useSeparateMediaSharePeer is true.
442
+ 4. The `openVideo` interface added `openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number)` width and height parameters to limit the width and height of the camera device
443
+
444
+ ## V3.2.337
445
+
446
+ 1. Cooperate with the server to upgrade the protocol.
447
+ 2. Fixed other issues.
448
+
449
+ ## V3.3.342
450
+
451
+ 1. Cooperate with the server upgrade, added `larksr.serverFeatures` to return server-supported features
452
+ 2. When the camera is turned on on the mobile, the camera screen direction will be rotated according to the screen rotation
453
+ 3. The `openVideo` interface can pass parameters to specify whether it is the front camera `openVideo(audio: boolean = false, cameraId: string = '', width: number = 0, height: number = 0, front?: boolean)`
454
+ 4. Get background application parameters `larksr.params.mobileKeyboardType`
455
+
456
+ ## V3.2.343
457
+
458
+ 1. Added configuration item `new LarkSR({ ... other configurations omitted ... enableCanvasRender: false })` to enable or disable canvas rendering mode. Default is off. Note that enabling canvas on mobile will consume additional performance.
459
+ 2. Optimized display effect.
460
+ 3. Optimized display width and height calculation method.
461
+
462
+ > Known issue: On iOS, the stretch mode that ignores the aspect ratio is invalid when canvas mode is turned off.