larksr_websdk 3.2.7 → 3.2.11

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/types/larksr.d.ts CHANGED
@@ -15,7 +15,7 @@ import FullScreen from './utils/full_screen';
15
15
  import LockPointer from './utils/lock_pointer';
16
16
  import ScaleMode from './utils/scale_mode';
17
17
  import Capabilities from './utils/capabilities';
18
- declare const enum PlayerModeType {
18
+ declare enum PlayerModeType {
19
19
  /**
20
20
  * 普通模式
21
21
  */
@@ -32,7 +32,7 @@ declare const enum PlayerModeType {
32
32
  /**
33
33
  * 当前用户的身份
34
34
  */
35
- declare const enum UserType {
35
+ declare enum UserType {
36
36
  /**
37
37
  * 观看者
38
38
  */
@@ -69,7 +69,11 @@ declare enum LarkSRClientEvent {
69
69
  /**
70
70
  * 获取到远端视频流 .
71
71
  */
72
- GOT_REMOTE_STREAM = "gotremotesteam",
72
+ GOT_REMOTE_STREAM = "gotremotestream",
73
+ /**
74
+ * 获取到远端音频流 .
75
+ */
76
+ GOT_REMOTE_AUDIO_STREAM = "gotremoteaudiostream",
73
77
  /**
74
78
  * 视频加载成功,等待播放 .
75
79
  */
@@ -160,6 +164,9 @@ interface LarkSREvent extends LocalEvent<LarkSRClientEvent> {
160
164
  code?: number;
161
165
  larkevent?: LarkEventType;
162
166
  }
167
+ declare type PublicPortMapping = {
168
+ [key: string]: string;
169
+ };
163
170
  /**
164
171
  * 构造 LarkSR 参数
165
172
  */
@@ -173,10 +180,12 @@ interface ILarkSRConfig {
173
180
  */
174
181
  rootElement: HTMLElement;
175
182
  /**
176
- * 必选项 服务器地址. LarkServer 前台访问的地址
183
+ * 可选项 服务器地址. LarkServer 前台访问的地址
177
184
  * 如: http://192.168.0.55:8181/
185
+ * 当使用托管服务时服务器地址自动分配,可留空。
186
+ * 使用托管服务时@see CreateLarkSRClientFromePXYHost @see larksr.connectWithPxyHost
178
187
  */
179
- serverAddress: string;
188
+ serverAddress?: string;
180
189
  /**
181
190
  * 可选项。 sdk 授权码。如果不在此处填,则必须在后续的实例里调用 initSDKAuthCode 初始化。
182
191
  */
@@ -265,7 +274,34 @@ interface ILarkSRConfig {
265
274
  * 初始化鼠标模式, true 锁定,false 非锁定
266
275
  */
267
276
  initCursorMode?: boolean;
277
+ /**
278
+ * 渲染服务器外网端口映射
279
+ * 格式为 key=[渲染服务器IP:PORT] value=[外网IP:PORT]
280
+ * {
281
+ * "RENDER-A-IP:RENDER-A-PORT1": "PUBLIC-A-IP:PORT1",
282
+ * "RENDER-B-IP:RENDER-B-PORT1": "PUBLIC-A-IP:PORT2",
283
+ * "RENDER-C-IP:RENDER-C-PORT1": "PUBLIC-A-IP:PORT3",
284
+ * "RENDER-D-IP:RENDER-D-PORT1": "PUBLIC-B-IP:PORT1",
285
+ * "RENDER-E-IP:RENDER-E-PORT1": "PUBLIC-B-IP:PORT2",
286
+ * "RENDER-E-IP:RENDER-E-PORT2": "PUBLIC-C-IP:PORT1",
287
+ * }
288
+ */
289
+ publicPortMapping?: PublicPortMapping;
268
290
  }
291
+ /**
292
+ * 通过平行云托管平台创建客户端并启动应用
293
+ * @param config 传入 config @see ILarkSRConfig
294
+ * @param params 进入应用接口参数。appliId 为必填项
295
+ * @returns Promise 创建 larksr client 是否成功
296
+ */
297
+ export declare function CreateLarkSRClientFromePXYHost(config: ILarkSRConfig, params: {
298
+ appliId: string;
299
+ playerMode?: number;
300
+ userType?: number;
301
+ roomCode?: string;
302
+ taskId?: string;
303
+ nickname?: string;
304
+ }): Promise<LarkSR>;
269
305
  /**
270
306
  * 通过调用后台接口获取云端应用参数
271
307
  * @param config 传入 config @see ILarkSRConfig
@@ -278,7 +314,13 @@ export declare function CreateLarkSRClientFromeAPI(config: ILarkSRConfig, params
278
314
  userType?: number;
279
315
  roomCode?: string;
280
316
  taskId?: string;
281
- nickname?: string;
317
+ clientMac?: string;
318
+ groupId?: string;
319
+ regionId?: string;
320
+ targetServerIp?: string;
321
+ appKey?: string;
322
+ timestamp?: string;
323
+ signature?: string;
282
324
  }): Promise<LarkSR>;
283
325
  /**
284
326
  * 通过从url参数中获取云端应用相关参数
@@ -352,6 +394,14 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
352
394
  * 视频显示组件
353
395
  */
354
396
  get videoComponent(): any;
397
+ /**
398
+ * 音频元素
399
+ */
400
+ get audioElement(): HTMLAudioElement;
401
+ /**
402
+ * 是否有单独的音频流
403
+ */
404
+ get isSeprateAudioTrack(): any;
355
405
  /**
356
406
  * 视频显示组件的父容器
357
407
  */
@@ -363,7 +413,6 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
363
413
  get rootElement(): HTMLElement;
364
414
  private _rootElement;
365
415
  get serverAddress(): string;
366
- private _serverAddress;
367
416
  get serverIp(): string;
368
417
  get config(): ILarkSRConfig;
369
418
  private _config;
@@ -393,6 +442,13 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
393
442
  * @returns
394
443
  */
395
444
  initSDKAuthCode(id: string): Promise<void>;
445
+ connectWithPxyHost(params: {
446
+ appliId: string;
447
+ playerMode?: number;
448
+ userType?: number;
449
+ roomCode?: string;
450
+ taskId?: string;
451
+ }): Promise<void>;
396
452
  /**
397
453
  * 连接云端渲染资源
398
454
  * @params appID 云端资源的 ID
@@ -404,8 +460,18 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
404
460
  userType?: number;
405
461
  roomCode?: string;
406
462
  taskId?: string;
407
- nickname?: string;
463
+ clientMac?: string;
464
+ groupId?: string;
465
+ regionId?: string;
466
+ targetServerIp?: string;
467
+ appKey?: string;
468
+ timestamp?: string;
469
+ signature?: string;
408
470
  }): Promise<void>;
471
+ /**
472
+ * 用户手动填昵称,需要在 start 或 connect 设置才能生效。
473
+ */
474
+ setNickname(nickname: string): void;
409
475
  /**
410
476
  * 手动重设进入应用参数
411
477
  * @param params
@@ -465,6 +531,7 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
465
531
  * 可以不使用该方法退出页面
466
532
  */
467
533
  quit(): void;
534
+ resetAppMouseLockState(): void;
468
535
  /**
469
536
  * 操作相关事件
470
537
  * 所有事件坐标相对于云端应用,不相对于网页
@@ -490,10 +557,12 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
490
557
  $emitError(message?: string, code?: number): void;
491
558
  $emitInfo(message?: string, code?: number): void;
492
559
  private createEvent;
560
+ private setupListener;
493
561
  private taskProcess;
494
562
  private startProcess;
495
563
  private onAppStateChange;
496
564
  private onGotRemoteStream;
565
+ private onGotRemoteAudioStream;
497
566
  private onCursorStyle;
498
567
  private onAppResize;
499
568
  private onAppMouseMode;
@@ -1,12 +1,17 @@
1
1
  import { CloudLark } from '../protobuf/cloudlark';
2
2
  import { LocalEvent, EventBase } from '../event/event_base';
3
+ import { Point } from '../common/interface';
3
4
  import { LarkSR } from '../larksr';
4
5
  export declare const enum OPREATION_EVENT_TYPE {
5
6
  Input = 0,
6
- NoOperationTimeout = 1
7
+ NoOperationTimeout = 1,
8
+ ClipboardText = 2,
9
+ CursorMove = 3
7
10
  }
8
11
  export interface OperationEvent extends LocalEvent<OPREATION_EVENT_TYPE> {
9
12
  input?: CloudLark.ClientInput;
13
+ data?: any;
14
+ cursorPoint?: Point;
10
15
  }
11
16
  export default class Operation extends EventBase<OPREATION_EVENT_TYPE, OperationEvent> {
12
17
  private gestureHandler;
@@ -37,6 +42,7 @@ export default class Operation extends EventBase<OPREATION_EVENT_TYPE, Operation
37
42
  setTouchEnable(enable: boolean): void;
38
43
  resetLocalRendreMousePosition(): void;
39
44
  setAppMouseMode(mode: CloudLark.IAppMouseMode): void;
45
+ resetAppMouseLockState(): void;
40
46
  startListening(): void;
41
47
  stopListenling(): void;
42
48
  private startOperationCheck;
@@ -59,4 +65,5 @@ export default class Operation extends EventBase<OPREATION_EVENT_TYPE, Operation
59
65
  $emitTouchUp(id: number, x: number, y: number): void;
60
66
  $emitInputEvent(input: CloudLark.IClientInput): void;
61
67
  $emitNoOperationTimeoutEvent(): void;
68
+ $emitCursorMove(p: Point): void;
62
69
  }