larksr_websdk 3.3.102 → 3.3.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/doc/en/config.md +99 -99
- package/dist/doc/en/dev.md +21 -21
- package/dist/doc/en/event_codes.md +117 -117
- package/dist/doc/en/events.md +72 -72
- package/dist/doc/en/functions.md +239 -239
- package/dist/doc/en/index.md +1 -1
- package/dist/doc/en/member_variables.md +116 -120
- package/dist/doc/en/multi_media_3_2_401.md +20 -20
- package/dist/doc/en/sdkid_encryption.md +14 -14
- package/dist/doc/en/update.md +462 -462
- package/dist/doc/zh_CN/config.md +1 -1
- package/dist/doc/zh_CN/event_codes.md +1 -1
- package/dist/doc/zh_CN/functions.md +2 -2
- package/dist/doc/zh_CN/index.md +1 -1
- package/dist/doc/zh_CN/multi_media_3_2_401.md +1 -1
- package/dist/doc/zh_CN/update.md +579 -579
- package/dist/larksr-web-sdk.min.js +1 -1
- package/dist/types/api.d.ts +2 -0
- package/dist/types/appli_params.d.ts +14 -0
- package/dist/types/lark/application.d.ts +2 -1
- package/dist/types/lark/message.d.ts +1 -0
- package/dist/types/larksr.d.ts +83 -4
- package/dist/types/localization/ui.d.ts +2 -0
- package/dist/types/operation/keyboard_handler.d.ts +25 -0
- package/dist/types/utils/lock_pointer.d.ts +2 -1
- package/package.json +72 -72
- package/types/api.d.ts +2 -0
- package/types/appli_params.d.ts +14 -0
- package/types/lark/application.d.ts +2 -1
- package/types/lark/message.d.ts +1 -0
- package/types/larksr.d.ts +83 -4
- package/types/localization/ui.d.ts +2 -0
- package/types/operation/keyboard_handler.d.ts +25 -0
- package/types/utils/lock_pointer.d.ts +2 -1
- package/dist/types/lark/custom.d.ts +0 -7
- package/dist/types/lark/webcodecs.generated.d.ts +0 -417
- package/dist/types/protobuf/cloudlark.d.ts +0 -9674
- package/dist/types/utils/ios-inner-height.d.ts +0 -4
- package/types/lark/custom.d.ts +0 -7
- package/types/lark/webcodecs.generated.d.ts +0 -417
- package/types/protobuf/cloudlark.d.ts +0 -9674
- package/types/utils/ios-inner-height.d.ts +0 -4
package/dist/doc/en/functions.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# LarkSR
|
|
1
|
+
# LarkSR Object Member Methods
|
|
2
2
|
|
|
3
|
-
LarkSR
|
|
3
|
+
LarkSR object member methods are mainly divided into the following three categories
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Control flow methods, including start, stop, restart, register authorization code, etc.
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param serverAddress
|
|
9
|
+
* Set the server address separately, same as the serverAddress field in config
|
|
10
|
+
* Can be updated before entering the application.
|
|
11
|
+
* @param serverAddress Server address, e.g., http://192.168.0.55:8181/
|
|
12
12
|
*/
|
|
13
13
|
updateServerAddress(serverAddress: string): void;
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
16
|
-
* @param id sdk id
|
|
16
|
+
* @param id sdk id Initialize sdk id
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
19
|
initSDKAuthCode(id: string): Promise<void>;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @param params
|
|
24
|
-
* @return
|
|
21
|
+
* When using the Pingxingyun hosting platform, use connectWithPxyHost to connect to the cloud application
|
|
22
|
+
* Hosting platform https://www.pingxingyun.com/console/#/
|
|
23
|
+
* @param params Same as connect method
|
|
24
|
+
* @return Same as connect method
|
|
25
25
|
*/
|
|
26
26
|
connectWithPxyHost(params: {
|
|
27
27
|
appliId: string;
|
|
@@ -33,30 +33,30 @@ connectWithPxyHost(params: {
|
|
|
33
33
|
groupId?: string;
|
|
34
34
|
}): Promise<void>;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @params appID
|
|
38
|
-
* @returns Promise
|
|
39
|
-
* Promise
|
|
36
|
+
* Connect to cloud rendering resources
|
|
37
|
+
* @params appID Cloud resource ID
|
|
38
|
+
* @returns Promise Call the interface and verify the authorization to return success and automatically start the connection
|
|
39
|
+
* Promise returned error object:
|
|
40
40
|
* {
|
|
41
|
-
// type 0
|
|
41
|
+
// type 0 Error caused by insufficient rendering resources, 1 Other errors, can use type == 0 to determine if it is an insufficient rendering resource error
|
|
42
42
|
type: 0,
|
|
43
43
|
|
|
44
|
-
//
|
|
44
|
+
// Event type when rendering resources are insufficient, may not return in other cases, such as network errors
|
|
45
45
|
eventType?:LarkSRClientEvent.RESOURCE_NOT_ENOUGH,
|
|
46
46
|
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// 813
|
|
50
|
-
// 814
|
|
51
|
-
// 815
|
|
52
|
-
// 816=VR
|
|
53
|
-
// 817
|
|
54
|
-
// 820
|
|
55
|
-
// 821
|
|
56
|
-
// 823
|
|
47
|
+
// Error code returned by the server, present when the server request is correct. Pay attention to the error codes for insufficient rendering resources.
|
|
48
|
+
// Can use type == 0 to determine if it is an insufficient rendering resource error, then use code for detailed handling, or just use type == 0 for handling.
|
|
49
|
+
// 813=The current number of running applications has reached the maximum: {0}, please try again later
|
|
50
|
+
// 814=The number of running applications under the same appKey has reached the maximum: {0}, please try again later
|
|
51
|
+
// 815=The number of running applications has reached the maximum authorized concurrency, please try again later
|
|
52
|
+
// 816=The number of running VR applications has reached the maximum authorized concurrency, please try again later
|
|
53
|
+
// 817=Insufficient rendering resources, please try again later
|
|
54
|
+
// 820=No active GPU nodes
|
|
55
|
+
// 821=Node resource usage has reached the set threshold
|
|
56
|
+
// 823=The number of running applications on a single node has reached the maximum authorized concurrency, please try again later
|
|
57
57
|
code?: 817,
|
|
58
58
|
|
|
59
|
-
//
|
|
59
|
+
// Error message
|
|
60
60
|
message:? "",
|
|
61
61
|
}
|
|
62
62
|
*
|
|
@@ -76,122 +76,122 @@ connect(params: {
|
|
|
76
76
|
signature?: string;
|
|
77
77
|
} | any): Promise<void>;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Restart the cloud rendering process
|
|
80
80
|
*/
|
|
81
81
|
restart(): void;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Restart the cloud application
|
|
84
84
|
*/
|
|
85
85
|
restartApp(): void;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Actively close the connection
|
|
88
88
|
*/
|
|
89
89
|
close(): void;
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
##
|
|
92
|
+
## Input and output related methods, including mouse, keyboard, gamepad, touch
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
* @param uid
|
|
96
|
+
* Switch the current operator
|
|
97
|
+
* @param uid User id
|
|
98
98
|
*/
|
|
99
99
|
changeOperater(uid: number): void;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @param text
|
|
101
|
+
* Send text to the cloud application. When the cloud application has an input box, you can fill in the local text.
|
|
102
|
+
* @param text Text
|
|
103
103
|
*/
|
|
104
104
|
inputText(text: string): void;
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* CloudLark.IClientInput
|
|
109
|
-
*
|
|
110
|
-
* @param input
|
|
106
|
+
* Operation related events
|
|
107
|
+
* All event coordinates are relative to the cloud application, not the webpage
|
|
108
|
+
* CloudLark.IClientInput is a collection of all operation command interface objects
|
|
109
|
+
* You can use the following moseMove interfaces separately
|
|
110
|
+
* @param input Operation command
|
|
111
111
|
*/
|
|
112
112
|
sendInput(input: CloudLark.IClientInput): void;
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
114
|
+
* Send mouse move event to the cloud
|
|
115
|
+
* Event coordinates are relative to the cloud application, not the webpage
|
|
116
|
+
* Calculation method can refer to the getVMouseTouchPosition method in v_cursor.vue in the example https://github.com/ParaverseTechnology/lark_sr_websdk_demos
|
|
117
|
+
* The principle is to obtain the relative scale through the screenState.operateScale member of the LarkSR object,
|
|
118
|
+
* Local coordinates X larksr.screenState.operateScale.scaleX / scaleY to get the coordinates relative to the cloud
|
|
119
119
|
*
|
|
120
|
-
* @param PosX
|
|
121
|
-
* @param PosY
|
|
122
|
-
* @param DeltaX
|
|
123
|
-
* @param DeltaY
|
|
120
|
+
* @param PosX Mouse X coordinate relative to the cloud
|
|
121
|
+
* @param PosY Mouse Y coordinate relative to the cloud
|
|
122
|
+
* @param DeltaX Mouse X axis movement distance relative to the cloud
|
|
123
|
+
* @param DeltaY Mouse Y axis movement distance relative to the cloud
|
|
124
124
|
*/
|
|
125
125
|
mouseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
127
|
+
* Send mouse move event to the cloud
|
|
128
|
+
* Event coordinates are relative to the cloud application, not the webpage
|
|
129
|
+
* Calculation method can refer to the getVMouseTouchPosition method in v_cursor.vue in the example https://github.com/ParaverseTechnology/lark_sr_websdk_demos
|
|
130
|
+
* The principle is to obtain the relative scale through the screenState.operateScale member of the LarkSR object,
|
|
131
|
+
* Local coordinates X larksr.screenState.operateScale.scaleX / scaleY to get the coordinates relative to the cloud
|
|
132
132
|
*
|
|
133
|
-
* @param PosX
|
|
134
|
-
* @param PosY
|
|
135
|
-
* @param DeltaX
|
|
136
|
-
* @param DeltaY
|
|
133
|
+
* @param PosX Mouse X coordinate relative to the cloud
|
|
134
|
+
* @param PosY Mouse Y coordinate relative to the cloud
|
|
135
|
+
* @param DeltaX Mouse X axis movement distance relative to the cloud
|
|
136
|
+
* @param DeltaY Mouse Y axis movement distance relative to the cloud
|
|
137
137
|
*/
|
|
138
138
|
moseMove(PosX: number, PosY: number, DeltaX: number, DeltaY: number): void;
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
141
|
-
* X Y
|
|
140
|
+
* Send mouse click event to the cloud
|
|
141
|
+
* X Y coordinate calculation method is the same as mouseMove
|
|
142
142
|
*
|
|
143
|
-
* @param PosX
|
|
144
|
-
* @param PosY
|
|
143
|
+
* @param PosX Mouse X coordinate relative to the cloud
|
|
144
|
+
* @param PosY Mouse Y coordinate relative to the cloud
|
|
145
145
|
* @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
|
|
146
146
|
*/
|
|
147
147
|
mouseTap(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
150
|
-
* X Y
|
|
149
|
+
* Send mouse down event to the cloud
|
|
150
|
+
* X Y coordinate calculation method is the same as mouseMove
|
|
151
151
|
*
|
|
152
|
-
* @param PosX
|
|
153
|
-
* @param PosY
|
|
152
|
+
* @param PosX Mouse X coordinate relative to the cloud
|
|
153
|
+
* @param PosY Mouse Y coordinate relative to the cloud
|
|
154
154
|
* @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
|
|
155
155
|
*/
|
|
156
156
|
mouseDown(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
159
|
-
* X Y
|
|
158
|
+
* Send mouse up event to the cloud
|
|
159
|
+
* X Y coordinate calculation method is the same as mouseMove
|
|
160
160
|
*
|
|
161
|
-
* @param PosX
|
|
162
|
-
* @param PosY
|
|
161
|
+
* @param PosX Mouse X coordinate relative to the cloud
|
|
162
|
+
* @param PosY Mouse Y coordinate relative to the cloud
|
|
163
163
|
* @param key LEFT = 0,RIGHT = 1, MIDDLE = 2
|
|
164
164
|
*/
|
|
165
165
|
mouseUp(PosX: number, PosY: number, key: CloudLark.MouseKey): void;
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
168
|
-
* X Y
|
|
167
|
+
* Send mouse wheel event to the cloud
|
|
168
|
+
* X Y coordinate calculation method is the same as mouseMove
|
|
169
169
|
*
|
|
170
|
-
* @param PosX
|
|
171
|
-
* @param PosY
|
|
172
|
-
* @param Delata 120/-120
|
|
170
|
+
* @param PosX Mouse X coordinate relative to the cloud
|
|
171
|
+
* @param PosY Mouse Y coordinate relative to the cloud
|
|
172
|
+
* @param Delata 120/-120 Mouse wheel scroll value
|
|
173
173
|
*/
|
|
174
174
|
mouseWheel(PosX: number, PosY: number, Delata: number): void;
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param key KeyboardEvent.code
|
|
178
|
-
* @param isRepeat KeyboardEvent.repeat
|
|
179
|
-
* @returns
|
|
176
|
+
* Send keyboard key down event to the cloud
|
|
177
|
+
* @param key KeyboardEvent.code field, specific content refer to Chrome https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
|
|
178
|
+
* @param isRepeat KeyboardEvent.repeat field, refer to https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
|
|
179
|
+
* @returns Whether the sending is successful, if the key parameter is passed incorrectly, the sending may fail
|
|
180
180
|
*/
|
|
181
181
|
keyDown(key: string, isRepeat: boolean): void;
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
184
|
-
* @param key KeyboardEvent.code
|
|
185
|
-
* @returns
|
|
183
|
+
* Send keyboard key up event to the cloud
|
|
184
|
+
* @param key KeyboardEvent.code field, specific content refer to Chrome https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
|
|
185
|
+
* @returns Whether the sending is successful, if the key parameter is passed incorrectly, the sending may fail
|
|
186
186
|
*/
|
|
187
187
|
keyUp(key: string): void;
|
|
188
|
-
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* @param userIndex
|
|
194
|
-
* @param button
|
|
188
|
+
/**
|
|
189
|
+
* Gamepad interface messages are defined according to the Windows Xbox 360 gamepad standard, including the functions of the Xbox 360 gamepad, such as buttons, joysticks, and trigger keys. Windows supports up to 4 gamepads,
|
|
190
|
+
* The current version of the server only handles 1 gamepad, and support for multiple gamepads will be released later. The key values sent in the interface are the corresponding key values defined in Windows.
|
|
191
|
+
* Send gamepad button down event to the cloud
|
|
192
|
+
* Refer to js to get gamepad events, refer to https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
|
|
193
|
+
* @param userIndex Gamepad index, hardware device index 0-3. The first connected gamepad is 0, the second is 1, and so on.
|
|
194
|
+
* @param button Button @see https://docs.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad
|
|
195
195
|
* export const enum XINPUT_BUTTONS {
|
|
196
196
|
* XINPUT_GAMEPAD_DPAD_UP = 0x0001,
|
|
197
197
|
* XINPUT_GAMEPAD_DPAD_DOWN = 0x0002,
|
|
@@ -209,395 +209,395 @@ keyUp(key: string): void;
|
|
|
209
209
|
* XINPUT_GAMEPAD_Y = 0x8000,
|
|
210
210
|
* XINPUT_UNKNOWN = -1,
|
|
211
211
|
* }
|
|
212
|
-
* @param isRepeat
|
|
212
|
+
* @param isRepeat Whether to repeat
|
|
213
213
|
* @returns
|
|
214
214
|
*/
|
|
215
215
|
gamepadButtonDown(userIndex: number, button: number, isRepeat: boolean): void;
|
|
216
216
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* @param userIndex
|
|
220
|
-
* @param button
|
|
217
|
+
* Send gamepad button up event to the cloud
|
|
218
|
+
* Refer to https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
|
|
219
|
+
* @param userIndex Gamepad index
|
|
220
|
+
* @param button Button
|
|
221
221
|
* @returns
|
|
222
222
|
*/
|
|
223
223
|
gamepadButtonUp(userIndex: number, button: number): void;
|
|
224
224
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* @param userIndex
|
|
228
|
-
* @param isleft
|
|
229
|
-
* @param value
|
|
225
|
+
* Send gamepad trigger key event to the cloud
|
|
226
|
+
* Refer to https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
|
|
227
|
+
* @param userIndex Gamepad index
|
|
228
|
+
* @param isleft Whether it is the left trigger
|
|
229
|
+
* @param value Trigger value 0-255
|
|
230
230
|
* @returns
|
|
231
231
|
*/
|
|
232
232
|
gamepadTrigger(userIndex: number, isleft: boolean, value: number): void;
|
|
233
233
|
/**
|
|
234
|
-
*
|
|
234
|
+
* Send gamepad joystick values to the cloud, i.e., axes values
|
|
235
235
|
* win MAX
|
|
236
236
|
* |
|
|
237
237
|
* MIN-------------MAX
|
|
238
238
|
* |
|
|
239
239
|
* MIN
|
|
240
|
-
* js
|
|
241
|
-
* @param userIndex
|
|
242
|
-
* @param thumblx
|
|
243
|
-
* @param thumbly
|
|
244
|
-
* @param thumbrx
|
|
245
|
-
* @param thumbry
|
|
240
|
+
* Refer to js to get hardware gamepad https://developer.mozilla.org/zh-CN/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
|
|
241
|
+
* @param userIndex Gamepad index
|
|
242
|
+
* @param thumblx Left joystick X value, -32767 to 32767
|
|
243
|
+
* @param thumbly Left joystick Y value, -32767 to 32767
|
|
244
|
+
* @param thumbrx Right joystick X value, -32767 to 32767
|
|
245
|
+
* @param thumbry Right joystick Y value, -32767 to 32767
|
|
246
246
|
* @returns
|
|
247
247
|
*/
|
|
248
248
|
joystick(userIndex: number, thumblx: number, thumbly: number, thumbrx: number, thumbry: number): void;
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* @param id
|
|
253
|
-
* @param x
|
|
254
|
-
* @param y
|
|
250
|
+
* Send touch down event to the cloud
|
|
251
|
+
* Coordinate position is the same as mouseMove, relative to the cloud mouse move position
|
|
252
|
+
* @param id Finger id
|
|
253
|
+
* @param x X coordinate relative to the cloud
|
|
254
|
+
* @param y Y coordinate relative to the cloud
|
|
255
255
|
* @returns
|
|
256
256
|
*/
|
|
257
257
|
touchDown(id: number, x: number, y: number): void;
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
* @param id
|
|
262
|
-
* @param x
|
|
263
|
-
* @param y
|
|
259
|
+
* Send touch move event to the cloud
|
|
260
|
+
* Coordinate position is the same as mouseMove, relative to the cloud mouse move position
|
|
261
|
+
* @param id Finger id
|
|
262
|
+
* @param x X coordinate relative to the cloud
|
|
263
|
+
* @param y Y coordinate relative to the cloud
|
|
264
264
|
* @returns
|
|
265
265
|
*/
|
|
266
266
|
touchMove(id: number, x: number, y: number): void;
|
|
267
267
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @param id
|
|
271
|
-
* @param x
|
|
272
|
-
* @param y
|
|
268
|
+
* Send touch up event to the cloud
|
|
269
|
+
* Coordinate position is the same as mouseMove, relative to the cloud mouse move position
|
|
270
|
+
* @param id Finger id
|
|
271
|
+
* @param x X coordinate relative to the cloud
|
|
272
|
+
* @param y Y coordinate relative to the cloud
|
|
273
273
|
* @returns
|
|
274
274
|
*/
|
|
275
275
|
touchUp(id: number, x: number, y: number): void;
|
|
276
276
|
/**
|
|
277
|
-
*
|
|
277
|
+
* Convert string to input mouse button value
|
|
278
278
|
* @param button 'left' | 'mid' | 'right'
|
|
279
279
|
* @returns LEFT = 0,RIGHT = 1,MIDDLE = 2
|
|
280
280
|
*/
|
|
281
281
|
getMouseButtonType(button: 'left' | 'mid' | 'right'): CloudLark.MouseKey;
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
##
|
|
284
|
+
## Data channel extension, send data to the cloud application data channel
|
|
285
285
|
|
|
286
286
|
```typescript
|
|
287
287
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* > V3.2.314
|
|
291
|
-
* @param text
|
|
288
|
+
* Send text message to data channel
|
|
289
|
+
* Note that the cloud application needs to inherit the data channel function
|
|
290
|
+
* > V3.2.314 version corresponds to server version and data channel version 3.2.5.1 and above
|
|
291
|
+
* @param text Text
|
|
292
292
|
*/
|
|
293
293
|
sendTextToDataChannel(text: string): void;
|
|
294
294
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
* @param binary
|
|
295
|
+
* Send binary message to data channel
|
|
296
|
+
* Note that the cloud application needs to inherit the data channel function
|
|
297
|
+
* @param binary Binary message
|
|
298
298
|
*/
|
|
299
299
|
sendBinaryToDataChannel(binary: Uint8Array): void;
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
##
|
|
302
|
+
## Intelligent voice related interfaces
|
|
303
303
|
|
|
304
304
|
```typescript
|
|
305
305
|
/**
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* @param text
|
|
309
|
-
* @returns
|
|
306
|
+
* Start intelligent voice dialogue text input
|
|
307
|
+
* Should start input when intelligent voice is in the start state
|
|
308
|
+
* @param text Input text
|
|
309
|
+
* @returns Return dialogue ID
|
|
310
310
|
*/
|
|
311
311
|
aiDmTextInput(text: string): number;
|
|
312
312
|
/**
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
* @returns
|
|
313
|
+
* Start intelligent voice dialogue voice input, automatically request recording permission
|
|
314
|
+
* Should start input when intelligent voice is in the start state
|
|
315
|
+
* @returns Success returns dialogue id, failure returns exception
|
|
316
316
|
*/
|
|
317
317
|
startAiDmVoiceInput(): Promise<number>;
|
|
318
318
|
/**
|
|
319
|
-
*
|
|
320
|
-
* @returns
|
|
319
|
+
* Stop intelligent voice input, notify the voice engine that the current user input dialogue is over
|
|
320
|
+
* @returns Return the current dialogue id
|
|
321
321
|
*/
|
|
322
322
|
stopAiDmVoiceInput(): number;
|
|
323
323
|
```
|
|
324
324
|
|
|
325
|
-
LarkSR
|
|
325
|
+
LarkSR adds the following events to get the status of the intelligent voice service:
|
|
326
326
|
|
|
327
327
|
```typescript
|
|
328
328
|
larksr.on('aivoicestatus', (e) => {
|
|
329
|
-
//
|
|
329
|
+
// Intelligent voice service status
|
|
330
330
|
});
|
|
331
331
|
|
|
332
332
|
larksr.on('aivoiceasrresult', (e) => {
|
|
333
|
-
//
|
|
333
|
+
// Intelligent voice to text recognition result
|
|
334
334
|
});
|
|
335
335
|
|
|
336
336
|
larksr.on('aivoicedmresult', (e) => {
|
|
337
|
-
//
|
|
337
|
+
// Intelligent voice dialogue result
|
|
338
338
|
});
|
|
339
339
|
```
|
|
340
340
|
|
|
341
|
-
##
|
|
341
|
+
## Microphone input interface
|
|
342
342
|
|
|
343
|
-
|
|
343
|
+
After the client is turned on, the cloud application can directly receive audio by reading the microphone on the sound card.
|
|
344
344
|
|
|
345
|
-
>
|
|
346
|
-
>
|
|
347
|
-
>
|
|
345
|
+
> The minimum server version that matches this feature is V3.2.51
|
|
346
|
+
> To use this feature, make sure to enable the voice input feature in the backend
|
|
347
|
+
> Note that the media device should be turned on after the connection is successful. That is, it is effective after calling `mediaPlayed`
|
|
348
348
|
|
|
349
349
|
```typescript
|
|
350
350
|
/**
|
|
351
|
-
*
|
|
352
|
-
* @param deviceId
|
|
351
|
+
* Turn on an audio device, note that the browser restricts it to https or localhost to open audio
|
|
352
|
+
* @param deviceId Audio device id, if not passed, the default device will be opened. @see getConnectedAudioinputDevices
|
|
353
353
|
* @returns
|
|
354
354
|
*/
|
|
355
355
|
openAudio(deviceId?: string);
|
|
356
356
|
/**
|
|
357
|
-
*
|
|
357
|
+
* Turn off the current audio device
|
|
358
358
|
* @returns
|
|
359
359
|
*/
|
|
360
360
|
closeAudio(): boolean | undefined;
|
|
361
361
|
/**
|
|
362
|
-
*
|
|
362
|
+
* Pause sending audio
|
|
363
363
|
* @returns
|
|
364
364
|
*/
|
|
365
365
|
pauseAudioSending(): any;
|
|
366
366
|
/**
|
|
367
|
-
*
|
|
367
|
+
* Resume sending audio
|
|
368
368
|
* @returns
|
|
369
369
|
*/
|
|
370
370
|
resumeAudioSending(): any;
|
|
371
371
|
/**
|
|
372
|
-
*
|
|
372
|
+
* Return the list of connected audio devices, the device id in the device list can be used to open a specific audio device
|
|
373
373
|
* @returns
|
|
374
374
|
*/
|
|
375
375
|
getConnectedAudioinputDevices(): Promise<MediaDeviceInfo[] | undefined>;
|
|
376
376
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @param enable
|
|
377
|
+
* Set whether the currently opened audio track is enabled
|
|
378
|
+
* @param enable Whether to enable
|
|
379
379
|
* @returns
|
|
380
380
|
*/
|
|
381
381
|
setAudioEnable(enable: boolean): void | undefined;
|
|
382
382
|
|
|
383
383
|
/**
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* @param constraints
|
|
387
|
-
* @param reset
|
|
388
|
-
* @returns
|
|
384
|
+
* Request the browser to open the media and open the upload channel to the server.
|
|
385
|
+
* Note that the request should be made after the server connection is successful
|
|
386
|
+
* @param constraints Refer to navigator.mediaDevices.getUserMedia(constraints)
|
|
387
|
+
* @param reset Whether to reset the media channel. If true, reset the entire peerconnection
|
|
388
|
+
* @returns The binding information of the opened channel. Manage the media channel such as closing, pausing, or resuming use.
|
|
389
389
|
*/
|
|
390
390
|
openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
|
|
391
391
|
```
|
|
392
392
|
|
|
393
|
-
|
|
393
|
+
LarkSR configuration item to automatically open the microphone configuration, passed in when `new LarkSR({ ... other configurations omitted ... audioInputAutoStart: true})`,
|
|
394
394
|
|
|
395
|
-
>
|
|
395
|
+
> Manually passed `audioInputAutoStart` has a higher priority than the backend configuration
|
|
396
396
|
|
|
397
397
|
```javascript
|
|
398
398
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
399
|
+
* When the audio input function is enabled, whether to automatically connect to the audio device.
|
|
400
|
+
* Disabled by default.
|
|
401
|
+
* Note that the default audio device of the system is enabled by default.
|
|
402
402
|
*/
|
|
403
403
|
audioInputAutoStart?: boolean;
|
|
404
404
|
```
|
|
405
405
|
|
|
406
|
-
|
|
406
|
+
Get the status of the currently opened audio device, such as `larksr.audioPaused`
|
|
407
407
|
|
|
408
408
|
```javascript
|
|
409
409
|
/**
|
|
410
|
-
*
|
|
410
|
+
* The ID of the currently opened audio device, if not specified when opened, it is empty
|
|
411
411
|
*/
|
|
412
412
|
get audioDeviceId(): string | null | undefined;
|
|
413
413
|
/**
|
|
414
|
-
*
|
|
414
|
+
* The track object of the currently opened audio, if not opened, it is empty
|
|
415
415
|
*/
|
|
416
416
|
get audioTrack(): MediaStreamTrack | null | undefined;
|
|
417
417
|
/**
|
|
418
|
-
*
|
|
418
|
+
* Whether the audio channel is paused
|
|
419
419
|
*/
|
|
420
420
|
get audioPaused(): boolean | undefined;
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
##
|
|
423
|
+
## Video input interface
|
|
424
424
|
|
|
425
|
-
|
|
425
|
+
After the client is turned on, the cloud application can directly read video data by reading the camera on the server.
|
|
426
426
|
|
|
427
|
-
>
|
|
428
|
-
>
|
|
429
|
-
>
|
|
427
|
+
> The minimum server version that matches this feature is V3.2.61
|
|
428
|
+
> To use this feature, make sure to enable the video input feature in the backend application management
|
|
429
|
+
> Note that the media device should be turned on after the connection is successful. That is, it is effective after calling `mediaPlayed`
|
|
430
430
|
|
|
431
431
|
```typescript
|
|
432
432
|
/**
|
|
433
|
-
*
|
|
434
|
-
* @param audio boolean
|
|
435
|
-
* @param cameraId
|
|
436
|
-
* @param width
|
|
437
|
-
* @param height
|
|
433
|
+
* Turn on a video device, note that the browser restricts it to https or localhost to open video
|
|
434
|
+
* @param audio boolean Whether to turn on audio at the same time
|
|
435
|
+
* @param cameraId Video device id, if not passed, the default device will be opened. @see getConnectedVideoinputDevices
|
|
436
|
+
* @param width Limit the width of the device to be opened
|
|
437
|
+
* @param height Limit the height of the device to be opened
|
|
438
438
|
* @returns Promise
|
|
439
439
|
*/
|
|
440
440
|
openVideo(audio?: boolean, cameraId?: string, width?: number, height?: number): Promise<any>;
|
|
441
441
|
/**
|
|
442
|
-
*
|
|
443
|
-
* @param cameraId
|
|
444
|
-
* @param minWidth
|
|
445
|
-
* @param minHeight
|
|
442
|
+
* Turn on the camera device
|
|
443
|
+
* @param cameraId Camera device ID, @see getConnectedVideoinputDevices
|
|
444
|
+
* @param minWidth Limit the width of the device to be opened
|
|
445
|
+
* @param minHeight Limit the height of the device to be opened
|
|
446
446
|
* @returns @see openUserMedia
|
|
447
447
|
*/
|
|
448
448
|
openCamera(cameraId: string, minWidth?: number, minHeight?: number): Promise<any>;
|
|
449
449
|
/**
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
* @param video
|
|
453
|
-
* @param audio
|
|
450
|
+
* Turn on the default media device, note that the browser restricts it to https or localhost
|
|
451
|
+
* If you need to specify a specific media device, please use @see openAudio @see openVideo separately
|
|
452
|
+
* @param video Whether to include video
|
|
453
|
+
* @param audio Whether to include audio
|
|
454
454
|
* @returns Promise
|
|
455
455
|
*/
|
|
456
|
-
openDefaultMedia(video?: boolean, audio?: boolean)>;
|
|
456
|
+
openDefaultMedia(video?: boolean, audio?: boolean): Promise<any>;
|
|
457
457
|
/**
|
|
458
|
-
*
|
|
458
|
+
* Return the list of connected video devices
|
|
459
459
|
* @returns Promise<MediaDeviceInfo[]>
|
|
460
460
|
*/
|
|
461
|
-
getConnectedVideoinputDevices()
|
|
461
|
+
getConnectedVideoinputDevices(): Promise<MediaDeviceInfo[]>;
|
|
462
462
|
/**
|
|
463
|
-
*
|
|
464
|
-
* @param enable
|
|
463
|
+
* Set whether the currently opened video track is enabled
|
|
464
|
+
* @param enable Whether to enable
|
|
465
465
|
* @returns void
|
|
466
466
|
*/
|
|
467
|
-
setVideoEnable(enable: boolean);
|
|
467
|
+
setVideoEnable(enable: boolean): void;
|
|
468
468
|
|
|
469
469
|
/**
|
|
470
|
-
*
|
|
470
|
+
* Pause sending video
|
|
471
471
|
* @returns
|
|
472
472
|
*/
|
|
473
473
|
pauseVideoSending(): any;
|
|
474
474
|
/**
|
|
475
|
-
*
|
|
475
|
+
* Resume sending video
|
|
476
476
|
* @returns
|
|
477
477
|
*/
|
|
478
478
|
resumeVideoSending(): any;
|
|
479
479
|
|
|
480
480
|
/**
|
|
481
|
-
*
|
|
481
|
+
* Turn off the currently opened video device
|
|
482
482
|
* @returns
|
|
483
483
|
*/
|
|
484
484
|
closeVideo(): any;
|
|
485
485
|
/**
|
|
486
|
-
*
|
|
486
|
+
* Turn off the currently opened shared device, such as a shared tab, etc.
|
|
487
487
|
* @returns
|
|
488
488
|
*/
|
|
489
489
|
closeShare(): any;
|
|
490
490
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
* @param constraints
|
|
494
|
-
* @param reset
|
|
495
|
-
* @returns
|
|
491
|
+
* Request the browser to open the media and open the upload channel to the server.
|
|
492
|
+
* Note that the request should be made after the server connection is successful
|
|
493
|
+
* @param constraints Refer to navigator.mediaDevices.getUserMedia(constraints)
|
|
494
|
+
* @param reset Whether to reset the media channel. If true, reset the entire peerconnection
|
|
495
|
+
* @returns The binding information of the opened channel. Manage the media channel such as closing, pausing, or resuming use.
|
|
496
496
|
*/
|
|
497
497
|
openUserMedia(constraints?: MediaStreamConstraints, reset?: boolean): Promise<any>;
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
LarkSR configuration item to automatically open the video input configuration, passed in when `new LarkSR({ ... other configurations omitted ... videoInputAutoStart: true})`,
|
|
501
501
|
|
|
502
|
-
>
|
|
502
|
+
> Manually passed `videoInputAutoStart` has a higher priority than the backend configuration
|
|
503
503
|
|
|
504
504
|
```javascript
|
|
505
505
|
/**
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
506
|
+
* When the video input function is enabled, whether to automatically connect to the video device.
|
|
507
|
+
* Disabled by default.
|
|
508
|
+
* Note that the default video device of the system is enabled by default.
|
|
509
509
|
*/
|
|
510
510
|
videoInputAutoStart?: boolean;
|
|
511
511
|
```
|
|
512
512
|
|
|
513
|
-
|
|
513
|
+
Get the status of the currently opened video device, such as `larksr.videoPaused`
|
|
514
514
|
|
|
515
515
|
```javascript
|
|
516
516
|
/**
|
|
517
|
-
*
|
|
517
|
+
* The ID of the currently opened video device, if not specified when opened, it is empty
|
|
518
518
|
*/
|
|
519
519
|
get videoDeviceId(): string | null | undefined;
|
|
520
520
|
/**
|
|
521
|
-
*
|
|
521
|
+
* The track object of the currently opened video, if not opened, it is empty
|
|
522
522
|
*/
|
|
523
523
|
get videoTrack(): MediaStreamTrack | null | undefined;
|
|
524
524
|
/**
|
|
525
|
-
*
|
|
525
|
+
* Whether the video channel is paused
|
|
526
526
|
*/
|
|
527
527
|
get videoPaused(): boolean | undefined;
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
-
##
|
|
530
|
+
## Cloud live streaming function
|
|
531
531
|
|
|
532
|
-
>
|
|
532
|
+
> Server 3.2.7.0 added, note that to use the cloud live streaming function, you need to enable this function in the backend application management
|
|
533
533
|
|
|
534
534
|
```javascript
|
|
535
535
|
/**
|
|
536
|
-
*
|
|
536
|
+
* Start the cloud live streaming function
|
|
537
537
|
* @param params {
|
|
538
|
-
* // rtmp push url
|
|
538
|
+
* // rtmp push url must be filled
|
|
539
539
|
* path: "",
|
|
540
540
|
* //rtmp push key
|
|
541
541
|
* key: "",
|
|
542
|
-
* //
|
|
542
|
+
* // Push stream width
|
|
543
543
|
* width: 1280,
|
|
544
|
-
* //
|
|
544
|
+
* // Push stream height
|
|
545
545
|
* height: 720,
|
|
546
546
|
* framerate: 30,
|
|
547
547
|
* // kbps
|
|
548
548
|
* bitrate: 1024 * 2,
|
|
549
|
-
* //
|
|
549
|
+
* // Whether to support reconnection
|
|
550
550
|
* reconnect: true,
|
|
551
|
-
*
|
|
551
|
+
* //Maximum number of reconnections
|
|
552
552
|
* reconnectRetries: 3,
|
|
553
|
-
*
|
|
553
|
+
* //Whether to stream the microphone (if voice input is supported)
|
|
554
554
|
* voice: audioInput,
|
|
555
555
|
* }
|
|
556
556
|
* @returns Promise
|
|
557
557
|
*/
|
|
558
558
|
StartCloudLiveStreaming(params: CloudLark.IRtmp_Start): Promise<void> | undefined;
|
|
559
559
|
/**
|
|
560
|
-
*
|
|
560
|
+
* Turn off the cloud live streaming function
|
|
561
561
|
* @returns
|
|
562
562
|
*/
|
|
563
563
|
StopLiveStreaming(): void | undefined;
|
|
564
564
|
```
|
|
565
565
|
|
|
566
|
-
|
|
566
|
+
The relevant status of cloud live streaming refers to the two events `RTMP_STREAM_STATE` and `RTMP_STREAM_ERROR`
|
|
567
567
|
|
|
568
568
|
```javascript
|
|
569
569
|
/**
|
|
570
|
-
*
|
|
571
|
-
* rtmp
|
|
570
|
+
* Server 3.2.7.0 added
|
|
571
|
+
* rtmp live streaming status
|
|
572
572
|
*/
|
|
573
573
|
RTMP_STREAM_STATE = "rtmpstreamstate",
|
|
574
574
|
/**
|
|
575
|
-
*
|
|
576
|
-
* rtmp
|
|
575
|
+
* Server 3.2.7.0 added
|
|
576
|
+
* rtmp live streaming error
|
|
577
577
|
*/
|
|
578
578
|
RTMP_STREAM_ERROR = "rtmpstreamerror"
|
|
579
579
|
```
|
|
580
580
|
|
|
581
|
-
##
|
|
581
|
+
## Other
|
|
582
582
|
|
|
583
583
|
```typescript
|
|
584
584
|
/**
|
|
585
|
-
*
|
|
586
|
-
* @params data: any
|
|
587
|
-
* @params option: { width: number, height: number }
|
|
588
|
-
* @return { data: any, base64: base64string }
|
|
585
|
+
* Capture a frame of image
|
|
586
|
+
* @params data: any Additional data thrown when the capture event is thrown, such as the capture timestamp
|
|
587
|
+
* @params option: { width: number, height: number } Screenshot width and height, if not set, use the width and height of the cloud application window
|
|
588
|
+
* @return { data: any, base64: base64string } Return the passed data and the captured base64 string
|
|
589
589
|
*/
|
|
590
590
|
captrueFrame(data: any, option?: { width: number; height: number;})
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
|
-
*
|
|
594
|
-
* handelRootElementSize
|
|
595
|
-
*
|
|
596
|
-
* @param force
|
|
593
|
+
* Set whether to force landscape display content.
|
|
594
|
+
* handelRootElementSize must be set to true to be effective.
|
|
595
|
+
* Note that in forced landscape mode, the coordinate system xy of the webpage is opposite to the visual, if input events are input through external input. Pay attention to adjustment
|
|
596
|
+
* @param force Whether to force landscape
|
|
597
597
|
*/
|
|
598
598
|
setMobileForceLandScape(force: boolean): void;
|
|
599
599
|
/**
|
|
600
|
-
*
|
|
600
|
+
* Remove the rendering component from the DOM, note that after the rendering component is removed, it will not be possible to enter the application again, all states will be invalid, and cannot be restored, only new LarkSR can be used
|
|
601
601
|
*/
|
|
602
602
|
destroy(): void;
|
|
603
603
|
```
|