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,603 +1,603 @@
1
- # LarkSR Object Member Methods
2
-
3
- LarkSR object member methods are mainly divided into the following three categories
4
-
5
- ## Control flow methods, including start, stop, restart, register authorization code, etc.
6
-
7
- ```typescript
8
- /**
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
- */
13
- updateServerAddress(serverAddress: string): void;
14
- /**
15
- *
16
- * @param id sdk id Initialize sdk id
17
- * @returns
18
- */
19
- initSDKAuthCode(id: string): Promise<void>;
20
- /**
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
- */
26
- connectWithPxyHost(params: {
27
- appliId: string;
28
- playerMode?: number;
29
- userType?: number;
30
- roomCode?: string;
31
- taskId?: string;
32
- regionId?: string;
33
- groupId?: string;
34
- }): Promise<void>;
35
- /**
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
- * {
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
- type: 0,
43
-
44
- // Event type when rendering resources are insufficient, may not return in other cases, such as network errors
45
- eventType?:LarkSRClientEvent.RESOURCE_NOT_ENOUGH,
46
-
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
- code?: 817,
58
-
59
- // Error message
60
- message:? "",
61
- }
62
- *
63
- */
64
- connect(params: {
65
- appliId: string;
66
- playerMode?: number;
67
- userType?: number;
68
- roomCode?: string;
69
- taskId?: string;
70
- clientMac?: string;
71
- groupId?: string;
72
- regionId?: string;
73
- targetServerIp?: string;
74
- appKey?: string;
75
- timestamp?: string;
76
- signature?: string;
77
- } | any): Promise<void>;
78
- /**
79
- * Restart the cloud rendering process
80
- */
81
- restart(): void;
82
- /**
83
- * Restart the cloud application
84
- */
85
- restartApp(): void;
86
- /**
87
- * Actively close the connection
88
- */
89
- close(): void;
90
- ```
91
-
92
- ## Input and output related methods, including mouse, keyboard, gamepad, touch
93
-
94
- ```typescript
95
- /**
96
- * Switch the current operator
97
- * @param uid User id
98
- */
99
- changeOperater(uid: number): void;
100
- /**
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
- */
104
- inputText(text: string): void;
105
- /**
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
- */
112
- sendInput(input: CloudLark.IClientInput): void;
113
- /**
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
- *
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
- */
125
- mouseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
126
- /**
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
- *
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
- */
138
- moseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
139
- /**
140
- * Send mouse click event to the cloud
141
- * X Y coordinate calculation method is the same as mouseMove
142
- *
143
- * @param PosX Mouse X coordinate relative to the cloud
144
- * @param PosY Mouse Y coordinate relative to the cloud
145
- * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
146
- */
147
- mouseTap(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
148
- /**
149
- * Send mouse down event to the cloud
150
- * X Y coordinate calculation method is the same as mouseMove
151
- *
152
- * @param PosX Mouse X coordinate relative to the cloud
153
- * @param PosY Mouse Y coordinate relative to the cloud
154
- * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
155
- */
156
- mouseDown(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
157
- /**
158
- * Send mouse up event to the cloud
159
- * X Y coordinate calculation method is the same as mouseMove
160
- *
161
- * @param PosX Mouse X coordinate relative to the cloud
162
- * @param PosY Mouse Y coordinate relative to the cloud
163
- * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
164
- */
165
- mouseUp(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
166
- /**
167
- * Send mouse wheel event to the cloud
168
- * X Y coordinate calculation method is the same as mouseMove
169
- *
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
- */
174
- mouseWheel(PosX: number, PosY: number, Delata: number): void;
175
- /**
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
- */
181
- keyDown(key: string, isRepeat: boolean): void;
182
- /**
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
- */
187
- keyUp(key: string): void;
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
- * export const enum XINPUT_BUTTONS {
196
- * XINPUT_GAMEPAD_DPAD_UP = 0x0001,
197
- * XINPUT_GAMEPAD_DPAD_DOWN = 0x0002,
198
- * XINPUT_GAMEPAD_DPAD_LEFT = 0x0004,
199
- * XINPUT_GAMEPAD_DPAD_RIGHT = 0x0008,
200
- * XINPUT_GAMEPAD_START = 0x0010,
201
- * XINPUT_GAMEPAD_BACK = 0x0020,
202
- * XINPUT_GAMEPAD_LEFT_THUMB = 0x0040,
203
- * XINPUT_GAMEPAD_RIGHT_THUMB = 0x0080,
204
- * XINPUT_GAMEPAD_LEFT_SHOULDER = 0x0100,
205
- * XINPUT_GAMEPAD_RIGHT_SHOULDER = 0x0200,
206
- * XINPUT_GAMEPAD_A = 0x1000,
207
- * XINPUT_GAMEPAD_B = 0x2000,
208
- * XINPUT_GAMEPAD_X = 0x4000,
209
- * XINPUT_GAMEPAD_Y = 0x8000,
210
- * XINPUT_UNKNOWN = -1,
211
- * }
212
- * @param isRepeat Whether to repeat
213
- * @returns
214
- */
215
- gamepadButtonDown(userIndex: number, button: number, isRepeat: boolean): void;
216
- /**
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
- * @returns
222
- */
223
- gamepadButtonUp(userIndex: number, button: number): void;
224
- /**
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
- * @returns
231
- */
232
- gamepadTrigger(userIndex: number, isleft: boolean, value: number): void;
233
- /**
234
- * Send gamepad joystick values to the cloud, i.e., axes values
235
- * win MAX
236
- * |
237
- * MIN-------------MAX
238
- * |
239
- * MIN
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
- * @returns
247
- */
248
- joystick(userIndex: number, thumblx: number, thumbly: number, thumbrx: number, thumbry: number): void;
249
- /**
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
- * @returns
256
- */
257
- touchDown(id: number, x: number, y: number): void;
258
- /**
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
- * @returns
265
- */
266
- touchMove(id: number, x: number, y: number): void;
267
- /**
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
- * @returns
274
- */
275
- touchUp(id: number, x: number, y: number): void;
276
- /**
277
- * Convert string to input mouse button value
278
- * @param button 'left' | 'mid' | 'right'
279
- * @returns LEFT = 0,RIGHT = 1,MIDDLE = 2
280
- */
281
- getMouseButtonType(button: 'left' | 'mid' | 'right'): CloudLark.MouseKey;
282
- ```
283
-
284
- ## Data channel extension, send data to the cloud application data channel
285
-
286
- ```typescript
287
- /**
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
- */
293
- sendTextToDataChannel(text: string): void;
294
- /**
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
- */
299
- sendBinaryToDataChannel(binary: Uint8Array): void;
300
- ```
301
-
302
- ## Intelligent voice related interfaces
303
-
304
- ```typescript
305
- /**
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
- */
311
- aiDmTextInput(text: string): number;
312
- /**
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
- */
317
- startAiDmVoiceInput(): Promise<number>;
318
- /**
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
- */
322
- stopAiDmVoiceInput(): number;
323
- ```
324
-
325
- LarkSR adds the following events to get the status of the intelligent voice service:
326
-
327
- ```typescript
328
- larksr.on('aivoicestatus', (e) => {
329
- // Intelligent voice service status
330
- });
331
-
332
- larksr.on('aivoiceasrresult', (e) => {
333
- // Intelligent voice to text recognition result
334
- });
335
-
336
- larksr.on('aivoicedmresult', (e) => {
337
- // Intelligent voice dialogue result
338
- });
339
- ```
340
-
341
- ## Microphone input interface
342
-
343
- After the client is turned on, the cloud application can directly receive audio by reading the microphone on the sound card.
344
-
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
-
349
- ```typescript
350
- /**
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
- * @returns
354
- */
355
- openAudio(deviceId?: string);
356
- /**
357
- * Turn off the current audio device
358
- * @returns
359
- */
360
- closeAudio(): boolean | undefined;
361
- /**
362
- * Pause sending audio
363
- * @returns
364
- */
365
- pauseAudioSending(): any;
366
- /**
367
- * Resume sending audio
368
- * @returns
369
- */
370
- resumeAudioSending(): any;
371
- /**
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
- * @returns
374
- */
375
- getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
376
- /**
377
- * Set whether the currently opened audio track is enabled
378
- * @param enable Whether to enable
379
- * @returns
380
- */
381
- setAudioEnable(enable: boolean): void | undefined;
382
-
383
- /**
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
- */
390
- openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
391
- ```
392
-
393
- LarkSR configuration item to automatically open the microphone configuration, passed in when `new LarkSR({ ... other configurations omitted ... audioInputAutoStart: true})`,
394
-
395
- > Manually passed `audioInputAutoStart` has a higher priority than the backend configuration
396
-
397
- ```javascript
398
- /**
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
- */
403
- audioInputAutoStart?: boolean;
404
- ```
405
-
406
- Get the status of the currently opened audio device, such as `larksr.audioPaused`
407
-
408
- ```javascript
409
- /**
410
- * The ID of the currently opened audio device, if not specified when opened, it is empty
411
- */
412
- get audioDeviceId(): string | null | undefined;
413
- /**
414
- * The track object of the currently opened audio, if not opened, it is empty
415
- */
416
- get audioTrack(): MediaStreamTrack | null | undefined;
417
- /**
418
- * Whether the audio channel is paused
419
- */
420
- get audioPaused(): boolean | undefined;
421
- ```
422
-
423
- ## Video input interface
424
-
425
- After the client is turned on, the cloud application can directly read video data by reading the camera on the server.
426
-
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
-
431
- ```typescript
432
- /**
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
- * @returns Promise
439
- */
440
- openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number): Promise<any>;
441
- /**
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
- * @returns @see openUserMedia
447
- */
448
- openCamera(cameraId: string, minWidth?: number, minHeight?: number): Promise<any>;
449
- /**
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
- * @returns Promise
455
- */
456
- openDefaultMedia(video?: boolean, audio?: boolean): Promise<any>;
457
- /**
458
- * Return the list of connected video devices
459
- * @returns Promise<MediaDeviceInfo[]>
460
- */
461
- getConnectedVideoinputDevices(): Promise<MediaDeviceInfo[]>;
462
- /**
463
- * Set whether the currently opened video track is enabled
464
- * @param enable Whether to enable
465
- * @returns void
466
- */
467
- setVideoEnable(enable: boolean): void;
468
-
469
- /**
470
- * Pause sending video
471
- * @returns
472
- */
473
- pauseVideoSending(): any;
474
- /**
475
- * Resume sending video
476
- * @returns
477
- */
478
- resumeVideoSending(): any;
479
-
480
- /**
481
- * Turn off the currently opened video device
482
- * @returns
483
- */
484
- closeVideo(): any;
485
- /**
486
- * Turn off the currently opened shared device, such as a shared tab, etc.
487
- * @returns
488
- */
489
- closeShare(): any;
490
- /**
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
- */
497
- openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
498
- ```
499
-
500
- LarkSR configuration item to automatically open the video input configuration, passed in when `new LarkSR({ ... other configurations omitted ... videoInputAutoStart: true})`,
501
-
502
- > Manually passed `videoInputAutoStart` has a higher priority than the backend configuration
503
-
504
- ```javascript
505
- /**
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
- */
510
- videoInputAutoStart?: boolean;
511
- ```
512
-
513
- Get the status of the currently opened video device, such as `larksr.videoPaused`
514
-
515
- ```javascript
516
- /**
517
- * The ID of the currently opened video device, if not specified when opened, it is empty
518
- */
519
- get videoDeviceId(): string | null | undefined;
520
- /**
521
- * The track object of the currently opened video, if not opened, it is empty
522
- */
523
- get videoTrack(): MediaStreamTrack | null | undefined;
524
- /**
525
- * Whether the video channel is paused
526
- */
527
- get videoPaused(): boolean | undefined;
528
- ```
529
-
530
- ## Cloud live streaming function
531
-
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
-
534
- ```javascript
535
- /**
536
- * Start the cloud live streaming function
537
- * @param params {
538
- * // rtmp push url must be filled
539
- * path: "",
540
- * //rtmp push key
541
- * key: "",
542
- * // Push stream width
543
- * width: 1280,
544
- * // Push stream height
545
- * height: 720,
546
- * framerate: 30,
547
- * // kbps
548
- * bitrate: 1024 * 2,
549
- * // Whether to support reconnection
550
- * reconnect: true,
551
- * //Maximum number of reconnections
552
- * reconnectRetries: 3,
553
- * //Whether to stream the microphone (if voice input is supported)
554
- * voice: audioInput,
555
- * }
556
- * @returns Promise
557
- */
558
- StartCloudLiveStreaming(params: CloudLark.IRtmp_Start): Promise<void> | undefined;
559
- /**
560
- * Turn off the cloud live streaming function
561
- * @returns
562
- */
563
- StopLiveStreaming(): void | undefined;
564
- ```
565
-
566
- The relevant status of cloud live streaming refers to the two events `RTMP_STREAM_STATE` and `RTMP_STREAM_ERROR`
567
-
568
- ```javascript
569
- /**
570
- * Server 3.2.7.0 added
571
- * rtmp live streaming status
572
- */
573
- RTMP_STREAM_STATE = "rtmpstreamstate",
574
- /**
575
- * Server 3.2.7.0 added
576
- * rtmp live streaming error
577
- */
578
- RTMP_STREAM_ERROR = "rtmpstreamerror"
579
- ```
580
-
581
- ## Other
582
-
583
- ```typescript
584
- /**
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
- */
590
- captrueFrame(data: any, option?: { width: number; height: number;})
591
-
592
- /**
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
- */
598
- setMobileForceLandScape(force: boolean): void;
599
- /**
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
- */
602
- destroy(): void;
603
- ```
1
+ # LarkSR Object Member Methods
2
+
3
+ LarkSR object member methods are mainly divided into the following three categories
4
+
5
+ ## Control flow methods, including start, stop, restart, register authorization code, etc.
6
+
7
+ ```typescript
8
+ /**
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
+ */
13
+ updateServerAddress(serverAddress: string): void;
14
+ /**
15
+ *
16
+ * @param id sdk id Initialize sdk id
17
+ * @returns
18
+ */
19
+ initSDKAuthCode(id: string): Promise<void>;
20
+ /**
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
+ */
26
+ connectWithPxyHost(params: {
27
+ appliId: string;
28
+ playerMode?: number;
29
+ userType?: number;
30
+ roomCode?: string;
31
+ taskId?: string;
32
+ regionId?: string;
33
+ groupId?: string;
34
+ }): Promise<void>;
35
+ /**
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
+ * {
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
+ type: 0,
43
+
44
+ // Event type when rendering resources are insufficient, may not return in other cases, such as network errors
45
+ eventType?:LarkSRClientEvent.RESOURCE_NOT_ENOUGH,
46
+
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
+ code?: 817,
58
+
59
+ // Error message
60
+ message:? "",
61
+ }
62
+ *
63
+ */
64
+ connect(params: {
65
+ appliId: string;
66
+ playerMode?: number;
67
+ userType?: number;
68
+ roomCode?: string;
69
+ taskId?: string;
70
+ clientMac?: string;
71
+ groupId?: string;
72
+ regionId?: string;
73
+ targetServerIp?: string;
74
+ appKey?: string;
75
+ timestamp?: string;
76
+ signature?: string;
77
+ } | any): Promise<void>;
78
+ /**
79
+ * Restart the cloud rendering process
80
+ */
81
+ restart(): void;
82
+ /**
83
+ * Restart the cloud application
84
+ */
85
+ restartApp(): void;
86
+ /**
87
+ * Actively close the connection
88
+ */
89
+ close(): void;
90
+ ```
91
+
92
+ ## Input and output related methods, including mouse, keyboard, gamepad, touch
93
+
94
+ ```typescript
95
+ /**
96
+ * Switch the current operator
97
+ * @param uid User id
98
+ */
99
+ changeOperater(uid: number): void;
100
+ /**
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
+ */
104
+ inputText(text: string): void;
105
+ /**
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
+ */
112
+ sendInput(input: CloudLark.IClientInput): void;
113
+ /**
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
+ *
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
+ */
125
+ mouseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
126
+ /**
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
+ *
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
+ */
138
+ moseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
139
+ /**
140
+ * Send mouse click event to the cloud
141
+ * X Y coordinate calculation method is the same as mouseMove
142
+ *
143
+ * @param PosX Mouse X coordinate relative to the cloud
144
+ * @param PosY Mouse Y coordinate relative to the cloud
145
+ * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
146
+ */
147
+ mouseTap(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
148
+ /**
149
+ * Send mouse down event to the cloud
150
+ * X Y coordinate calculation method is the same as mouseMove
151
+ *
152
+ * @param PosX Mouse X coordinate relative to the cloud
153
+ * @param PosY Mouse Y coordinate relative to the cloud
154
+ * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
155
+ */
156
+ mouseDown(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
157
+ /**
158
+ * Send mouse up event to the cloud
159
+ * X Y coordinate calculation method is the same as mouseMove
160
+ *
161
+ * @param PosX Mouse X coordinate relative to the cloud
162
+ * @param PosY Mouse Y coordinate relative to the cloud
163
+ * @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
164
+ */
165
+ mouseUp(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
166
+ /**
167
+ * Send mouse wheel event to the cloud
168
+ * X Y coordinate calculation method is the same as mouseMove
169
+ *
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
+ */
174
+ mouseWheel(PosX: number, PosY: number, Delata: number): void;
175
+ /**
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
+ */
181
+ keyDown(key: string, isRepeat: boolean): void;
182
+ /**
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
+ */
187
+ keyUp(key: string): void;
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
+ * export const enum XINPUT_BUTTONS {
196
+ * XINPUT_GAMEPAD_DPAD_UP = 0x0001,
197
+ * XINPUT_GAMEPAD_DPAD_DOWN = 0x0002,
198
+ * XINPUT_GAMEPAD_DPAD_LEFT = 0x0004,
199
+ * XINPUT_GAMEPAD_DPAD_RIGHT = 0x0008,
200
+ * XINPUT_GAMEPAD_START = 0x0010,
201
+ * XINPUT_GAMEPAD_BACK = 0x0020,
202
+ * XINPUT_GAMEPAD_LEFT_THUMB = 0x0040,
203
+ * XINPUT_GAMEPAD_RIGHT_THUMB = 0x0080,
204
+ * XINPUT_GAMEPAD_LEFT_SHOULDER = 0x0100,
205
+ * XINPUT_GAMEPAD_RIGHT_SHOULDER = 0x0200,
206
+ * XINPUT_GAMEPAD_A = 0x1000,
207
+ * XINPUT_GAMEPAD_B = 0x2000,
208
+ * XINPUT_GAMEPAD_X = 0x4000,
209
+ * XINPUT_GAMEPAD_Y = 0x8000,
210
+ * XINPUT_UNKNOWN = -1,
211
+ * }
212
+ * @param isRepeat Whether to repeat
213
+ * @returns
214
+ */
215
+ gamepadButtonDown(userIndex: number, button: number, isRepeat: boolean): void;
216
+ /**
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
+ * @returns
222
+ */
223
+ gamepadButtonUp(userIndex: number, button: number): void;
224
+ /**
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
+ * @returns
231
+ */
232
+ gamepadTrigger(userIndex: number, isleft: boolean, value: number): void;
233
+ /**
234
+ * Send gamepad joystick values to the cloud, i.e., axes values
235
+ * win MAX
236
+ * |
237
+ * MIN-------------MAX
238
+ * |
239
+ * MIN
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
+ * @returns
247
+ */
248
+ joystick(userIndex: number, thumblx: number, thumbly: number, thumbrx: number, thumbry: number): void;
249
+ /**
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
+ * @returns
256
+ */
257
+ touchDown(id: number, x: number, y: number): void;
258
+ /**
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
+ * @returns
265
+ */
266
+ touchMove(id: number, x: number, y: number): void;
267
+ /**
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
+ * @returns
274
+ */
275
+ touchUp(id: number, x: number, y: number): void;
276
+ /**
277
+ * Convert string to input mouse button value
278
+ * @param button 'left' | 'mid' | 'right'
279
+ * @returns LEFT = 0,RIGHT = 1,MIDDLE = 2
280
+ */
281
+ getMouseButtonType(button: 'left' | 'mid' | 'right'): CloudLark.MouseKey;
282
+ ```
283
+
284
+ ## Data channel extension, send data to the cloud application data channel
285
+
286
+ ```typescript
287
+ /**
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
+ */
293
+ sendTextToDataChannel(text: string): void;
294
+ /**
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
+ */
299
+ sendBinaryToDataChannel(binary: Uint8Array): void;
300
+ ```
301
+
302
+ ## Intelligent voice related interfaces
303
+
304
+ ```typescript
305
+ /**
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
+ */
311
+ aiDmTextInput(text: string): number;
312
+ /**
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
+ */
317
+ startAiDmVoiceInput(): Promise<number>;
318
+ /**
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
+ */
322
+ stopAiDmVoiceInput(): number;
323
+ ```
324
+
325
+ LarkSR adds the following events to get the status of the intelligent voice service:
326
+
327
+ ```typescript
328
+ larksr.on('aivoicestatus', (e) => {
329
+ // Intelligent voice service status
330
+ });
331
+
332
+ larksr.on('aivoiceasrresult', (e) => {
333
+ // Intelligent voice to text recognition result
334
+ });
335
+
336
+ larksr.on('aivoicedmresult', (e) => {
337
+ // Intelligent voice dialogue result
338
+ });
339
+ ```
340
+
341
+ ## Microphone input interface
342
+
343
+ After the client is turned on, the cloud application can directly receive audio by reading the microphone on the sound card.
344
+
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
+
349
+ ```typescript
350
+ /**
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
+ * @returns
354
+ */
355
+ openAudio(deviceId?: string);
356
+ /**
357
+ * Turn off the current audio device
358
+ * @returns
359
+ */
360
+ closeAudio(): boolean | undefined;
361
+ /**
362
+ * Pause sending audio
363
+ * @returns
364
+ */
365
+ pauseAudioSending(): any;
366
+ /**
367
+ * Resume sending audio
368
+ * @returns
369
+ */
370
+ resumeAudioSending(): any;
371
+ /**
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
+ * @returns
374
+ */
375
+ getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
376
+ /**
377
+ * Set whether the currently opened audio track is enabled
378
+ * @param enable Whether to enable
379
+ * @returns
380
+ */
381
+ setAudioEnable(enable: boolean): void | undefined;
382
+
383
+ /**
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
+ */
390
+ openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
391
+ ```
392
+
393
+ LarkSR configuration item to automatically open the microphone configuration, passed in when `new LarkSR({ ... other configurations omitted ... audioInputAutoStart: true})`,
394
+
395
+ > Manually passed `audioInputAutoStart` has a higher priority than the backend configuration
396
+
397
+ ```javascript
398
+ /**
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
+ */
403
+ audioInputAutoStart?: boolean;
404
+ ```
405
+
406
+ Get the status of the currently opened audio device, such as `larksr.audioPaused`
407
+
408
+ ```javascript
409
+ /**
410
+ * The ID of the currently opened audio device, if not specified when opened, it is empty
411
+ */
412
+ get audioDeviceId(): string | null | undefined;
413
+ /**
414
+ * The track object of the currently opened audio, if not opened, it is empty
415
+ */
416
+ get audioTrack(): MediaStreamTrack | null | undefined;
417
+ /**
418
+ * Whether the audio channel is paused
419
+ */
420
+ get audioPaused(): boolean | undefined;
421
+ ```
422
+
423
+ ## Video input interface
424
+
425
+ After the client is turned on, the cloud application can directly read video data by reading the camera on the server.
426
+
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
+
431
+ ```typescript
432
+ /**
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
+ * @returns Promise
439
+ */
440
+ openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number): Promise<any>;
441
+ /**
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
+ * @returns @see openUserMedia
447
+ */
448
+ openCamera(cameraId: string, minWidth?: number, minHeight?: number): Promise<any>;
449
+ /**
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
+ * @returns Promise
455
+ */
456
+ openDefaultMedia(video?: boolean, audio?: boolean): Promise<any>;
457
+ /**
458
+ * Return the list of connected video devices
459
+ * @returns Promise<MediaDeviceInfo[]>
460
+ */
461
+ getConnectedVideoinputDevices(): Promise<MediaDeviceInfo[]>;
462
+ /**
463
+ * Set whether the currently opened video track is enabled
464
+ * @param enable Whether to enable
465
+ * @returns void
466
+ */
467
+ setVideoEnable(enable: boolean): void;
468
+
469
+ /**
470
+ * Pause sending video
471
+ * @returns
472
+ */
473
+ pauseVideoSending(): any;
474
+ /**
475
+ * Resume sending video
476
+ * @returns
477
+ */
478
+ resumeVideoSending(): any;
479
+
480
+ /**
481
+ * Turn off the currently opened video device
482
+ * @returns
483
+ */
484
+ closeVideo(): any;
485
+ /**
486
+ * Turn off the currently opened shared device, such as a shared tab, etc.
487
+ * @returns
488
+ */
489
+ closeShare(): any;
490
+ /**
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
+ */
497
+ openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
498
+ ```
499
+
500
+ LarkSR configuration item to automatically open the video input configuration, passed in when `new LarkSR({ ... other configurations omitted ... videoInputAutoStart: true})`,
501
+
502
+ > Manually passed `videoInputAutoStart` has a higher priority than the backend configuration
503
+
504
+ ```javascript
505
+ /**
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
+ */
510
+ videoInputAutoStart?: boolean;
511
+ ```
512
+
513
+ Get the status of the currently opened video device, such as `larksr.videoPaused`
514
+
515
+ ```javascript
516
+ /**
517
+ * The ID of the currently opened video device, if not specified when opened, it is empty
518
+ */
519
+ get videoDeviceId(): string | null | undefined;
520
+ /**
521
+ * The track object of the currently opened video, if not opened, it is empty
522
+ */
523
+ get videoTrack(): MediaStreamTrack | null | undefined;
524
+ /**
525
+ * Whether the video channel is paused
526
+ */
527
+ get videoPaused(): boolean | undefined;
528
+ ```
529
+
530
+ ## Cloud live streaming function
531
+
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
+
534
+ ```javascript
535
+ /**
536
+ * Start the cloud live streaming function
537
+ * @param params {
538
+ * // rtmp push url must be filled
539
+ * path: "",
540
+ * //rtmp push key
541
+ * key: "",
542
+ * // Push stream width
543
+ * width: 1280,
544
+ * // Push stream height
545
+ * height: 720,
546
+ * framerate: 30,
547
+ * // kbps
548
+ * bitrate: 1024 * 2,
549
+ * // Whether to support reconnection
550
+ * reconnect: true,
551
+ * //Maximum number of reconnections
552
+ * reconnectRetries: 3,
553
+ * //Whether to stream the microphone (if voice input is supported)
554
+ * voice: audioInput,
555
+ * }
556
+ * @returns Promise
557
+ */
558
+ StartCloudLiveStreaming(params: CloudLark.IRtmp_Start): Promise<void> | undefined;
559
+ /**
560
+ * Turn off the cloud live streaming function
561
+ * @returns
562
+ */
563
+ StopLiveStreaming(): void | undefined;
564
+ ```
565
+
566
+ The relevant status of cloud live streaming refers to the two events `RTMP_STREAM_STATE` and `RTMP_STREAM_ERROR`
567
+
568
+ ```javascript
569
+ /**
570
+ * Server 3.2.7.0 added
571
+ * rtmp live streaming status
572
+ */
573
+ RTMP_STREAM_STATE = "rtmpstreamstate",
574
+ /**
575
+ * Server 3.2.7.0 added
576
+ * rtmp live streaming error
577
+ */
578
+ RTMP_STREAM_ERROR = "rtmpstreamerror"
579
+ ```
580
+
581
+ ## Other
582
+
583
+ ```typescript
584
+ /**
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
+ */
590
+ captrueFrame(data: any, option?: { width: number; height: number;})
591
+
592
+ /**
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
+ */
598
+ setMobileForceLandScape(force: boolean): void;
599
+ /**
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
+ */
602
+ destroy(): void;
603
+ ```