larksr_websdk 3.2.4 → 3.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +35 -24
  2. package/dist/doc/index.md +43 -3
  3. package/dist/larksr-web-sdk.min.js +2 -2
  4. package/dist/types/api.d.ts +23 -0
  5. package/dist/types/appli_params.d.ts +21 -2
  6. package/dist/types/index.d.ts +2 -1
  7. package/dist/types/larksr.d.ts +83 -7
  8. package/dist/types/screen_state.d.ts +6 -1
  9. package/package.json +9 -6
  10. package/types/api.d.ts +108 -0
  11. package/types/appli_params.d.ts +263 -0
  12. package/{dist/types → types}/common/cmd.d.ts +0 -0
  13. package/{dist/types → types}/common/constant.d.ts +0 -0
  14. package/{dist/types → types}/common/interface.d.ts +0 -0
  15. package/types/config.d.ts +59 -0
  16. package/{dist/types → types}/event/bus.d.ts +0 -0
  17. package/{dist/types → types}/event/event_base.d.ts +0 -0
  18. package/{dist/types → types}/event/events.d.ts +0 -0
  19. package/{dist/types → types}/event/iframe_poster.d.ts +0 -0
  20. package/{dist/types → types}/event/message.d.ts +0 -0
  21. package/types/index.d.ts +25 -0
  22. package/{dist/types → types}/lark/Worker.d.ts +0 -0
  23. package/{dist/types → types}/lark/application.d.ts +10 -2
  24. package/{dist/types → types}/lark/custom.d.ts +0 -0
  25. package/{dist/types → types}/lark/lark_event_type.d.ts +0 -0
  26. package/{dist/types → types}/lark/message.d.ts +5 -4
  27. package/{dist/types → types}/lark/peer_connection.d.ts +0 -0
  28. package/{dist/types → types}/lark/sdp_util.d.ts +0 -0
  29. package/types/lark/test_pixel_streaming.d.ts +54 -0
  30. package/{dist/types → types}/lark/websocket_channel.d.ts +0 -0
  31. package/{dist/types → types}/lark/websocket_proxy.d.ts +0 -0
  32. package/types/larksr.d.ts +534 -0
  33. package/{dist/types → types}/localization/base.d.ts +0 -0
  34. package/{dist/types → types}/localization/gesture_ins.d.ts +0 -0
  35. package/{dist/types → types}/localization/language.d.ts +0 -0
  36. package/{dist/types → types}/localization/loader.d.ts +0 -0
  37. package/{dist/types → types}/localization/message.d.ts +0 -0
  38. package/{dist/types → types}/localization/ui.d.ts +0 -0
  39. package/{dist/types → types}/operation/gamepad_handler.d.ts +0 -0
  40. package/{dist/types → types}/operation/gesture.d.ts +0 -0
  41. package/{dist/types → types}/operation/gesture_handler.d.ts +0 -0
  42. package/{dist/types → types}/operation/handler_base.d.ts +0 -0
  43. package/{dist/types → types}/operation/keyboard_handler.d.ts +0 -0
  44. package/{dist/types → types}/operation/keymap.d.ts +0 -0
  45. package/{dist/types → types}/operation/letter_keymap.d.ts +0 -0
  46. package/{dist/types → types}/operation/mouse_handler.d.ts +0 -0
  47. package/{dist/types → types}/operation/num_keymap.d.ts +0 -0
  48. package/{dist/types → types}/operation/operation.d.ts +3 -1
  49. package/types/operation/pixel_streaming_input.d.ts +82 -0
  50. package/{dist/types → types}/operation/touch_handler.d.ts +0 -0
  51. package/{dist/types → types}/operation/utils.d.ts +0 -0
  52. package/{dist/types → types}/protobuf/cloudlark.d.ts +6466 -5944
  53. package/{dist/types → types}/protobuf/message.d.ts +0 -0
  54. package/types/screen_state.d.ts +113 -0
  55. package/types/sdk_auth.d.ts +11 -0
  56. package/{dist/types → types}/utils/browser_type.d.ts +0 -0
  57. package/{dist/types → types}/utils/capabilities.d.ts +0 -0
  58. package/{dist/types → types}/utils/full_screen.d.ts +0 -0
  59. package/{dist/types → types}/utils/lock_pointer.d.ts +0 -0
  60. package/{dist/types → types}/utils/log.d.ts +1 -1
  61. package/{dist/types → types}/utils/scale_mode.d.ts +0 -0
  62. package/{dist/types → types}/utils/unit.d.ts +1 -0
@@ -36,6 +36,8 @@ export interface GetTaskResult {
36
36
  }
37
37
  export interface StartAppInfo {
38
38
  appliId: string;
39
+ appliType: number;
40
+ appliName: string;
39
41
  taskId: string;
40
42
  renderServerIp: string;
41
43
  wsProxy: string;
@@ -63,6 +65,7 @@ export interface StartAppInfo {
63
65
  playerMode?: number;
64
66
  userType?: number;
65
67
  roomCode?: string;
68
+ nickName?: string;
66
69
  nickname?: string;
67
70
  }
68
71
  export default class API {
@@ -70,12 +73,32 @@ export default class API {
70
73
  static GetTaskPATH: string;
71
74
  static ClientLogErrorPath: string;
72
75
  static GetStartInfoPath: string;
76
+ private static PocHostApplGetUrl;
77
+ static HostAppliGetUrl(params: {
78
+ appliId: string;
79
+ playerMode?: number;
80
+ userType?: number;
81
+ roomCode?: string;
82
+ taskId?: string;
83
+ }): Promise<{
84
+ host: string;
85
+ origin: string;
86
+ params: {
87
+ appliId: string;
88
+ appKey: string;
89
+ timestamp: string;
90
+ signature: string;
91
+ };
92
+ }>;
73
93
  static GetStartInfo(serverAddress: string, params: {
74
94
  appliId: string;
75
95
  playerMode?: number;
76
96
  userType?: number;
77
97
  roomCode?: string;
78
98
  taskId?: string;
99
+ appKey?: string;
100
+ timestamp?: string;
101
+ signature?: string;
79
102
  }): Promise<StartAppInfo>;
80
103
  static CheckUTLockInfo(config: ILarkSRConfig): Promise<UTLockInfo>;
81
104
  static GetTask(config: ILarkSRConfig, taskid: string): Promise<GetTaskResult>;
@@ -1,5 +1,6 @@
1
1
  import ScaleMode from './utils/scale_mode';
2
2
  import { StartAppInfo } from './api';
3
+ import { ILarkSRConfig } from './larksr';
3
4
  export interface IAppliParams {
4
5
  /**
5
6
  * appserver 的ip地址
@@ -9,6 +10,10 @@ export interface IAppliParams {
9
10
  * appserver 的端口号
10
11
  */
11
12
  appPort: string;
13
+ /**
14
+ * appli type
15
+ */
16
+ appliType: number;
12
17
  /**
13
18
  * 是否使用 websocket 代理
14
19
  */
@@ -24,7 +29,7 @@ export interface IAppliParams {
24
29
  /**
25
30
  * 当前应用名称
26
31
  */
27
- courseName: string;
32
+ appliName: string;
28
33
  /**
29
34
  * @deprecated
30
35
  * 应用的宽高。现在云端自动获取宽高
@@ -184,13 +189,25 @@ export interface IAppliParams {
184
189
  enableSoundRequire: boolean;
185
190
  toastLevel: number;
186
191
  }
192
+ export declare enum AppliType {
193
+ DESKTOP = 1,
194
+ SHARED = 2,
195
+ PIXEL_STREAMING = 13,
196
+ VR = 3,
197
+ VR_STEAM = 5,
198
+ NV_VR = 6,
199
+ XR = 7,
200
+ PXY_AR = 9,
201
+ NV_AR = 11
202
+ }
187
203
  export declare class AppliParams implements IAppliParams {
188
204
  appServer: string;
189
205
  appPort: string;
206
+ appliType: AppliType;
190
207
  wsProxy: boolean;
191
208
  preferPubOutIp: string;
192
209
  taskid: string;
193
- courseName: string;
210
+ appliName: string;
194
211
  width: number;
195
212
  height: number;
196
213
  scaleMode: ScaleMode;
@@ -228,6 +245,8 @@ export declare class AppliParams implements IAppliParams {
228
245
  enableRttIcon: boolean;
229
246
  enableSoundRequire: boolean;
230
247
  toastLevel: number;
248
+ static copyAndCreate(params?: IAppliParams): AppliParams;
249
+ static setUpWithSDKConfig(params: IAppliParams, config: ILarkSRConfig): AppliParams;
231
250
  }
232
251
  export declare function CreateAppliParams(): IAppliParams;
233
252
  export declare class AppliParamsUtils {
@@ -1,7 +1,8 @@
1
1
  import 'core-js/stable/symbol';
2
- import { LarkSR, CreateLarkSRClientFromeAPI, CreateLarkSRClientFromeUrl, LarkEventType, LarkSRClientEvent, AppliParams, LoadAppliParamsFromUrl, AppliParamsUtils, LoadAppliParamsStartAppInfo, EventBase, API, Operation, Capabilities, ScaleMode, CloudLark, FullScreen, LockPointer, ILarkSRConfig, PlayerModeType, UserType, LarkSREvent } from "./larksr";
2
+ import { LarkSR, CreateLarkSRClientFromePXYHost, CreateLarkSRClientFromeAPI, CreateLarkSRClientFromeUrl, LarkEventType, LarkSRClientEvent, AppliParams, LoadAppliParamsFromUrl, AppliParamsUtils, LoadAppliParamsStartAppInfo, EventBase, API, Operation, Capabilities, ScaleMode, CloudLark, FullScreen, LockPointer, ILarkSRConfig, PlayerModeType, UserType, LarkSREvent } from "./larksr";
3
3
  declare const _default: {
4
4
  LarkSR: typeof LarkSR;
5
+ CreateLarkSRClientFromePXYHost: typeof CreateLarkSRClientFromePXYHost;
5
6
  CreateLarkSRClientFromeAPI: typeof CreateLarkSRClientFromeAPI;
6
7
  CreateLarkSRClientFromeUrl: typeof CreateLarkSRClientFromeUrl;
7
8
  API: typeof API;
@@ -173,10 +173,12 @@ interface ILarkSRConfig {
173
173
  */
174
174
  rootElement: HTMLElement;
175
175
  /**
176
- * 必选项 服务器地址. LarkServer 前台访问的地址
176
+ * 可选项 服务器地址. LarkServer 前台访问的地址
177
177
  * 如: http://192.168.0.55:8181/
178
+ * 当使用托管服务时服务器地址自动分配,可留空。
179
+ * 使用托管服务时@see CreateLarkSRClientFromePXYHost @see larksr.connectWithPxyHost
178
180
  */
179
- serverAddress: string;
181
+ serverAddress?: string;
180
182
  /**
181
183
  * 可选项。 sdk 授权码。如果不在此处填,则必须在后续的实例里调用 initSDKAuthCode 初始化。
182
184
  */
@@ -261,7 +263,25 @@ interface ILarkSRConfig {
261
263
  * 可选项,手机端是否强制横屏
262
264
  */
263
265
  mobileForceLandscape?: boolean;
266
+ /**
267
+ * 初始化鼠标模式, true 锁定,false 非锁定
268
+ */
269
+ initCursorMode?: boolean;
264
270
  }
271
+ /**
272
+ * 通过平行云托管平台创建客户端并启动应用
273
+ * @param config 传入 config @see ILarkSRConfig
274
+ * @param params 进入应用接口参数。appliId 为必填项
275
+ * @returns Promise 创建 larksr client 是否成功
276
+ */
277
+ export declare function CreateLarkSRClientFromePXYHost(config: ILarkSRConfig, params: {
278
+ appliId: string;
279
+ playerMode?: number;
280
+ userType?: number;
281
+ roomCode?: string;
282
+ taskId?: string;
283
+ nickname?: string;
284
+ }): Promise<LarkSR>;
265
285
  /**
266
286
  * 通过调用后台接口获取云端应用参数
267
287
  * @param config 传入 config @see ILarkSRConfig
@@ -274,6 +294,7 @@ export declare function CreateLarkSRClientFromeAPI(config: ILarkSRConfig, params
274
294
  userType?: number;
275
295
  roomCode?: string;
276
296
  taskId?: string;
297
+ nickname?: string;
277
298
  }): Promise<LarkSR>;
278
299
  /**
279
300
  * 通过从url参数中获取云端应用相关参数
@@ -285,7 +306,7 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
285
306
  /**
286
307
  * 应用参数,构建时传入
287
308
  */
288
- get params(): IAppliParams;
309
+ get params(): AppliParams;
289
310
  private _params;
290
311
  /**
291
312
  * 当前的玩家模式,
@@ -304,6 +325,7 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
304
325
  * 当前是否是交互模式,交互默认即可以操作的模式
305
326
  */
306
327
  get isInteractiveMode(): boolean;
328
+ get isPixelStreaming(): boolean;
307
329
  /**
308
330
  * 当前 app 的状态
309
331
  */
@@ -328,6 +350,10 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
328
350
  */
329
351
  get op(): Operation;
330
352
  private _op;
353
+ /**
354
+ * 像素流送输入控制
355
+ */
356
+ private pixelInput;
331
357
  private iframeHandler;
332
358
  get fullScreen(): FullScreen;
333
359
  private _fullScreen;
@@ -337,36 +363,82 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
337
363
  /**
338
364
  * 视频元素
339
365
  */
340
- get videoElement(): any;
366
+ get videoElement(): HTMLVideoElement;
341
367
  /**
342
368
  * 视频显示组件
343
369
  */
344
370
  get videoComponent(): any;
371
+ /**
372
+ * 视频显示组件的父容器
373
+ */
374
+ get containerElement(): any;
375
+ /**
376
+ *
377
+ */
378
+ get viewportElement(): any;
345
379
  get rootElement(): HTMLElement;
346
380
  private _rootElement;
347
381
  get serverAddress(): string;
348
- private _serverAddress;
349
382
  get serverIp(): string;
350
383
  get config(): ILarkSRConfig;
351
384
  private _config;
352
385
  private loadingTimeout;
353
386
  private sdkAuth;
387
+ /**
388
+ * 后台分配的用户id
389
+ */
390
+ get uid(): number;
391
+ private _uid;
392
+ /**
393
+ * @returns 是否是 Task的拥有者
394
+ */
395
+ isTaskOwner(): boolean;
396
+ _isTaskOwner: boolean;
354
397
  /**
355
398
  * LarkSR 客户端。所有操作和事件通过该类传递
356
399
  * 注意,如果手动创建该类,要清楚参数的意义,一般只有调试等特殊情况才手动创建该类
357
400
  * @see CreateLarkSRClientFromeAPI, CreateLarkSRClientFromeUrl
358
401
  * @param config 本地配置,如果有 IAppliParams 相同的配置项,优先级最高
359
- * @param params 云端应用参数等,通过后台接口或者url参数获取。
402
+ * @param params [可选参数] 云端应用参数等,通过后台接口或者url参数获取。
360
403
  */
361
- constructor(config: ILarkSRConfig, params: IAppliParams);
404
+ constructor(config: ILarkSRConfig, params?: IAppliParams);
362
405
  /**
363
406
  *
364
407
  * @param id sdk id 初始化sdkid
365
408
  * @returns
366
409
  */
367
410
  initSDKAuthCode(id: string): Promise<void>;
411
+ connectWithPxyHost(params: {
412
+ appliId: string;
413
+ playerMode?: number;
414
+ userType?: number;
415
+ roomCode?: string;
416
+ taskId?: string;
417
+ }): Promise<void>;
418
+ /**
419
+ * 连接云端渲染资源
420
+ * @params appID 云端资源的 ID
421
+ * @returns Promise 调用接口并校验授权通过返回成功并自动开始连接
422
+ */
423
+ connect(params: {
424
+ appliId: string;
425
+ playerMode?: number;
426
+ userType?: number;
427
+ roomCode?: string;
428
+ taskId?: string;
429
+ nickname?: string;
430
+ appKey?: string;
431
+ timestamp?: string;
432
+ signature?: string;
433
+ }): Promise<void>;
434
+ /**
435
+ * 手动重设进入应用参数
436
+ * @param params
437
+ */
438
+ setAppliParams(params: IAppliParams): void;
368
439
  /**
369
440
  * 开始云渲染流程
441
+ * 启动时应用参数不能为空,包括 taskID,appServer,appPort
370
442
  * @returns 是否成功。主要校验授权码是否成功
371
443
  */
372
444
  start(): Promise<void>;
@@ -378,6 +450,10 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
378
450
  * 重新启动云端应用
379
451
  */
380
452
  restartApp(): void;
453
+ /**
454
+ * 主动关闭连接
455
+ */
456
+ close(): void;
381
457
  /**
382
458
  * 切换当前操作者
383
459
  * @param uid 用户id
@@ -3,6 +3,7 @@ import { IAppliParams } from "./appli_params";
3
3
  import { CloudLark } from "./protobuf/cloudlark";
4
4
  import ScaleMode from "./utils/scale_mode";
5
5
  import { LocalEvent, EventBase } from './event/event_base';
6
+ import { LarkSR } from "./larksr";
6
7
  export interface ContainerSize {
7
8
  marginTop: number;
8
9
  marginLeft: number;
@@ -83,7 +84,9 @@ export default class ScreenState extends EventBase<SCREEN_EVENT_TYPE, ScreenEven
83
84
  get isLockMouse(): boolean;
84
85
  private _isLockMouse;
85
86
  get cursorStyle(): SyncCursorStyle;
87
+ set cursorStyle(style: SyncCursorStyle);
86
88
  private _cursorStyle;
89
+ private get cursorCSSStyle();
87
90
  get appMouseMode(): CloudLark.IAppMouseMode;
88
91
  set appMouseMode(mode: CloudLark.IAppMouseMode);
89
92
  private _appMouseMode;
@@ -103,6 +106,8 @@ export default class ScreenState extends EventBase<SCREEN_EVENT_TYPE, ScreenEven
103
106
  private mobileForceLandScape;
104
107
  private bgColor;
105
108
  private handelRootElementSize;
106
- constructor(rootElement: HTMLElement, params: IAppliParams, handelRootElementSize?: boolean);
109
+ private larksr;
110
+ constructor(rootElement: HTMLElement, params: IAppliParams, larksr: LarkSR, handelRootElementSize?: boolean);
111
+ reset(params: IAppliParams): void;
107
112
  resize(): void;
108
113
  }
package/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "larksr_websdk",
3
- "version": "3.2.4",
4
- "description": "larksr websdk. http://www.pingxingyun.com",
3
+ "version": "3.2.8",
4
+ "description": "Larksr websdk. Easy to build a cloud render client for larksr system or ue4 pixelstreaming.docs: https://pingxingyun.github.io/webclient_sdk/",
5
5
  "keywords": [
6
6
  "pingxingyun",
7
7
  "larksr",
8
8
  "cloudrendeing",
9
9
  "webrtc",
10
- "cloudxr"
10
+ "cloudxr",
11
+ "pixelstreaming"
11
12
  ],
12
13
  "main": "./dist/larksr-web-sdk.min.js",
13
- "types": "./dist/types/index.d.ts",
14
+ "types": "./types/index.d.ts",
14
15
  "files": [
15
- "dist"
16
+ "dist",
17
+ "types",
18
+ "doc,"
16
19
  ],
17
20
  "scripts": {
18
21
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -20,7 +23,7 @@
20
23
  "build": "webpack --config webpack.config.js",
21
24
  "build:typings": "tsc --build tsconfig.type.json",
22
25
  "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist/types/",
23
- "dist": "webpack --config webpack.config.js && copyfiles -u 1 \"src/**/*.d.ts\" dist/types/ && copyfiles -u 1 \"doc/*\" dist/doc/"
26
+ "dist": "webpack --config webpack.config.js && copyfiles -u 1 \"src/**/*.d.ts\" ./types/ && copyfiles -u 1 \"doc/*\" dist/doc/ && copyfiles -u 1 \"types/*\" ./dist/types/"
24
27
  },
25
28
  "author": "fcx@pingxingyun.com",
26
29
  "license": "ISC",
package/types/api.d.ts ADDED
@@ -0,0 +1,108 @@
1
+ import { ILarkSRConfig } from './larksr';
2
+ import { AppliParams } from './appli_params';
3
+ export interface UTLockInfo {
4
+ checkUtLockMessage: string;
5
+ checkUtLockResult: boolean;
6
+ remainMinutes: number;
7
+ }
8
+ export interface GetTaskResult {
9
+ adminViewer: number;
10
+ appKey: string;
11
+ appliId: string;
12
+ appliType: number;
13
+ city: string;
14
+ clientIp: string;
15
+ country: string;
16
+ createDate: string;
17
+ dcs: number;
18
+ limitMaxFps: number;
19
+ offScreen: number;
20
+ playerListToggle: number;
21
+ playerMode: number;
22
+ province: string;
23
+ publicIp: string;
24
+ reserveFlag: number;
25
+ serverId: string;
26
+ serverIp: string;
27
+ shareUrl: string;
28
+ startAt: string;
29
+ startParam: string;
30
+ startProcType: number;
31
+ status: number;
32
+ taskId: string;
33
+ updateDate: string;
34
+ useGamepad: number;
35
+ wm: number;
36
+ }
37
+ export interface StartAppInfo {
38
+ appliId: string;
39
+ appliType: number;
40
+ appliName: string;
41
+ taskId: string;
42
+ renderServerIp: string;
43
+ wsProxy: string;
44
+ preferPublicIp: string;
45
+ renderServerPort: number;
46
+ initCursorMode: number;
47
+ rttLimit: string;
48
+ touchOperateMode: string;
49
+ fullScreenMode: number;
50
+ mobileForceLandscape: number;
51
+ mobileFullScreenMode: number;
52
+ language: string;
53
+ noOperationTimeout: string;
54
+ serverId: string;
55
+ network: string;
56
+ playerListToggle: number;
57
+ bgColor: string;
58
+ logLevel: string;
59
+ mobileVirtualJoystick: number;
60
+ initWinSize: number;
61
+ taskStatus: number;
62
+ mouseZoomDirection: number;
63
+ useGamepad: number;
64
+ rttLimitInterval: string;
65
+ playerMode?: number;
66
+ userType?: number;
67
+ roomCode?: string;
68
+ nickName?: string;
69
+ nickname?: string;
70
+ }
71
+ export default class API {
72
+ static CheckUTLockInfoPath: string;
73
+ static GetTaskPATH: string;
74
+ static ClientLogErrorPath: string;
75
+ static GetStartInfoPath: string;
76
+ private static PocHostApplGetUrl;
77
+ static HostAppliGetUrl(params: {
78
+ appliId: string;
79
+ playerMode?: number;
80
+ userType?: number;
81
+ roomCode?: string;
82
+ taskId?: string;
83
+ }): Promise<{
84
+ host: string;
85
+ origin: string;
86
+ params: {
87
+ appliId: string;
88
+ appKey: string;
89
+ timestamp: string;
90
+ signature: string;
91
+ };
92
+ }>;
93
+ static GetStartInfo(serverAddress: string, params: {
94
+ appliId: string;
95
+ playerMode?: number;
96
+ userType?: number;
97
+ roomCode?: string;
98
+ taskId?: string;
99
+ appKey?: string;
100
+ timestamp?: string;
101
+ signature?: string;
102
+ }): Promise<StartAppInfo>;
103
+ static CheckUTLockInfo(config: ILarkSRConfig): Promise<UTLockInfo>;
104
+ static GetTask(config: ILarkSRConfig, taskid: string): Promise<GetTaskResult>;
105
+ static LogError(errorCode: number, errorMsg: string, params: string, config: ILarkSRConfig): void;
106
+ static ClientInfo(config: ILarkSRConfig, params: AppliParams): void;
107
+ static joinParam(params: any): string;
108
+ }