larksr_websdk 3.3.113 → 3.3.114

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.
@@ -1,462 +1,462 @@
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.
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.