larksr_websdk 3.2.1 → 3.2.6

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.
@@ -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;
@@ -9,6 +9,10 @@ export interface IAppliParams {
9
9
  * appserver 的端口号
10
10
  */
11
11
  appPort: string;
12
+ /**
13
+ * appli type
14
+ */
15
+ appliType: number;
12
16
  /**
13
17
  * 是否使用 websocket 代理
14
18
  */
@@ -24,7 +28,7 @@ export interface IAppliParams {
24
28
  /**
25
29
  * 当前应用名称
26
30
  */
27
- courseName: string;
31
+ appliName: string;
28
32
  /**
29
33
  * @deprecated
30
34
  * 应用的宽高。现在云端自动获取宽高
@@ -41,7 +45,7 @@ export interface IAppliParams {
41
45
  scaleMode: ScaleMode;
42
46
  /**
43
47
  * 日志级别
44
- * @default 'info'
48
+ * @default 'warn'
45
49
  */
46
50
  logLevel: 'info' | 'warn' | 'error';
47
51
  /**
@@ -184,13 +188,25 @@ export interface IAppliParams {
184
188
  enableSoundRequire: boolean;
185
189
  toastLevel: number;
186
190
  }
191
+ export declare enum AppliType {
192
+ DESKTOP = 1,
193
+ SHARED = 2,
194
+ PIXEL_STREAMING = 13,
195
+ VR = 3,
196
+ VR_STEAM = 5,
197
+ NV_VR = 6,
198
+ XR = 7,
199
+ PXY_AR = 9,
200
+ NV_AR = 11
201
+ }
187
202
  export declare class AppliParams implements IAppliParams {
188
203
  appServer: string;
189
204
  appPort: string;
205
+ appliType: AppliType;
190
206
  wsProxy: boolean;
191
207
  preferPubOutIp: string;
192
208
  taskid: string;
193
- courseName: string;
209
+ appliName: string;
194
210
  width: number;
195
211
  height: number;
196
212
  scaleMode: ScaleMode;
@@ -1,5 +1,5 @@
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, KEYMAP, ILarkSRConfig, PlayerModeType, UserType, LarkSREvent } from "./larksr";
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";
3
3
  declare const _default: {
4
4
  LarkSR: typeof LarkSR;
5
5
  CreateLarkSRClientFromeAPI: typeof CreateLarkSRClientFromeAPI;
@@ -16,6 +16,9 @@ declare const _default: {
16
16
  FullScreen: typeof FullScreen;
17
17
  LockPointer: typeof LockPointer;
18
18
  Operation: typeof Operation;
19
+ LarkSRClientEvent: typeof LarkSRClientEvent;
20
+ LarkEventType: typeof LarkEventType;
21
+ KEYMAP: import("./operation/keymap").VritualKeyMapOptions;
19
22
  };
20
23
  export default _default;
21
- export { LarkEventType, LarkSRClientEvent, KEYMAP, ILarkSRConfig, PlayerModeType, UserType, LarkSREvent, };
24
+ export { ILarkSRConfig, PlayerModeType, UserType, LarkSREvent, };
@@ -3,6 +3,7 @@ import * as Msg from '../protobuf/cloudlark';
3
3
  import WebSocektChannel from './websocket_channel';
4
4
  import WebsocketProxy from './websocket_proxy';
5
5
  import { LarkSR } from '../larksr';
6
+ import PixelStreamingWebsocketChannel from './test_pixel_streaming';
6
7
  export declare enum APP_STATE {
7
8
  BEFORE_CREATE = 0,
8
9
  INITED = 1,
@@ -44,6 +45,7 @@ export interface AppEvent extends LocalEvent<APP_EVENT_TYPE> {
44
45
  export default class Application extends EventBase<APP_EVENT_TYPE, AppEvent> {
45
46
  private websocketChannel;
46
47
  private websocketProxy;
48
+ private testPixelStreaming;
47
49
  private peerConnection;
48
50
  get state(): APP_STATE;
49
51
  set state(state: APP_STATE);
@@ -60,7 +62,7 @@ export default class Application extends EventBase<APP_EVENT_TYPE, AppEvent> {
60
62
  sendTextToDataChannel(text: string): void;
61
63
  sendBinaryToDataChannel(binary: Uint8Array): void;
62
64
  start(): Promise<void>;
63
- connect(): Promise<WebsocketProxy> | Promise<WebSocektChannel> | undefined;
65
+ connect(): Promise<PixelStreamingWebsocketChannel> | Promise<WebsocketProxy> | Promise<WebSocektChannel> | undefined;
64
66
  disConnect(): void;
65
67
  closeRtc(): void;
66
68
  versionCheck(): void;
@@ -71,8 +73,9 @@ export default class Application extends EventBase<APP_EVENT_TYPE, AppEvent> {
71
73
  restartApp(): void;
72
74
  rtcOffer(): void;
73
75
  setAnswer(sdp: string): void;
74
- setIce(candidate: string): void;
76
+ setIce(sdpMlineindex: number, sdpmid: string, candidate: string): void;
75
77
  sendInput(input: Msg.CloudLark.ClientInput): void;
78
+ sendInputBuffer(buffer: ArrayBuffer): void;
76
79
  private onChannelOpen;
77
80
  private onClose;
78
81
  private onChannelMsg;
@@ -1,4 +1,4 @@
1
- export declare const enum LarkEventType {
1
+ export declare enum LarkEventType {
2
2
  LK_WEB_CLIENT_LOAD_SUCCESS = 1,
3
3
  LK_API_ENTERAPPLI_SUCCESS = 10,
4
4
  LK_API_ENTERAPPLI_FAILED = 11,
@@ -1,11 +1,12 @@
1
1
  import * as Msg from '../protobuf/cloudlark';
2
2
  import { LarkEventType } from './lark_event_type';
3
3
  export declare const MESSAGE_MAGIC = 538317090;
4
+ export declare const PIXEL_STREAMING_MESSAGE_MAGIC = 539037986;
4
5
  export default class Message {
5
- static emptyMsg(): Msg.CloudLark.ToServerMessage;
6
- static versionCheckRequest(): Msg.CloudLark.ToServerMessage;
7
- static taskRequest(taskid: string, isInteractiveMode: boolean, isObMode: boolean, nickName: string): Msg.CloudLark.ToServerMessage;
8
- static startStreamReqeuest(request: Msg.CloudLark.IStartStreamRequest): Msg.CloudLark.ToServerMessage;
6
+ static emptyMsg(isPixelStreaming?: boolean): Msg.CloudLark.ToServerMessage;
7
+ static versionCheckRequest(isPixelStreaming: boolean): Msg.CloudLark.ToServerMessage;
8
+ static taskRequest(taskid: string, isInteractiveMode: boolean, isObMode: boolean, nickName: string, isPixelStreaming: boolean): Msg.CloudLark.ToServerMessage;
9
+ static startStreamReqeuest(request: Msg.CloudLark.IStartStreamRequest, isPixelStreaming: boolean): Msg.CloudLark.ToServerMessage;
9
10
  static startMonitorStreamReqeuest(request: Msg.CloudLark.IVrMonitorRequest): Msg.CloudLark.ToServerMessage;
10
11
  static rtcOfferMsg(type: string, sdp: string): Msg.CloudLark.ToServerMessage;
11
12
  static iceMsg(sdpmid: string, sdpMlineindex: number, candidate: string): Msg.CloudLark.ToServerMessage;
@@ -0,0 +1,54 @@
1
+ import { EventBase, LocalEvent } from '../event/event_base';
2
+ import { LarkSR } from '../larksr';
3
+ export declare enum CHANNEL_EVENT_TYPE {
4
+ OPEN = 0,
5
+ CLOSE = 1,
6
+ ERROR = 2,
7
+ CLIENT_MSG = 3
8
+ }
9
+ export interface ChannelEvent extends LocalEvent<CHANNEL_EVENT_TYPE> {
10
+ data?: any;
11
+ }
12
+ export interface PixelStreamingWebscocketConfig {
13
+ serverAddress: string;
14
+ ip: string;
15
+ port: string;
16
+ path?: string;
17
+ }
18
+ export default class PixelStreamingWebsocketChannel extends EventBase<CHANNEL_EVENT_TYPE, ChannelEvent> {
19
+ private get wsServer();
20
+ private config;
21
+ private connection;
22
+ private keepAliveTimeout;
23
+ private larksr;
24
+ constructor(config: PixelStreamingWebscocketConfig, larksr: LarkSR);
25
+ /**
26
+ *
27
+ */
28
+ connect(): Promise<this>;
29
+ /**
30
+ *
31
+ */
32
+ close(): Promise<void>;
33
+ sendMsg(msg: any): void;
34
+ isOpen(): boolean;
35
+ private startKeepAlive;
36
+ private stopKeepAlive;
37
+ /**
38
+ *
39
+ */
40
+ private onMessage;
41
+ private onOpen;
42
+ /**
43
+ *
44
+ * @param e
45
+ */
46
+ private onWSError;
47
+ /**
48
+ *
49
+ * @param e
50
+ */
51
+ private onWSClose;
52
+ private $emit;
53
+ private createEvent;
54
+ }
@@ -1,3 +1,7 @@
1
+ /**
2
+ * fcx@pingxingyun.com
3
+ * www.pingxingyun.com
4
+ */
1
5
  import { EventBase, LocalEvent } from './event/event_base';
2
6
  import Application, { APP_STATE } from './lark/application';
3
7
  import { AppliParams, AppliParamsUtils, IAppliParams, LoadAppliParamsFromUrl, LoadAppliParamsStartAppInfo } from './appli_params';
@@ -6,7 +10,7 @@ import API from './api';
6
10
  import ScreenState from './screen_state';
7
11
  import Operation from './operation/operation';
8
12
  import { CloudLark } from './protobuf/cloudlark';
9
- import { KEYMAP } from './operation/keymap';
13
+ import { KEYMAP, VirtualKey } from './operation/keymap';
10
14
  import FullScreen from './utils/full_screen';
11
15
  import LockPointer from './utils/lock_pointer';
12
16
  import ScaleMode from './utils/scale_mode';
@@ -41,7 +45,7 @@ declare const enum UserType {
41
45
  /**
42
46
  * LarkSR 实例会发出的事件
43
47
  */
44
- declare const enum LarkSRClientEvent {
48
+ declare enum LarkSRClientEvent {
45
49
  /**
46
50
  * 连接渲染服务器成功 .
47
51
  */
@@ -162,6 +166,8 @@ interface LarkSREvent extends LocalEvent<LarkSRClientEvent> {
162
166
  interface ILarkSRConfig {
163
167
  /**
164
168
  * 必选项 根元素。组件会挂载到跟元素下面
169
+ * 注意*不要*设置为 document.documentElement
170
+ * 默认模式下会通过旋转根元素实现强制横屏模式。
165
171
  * @see handelRootElementSize
166
172
  * @see scaleMode
167
173
  */
@@ -255,6 +261,10 @@ interface ILarkSRConfig {
255
261
  * 可选项,手机端是否强制横屏
256
262
  */
257
263
  mobileForceLandscape?: boolean;
264
+ /**
265
+ * 初始化鼠标模式, true 锁定,false 非锁定
266
+ */
267
+ initCursorMode?: boolean;
258
268
  }
259
269
  /**
260
270
  * 通过调用后台接口获取云端应用参数
@@ -274,7 +284,7 @@ export declare function CreateLarkSRClientFromeAPI(config: ILarkSRConfig, params
274
284
  * @param config 传入 config @see ILarkSRConfig
275
285
  * @returns Promise 创建 larksr client 是否成功
276
286
  */
277
- export declare function CreateLarkSRClientFromeUrl(config: ILarkSRConfig): Promise<unknown>;
287
+ export declare function CreateLarkSRClientFromeUrl(config: ILarkSRConfig): Promise<LarkSR>;
278
288
  declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
279
289
  /**
280
290
  * 应用参数,构建时传入
@@ -298,6 +308,7 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
298
308
  * 当前是否是交互模式,交互默认即可以操作的模式
299
309
  */
300
310
  get isInteractiveMode(): boolean;
311
+ get isPixelStreaming(): boolean;
301
312
  /**
302
313
  * 当前 app 的状态
303
314
  */
@@ -322,20 +333,32 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
322
333
  */
323
334
  get op(): Operation;
324
335
  private _op;
336
+ /**
337
+ * 像素流送输入控制
338
+ */
339
+ private pixelInput;
325
340
  private iframeHandler;
326
341
  get fullScreen(): FullScreen;
327
342
  private _fullScreen;
328
343
  get lockPointer(): LockPointer;
329
344
  private _lockPointer;
330
- private view;
345
+ private _view;
331
346
  /**
332
347
  * 视频元素
333
348
  */
334
- get videoElement(): any;
349
+ get videoElement(): HTMLVideoElement;
335
350
  /**
336
351
  * 视频显示组件
337
352
  */
338
353
  get videoComponent(): any;
354
+ /**
355
+ * 视频显示组件的父容器
356
+ */
357
+ get containerElement(): any;
358
+ /**
359
+ *
360
+ */
361
+ get viewportElement(): any;
339
362
  get rootElement(): HTMLElement;
340
363
  private _rootElement;
341
364
  get serverAddress(): string;
@@ -345,6 +368,16 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
345
368
  private _config;
346
369
  private loadingTimeout;
347
370
  private sdkAuth;
371
+ /**
372
+ * 后台分配的用户id
373
+ */
374
+ get uid(): number;
375
+ private _uid;
376
+ /**
377
+ * @returns 是否是 Task的拥有者
378
+ */
379
+ isTaskOwner(): boolean;
380
+ _isTaskOwner: boolean;
348
381
  /**
349
382
  * LarkSR 客户端。所有操作和事件通过该类传递
350
383
  * 注意,如果手动创建该类,要清楚参数的意义,一般只有调试等特殊情况才手动创建该类
@@ -449,4 +482,4 @@ declare class LarkSR extends EventBase<LarkSRClientEvent, LarkSREvent> {
449
482
  private onOperationTimeout;
450
483
  private onOperationInput;
451
484
  }
452
- export { LarkSR, ILarkSRConfig, PlayerModeType, UserType, LarkSREvent, LarkEventType, LarkSRClientEvent, AppliParams, AppliParamsUtils, LoadAppliParamsFromUrl, LoadAppliParamsStartAppInfo, EventBase, API, Operation, Capabilities, ScaleMode, KEYMAP, CloudLark, FullScreen, LockPointer, };
485
+ export { LarkSR, ILarkSRConfig, PlayerModeType, UserType, LarkSREvent, LarkEventType, LarkSRClientEvent, AppliParams, AppliParamsUtils, LoadAppliParamsFromUrl, LoadAppliParamsStartAppInfo, EventBase, API, Operation, Capabilities, ScaleMode, VirtualKey, KEYMAP, CloudLark, FullScreen, LockPointer, };
@@ -8,13 +8,17 @@
8
8
  * TODO fix:atl + tab, f5,ctr,bug
9
9
  * REMOVE F11
10
10
  */
11
- interface Key {
11
+ export interface IVirtualKey {
12
12
  scancode: number;
13
13
  vkey: number;
14
14
  unicode: number;
15
15
  }
16
- declare type tplotOptions = {
17
- [key: string]: Key;
16
+ export declare class VirtualKey implements IVirtualKey {
17
+ scancode: number;
18
+ vkey: number;
19
+ unicode: number;
20
+ }
21
+ export declare type VritualKeyMapOptions = {
22
+ [key: string]: VirtualKey;
18
23
  };
19
- export declare const KEYMAP: tplotOptions;
20
- export {};
24
+ export declare const KEYMAP: VritualKeyMapOptions;
@@ -0,0 +1,82 @@
1
+ import { LarkSR } from '@/larksr';
2
+ import { LocalEvent, EventBase } from '../event/event_base';
3
+ export declare const MessageType: {
4
+ /**********************************************************************/
5
+ IFrameRequest: number;
6
+ RequestQualityControl: number;
7
+ MaxFpsRequest: number;
8
+ AverageBitrateRequest: number;
9
+ StartStreaming: number;
10
+ StopStreaming: number;
11
+ LatencyTest: number;
12
+ RequestInitialSettings: number;
13
+ /**********************************************************************/
14
+ UIInteraction: number;
15
+ Command: number;
16
+ KeyDown: number;
17
+ KeyUp: number;
18
+ KeyPress: number;
19
+ MouseEnter: number;
20
+ MouseLeave: number;
21
+ MouseDown: number;
22
+ MouseUp: number;
23
+ MouseMove: number;
24
+ MouseWheel: number;
25
+ TouchStart: number;
26
+ TouchEnd: number;
27
+ TouchMove: number;
28
+ GamepadButtonPressed: number;
29
+ GamepadButtonReleased: number;
30
+ GamepadAnalog: number;
31
+ };
32
+ export declare const enum PIXEL_STREAMING_EVENT_TYPE {
33
+ InputBuffer = 0
34
+ }
35
+ export interface PixelStreamingEvent extends LocalEvent<PIXEL_STREAMING_EVENT_TYPE> {
36
+ intpuBuffer?: ArrayBuffer;
37
+ }
38
+ export declare const ControlSchemeType: {
39
+ LockedMouse: number;
40
+ HoveringMouse: number;
41
+ };
42
+ export default class PixelStreamingInput extends EventBase<PIXEL_STREAMING_EVENT_TYPE, PixelStreamingEvent> {
43
+ private playerElementClientRect;
44
+ private normalizeAndQuantizeUnsigned;
45
+ private normalizeAndQuantizeSigned;
46
+ private unquantizeAndDenormalizeUnsigned;
47
+ private larksr;
48
+ private inputOptions;
49
+ get startListen(): boolean;
50
+ private _startListen;
51
+ constructor(larksr: LarkSR);
52
+ registerInputs(videoElement: HTMLVideoElement): void;
53
+ setupMouseAndFreezeFrame(playerElement: HTMLElement, videoElement: HTMLVideoElement): void;
54
+ emitUIInteraction(descriptor: any): ArrayBuffer;
55
+ emitCommand(descriptor: any): ArrayBuffer;
56
+ requestInitialSettings(): void;
57
+ requestQualityControl(): void;
58
+ emitMouseMove(x: number, y: number, deltaX: number, deltaY: number): void;
59
+ emitMouseDown(button: number, x: number, y: number): void;
60
+ emitMouseUp(button: number, x: number, y: number): void;
61
+ emitMouseWheel(delta: number, x: number, y: number): void;
62
+ releaseMouseButtons(buttons: number, x: number, y: number): void;
63
+ pressMouseButtons(buttons: number, x: number, y: number): void;
64
+ registerMouseEnterAndLeaveEvents(playerElement: HTMLElement): void;
65
+ registerLockedMouseEvents(playerElement: HTMLElement): void;
66
+ registerHoveringMouseEvents(playerElement: HTMLVideoElement): void;
67
+ registerTouchEvents(playerElement: HTMLVideoElement): void;
68
+ isKeyCodeBrowserKey(keyCode: number): boolean;
69
+ getKeyCode(e: KeyboardEvent): number;
70
+ registerKeyboardEvents(): void;
71
+ setupHtmlEvents(): void;
72
+ gamepadConnectHandler(e: any): void;
73
+ gamepadDisconnectHandler(e: any): void;
74
+ emitControllerAxisMove(controllerIndex: any, axisIndex: number, analogValue: number): void;
75
+ emitControllerButtonPressed(controllerIndex: any, buttonIndex: number, isRepeat: number): void;
76
+ emitControllerButtonReleased(controllerIndex: any, buttonIndex: number): void;
77
+ scanGamepads(): void;
78
+ updateStatus(): void;
79
+ setupNormalizeAndQuantize(playerElement: HTMLElement, videoElement: HTMLVideoElement): void;
80
+ emitDescriptor(messageType: number, descriptor: any): ArrayBuffer;
81
+ sendInputData(data: ArrayBuffer): void;
82
+ }
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "larksr_websdk",
3
- "version": "3.2.1",
3
+ "version": "3.2.6",
4
4
  "description": "larksr websdk. http://www.pingxingyun.com",
5
- "keywords": ["pingxingyun", "larksr", "cloudrendeing", "webrtc", "cloudxr"],
5
+ "keywords": [
6
+ "pingxingyun",
7
+ "larksr",
8
+ "cloudrendeing",
9
+ "webrtc",
10
+ "cloudxr"
11
+ ],
6
12
  "main": "./dist/larksr-web-sdk.min.js",
7
13
  "types": "./dist/types/index.d.ts",
8
14
  "files": [
@@ -14,7 +20,7 @@
14
20
  "build": "webpack --config webpack.config.js",
15
21
  "build:typings": "tsc --build tsconfig.type.json",
16
22
  "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist/types/",
17
- "dist": "webpack --config webpack.config.js && 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/"
18
24
  },
19
25
  "author": "fcx@pingxingyun.com",
20
26
  "license": "ISC",
@@ -24,13 +30,14 @@
24
30
  "core-js": "^3.18.1",
25
31
  "crypto-js": "^4.1.1",
26
32
  "protobufjs": "^6.11.2",
27
- "webrtc-adapter": "^8.1.0"
33
+ "webrtc-adapter": "^8.1.0",
34
+ "weixin-js-sdk": "^1.6.0"
28
35
  },
29
36
  "devDependencies": {
30
- "@types/crypto-js": "^4.0.2",
31
- "@types/webrtc": "^0.0.30",
32
37
  "@babel/core": "^7.15.5",
33
38
  "@tsconfig/svelte": "^2.0.1",
39
+ "@types/crypto-js": "^4.0.2",
40
+ "@types/webrtc": "^0.0.30",
34
41
  "babel-loader": "^8.2.2",
35
42
  "clean-webpack-plugin": "^4.0.0",
36
43
  "css-loader": "^6.3.0",