larksr_websdk 3.2.6 → 3.2.10

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 (63) hide show
  1. package/README.md +35 -24
  2. package/dist/doc/index.md +43 -3
  3. package/dist/larksr-web-sdk.min.js +3 -3
  4. package/dist/types/api.d.ts +27 -0
  5. package/dist/types/appli_params.d.ts +7 -0
  6. package/dist/types/index.d.ts +2 -1
  7. package/dist/types/larksr.d.ts +86 -9
  8. package/dist/types/screen_state.d.ts +6 -1
  9. package/package.json +9 -6
  10. package/types/api.d.ts +114 -0
  11. package/types/appli_params.d.ts +267 -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 +18 -11
  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 +0 -0
  27. package/{dist/types → types}/lark/peer_connection.d.ts +20 -17
  28. package/{dist/types → types}/lark/sdp_util.d.ts +0 -0
  29. package/{dist/types → types}/lark/test_pixel_streaming.d.ts +0 -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 +562 -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 +8 -1
  49. package/{dist/types → types}/operation/pixel_streaming_input.d.ts +0 -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
  63. package/dist/dist.zip +0 -0
@@ -0,0 +1,267 @@
1
+ import ScaleMode from './utils/scale_mode';
2
+ import { StartAppInfo } from './api';
3
+ import { ILarkSRConfig } from './larksr';
4
+ export interface IAppliParams {
5
+ /**
6
+ * appserver 的ip地址
7
+ */
8
+ appServer: string;
9
+ /**
10
+ * appserver 的端口号
11
+ */
12
+ appPort: string;
13
+ /**
14
+ * appli type
15
+ */
16
+ appliType: number;
17
+ /**
18
+ * 是否使用 websocket 代理
19
+ */
20
+ wsProxy: boolean;
21
+ /**
22
+ * 优先使用的外网ip. 用在webrtc ice处替换为高优先级的ip
23
+ */
24
+ preferPubOutIp: string;
25
+ /**
26
+ * taskid
27
+ */
28
+ taskid: string;
29
+ /**
30
+ * 当前应用名称
31
+ */
32
+ appliName: string;
33
+ /**
34
+ * @deprecated
35
+ * 应用的宽高。现在云端自动获取宽高
36
+ */
37
+ width: number;
38
+ /**
39
+ * @deprecated
40
+ * 应用的宽高。现在云端自动获取宽高
41
+ */
42
+ height: number;
43
+ /**
44
+ * 缩放模式
45
+ */
46
+ scaleMode: ScaleMode;
47
+ /**
48
+ * 日志级别
49
+ * @default 'warn'
50
+ */
51
+ logLevel: 'info' | 'warn' | 'error';
52
+ /**
53
+ * 无操作时间。超时断开连接.
54
+ */
55
+ noOperationTimeout: number;
56
+ /**
57
+ * 是否显示右下角的水印。
58
+ */
59
+ waterMark: boolean;
60
+ /**
61
+ * 检测的rtt值,rtt超过该值将提示用户网络环境差
62
+ */
63
+ rttLimit: number;
64
+ /**
65
+ * 检测的丢包率。丢包率超过该值提示用户网络环境差
66
+ */
67
+ packetLostLimit: number;
68
+ /**
69
+ * 丢包率和rtt提示的时间间隔。
70
+ */
71
+ rttLimitInterval: number;
72
+ /**
73
+ * 码率. 用在在创建 webrtc sdp时替换为此码率。
74
+ */
75
+ codeRate: number;
76
+ /**
77
+ * audio code rate
78
+ * https://stackoverflow.com/questions/33649283/how-to-set-up-sdp-for-high-quality-opus-audio
79
+ * a=fmtp:111 minptime=10;useinbandfec=1; stereo=1; maxaveragebitrate=510000
80
+ */
81
+ audioCodeRate: number;
82
+ /**
83
+ * 帧率,在登录task时传给后端。
84
+ */
85
+ frameRate: number;
86
+ /**
87
+ * 网络状态,影响 webrtc offer 创建时最低码率。
88
+ */
89
+ network: 'local' | 'public';
90
+ /**
91
+ * 使用的语言,目前只支持英语和中文。
92
+ */
93
+ language: string;
94
+ /**
95
+ * 初始的鼠标锁定模式
96
+ * false:非锁定模式
97
+ * true:锁定模式
98
+ */
99
+ initCursorMode: boolean;
100
+ /**
101
+ * 背景颜色
102
+ */
103
+ bgColor: string;
104
+ /**
105
+ * 全屏模式
106
+ * 0 -》 用户手动触发
107
+ * 1 -》 首次点击进入触发
108
+ * 2 -》 每次点击触发
109
+ */
110
+ fullScreenMode: number;
111
+ /**
112
+ * 手机端全屏模式
113
+ * 0 -》 用户手动触发
114
+ * 1 -》 首次点击进入触发
115
+ * 2 -》 每次点击触发
116
+ */
117
+ mobileFullScreenMode: number;
118
+ /**
119
+ * 一人操作多人看 0 普通模式 1 交互模式(可以一人操作多人看)
120
+ * 2 多人互动模式,鼠标键盘都放开
121
+ */
122
+ playerMode: number;
123
+ /**
124
+ * 用户类型 number
125
+ * 所有者:1 观察者:0;
126
+ */
127
+ userType: number;
128
+ /**
129
+ * 用户昵称
130
+ */
131
+ nickname: string;
132
+ /**
133
+ * 口令:8位唯一码,写入TaskInfo. 房间code,备用。
134
+ */
135
+ roomCode: number;
136
+ /**
137
+ * debug task. 跳过task检测
138
+ */
139
+ debugTask: boolean;
140
+ /**
141
+ * debug webserver
142
+ */
143
+ debugWebServer: string;
144
+ /**
145
+ * laoding timeout
146
+ * 5 * 60
147
+ */
148
+ loadingTimeout: number;
149
+ /**
150
+ * share url
151
+ */
152
+ shareUrl: boolean;
153
+ /**
154
+ * 是否强制横屏
155
+ */
156
+ mobileForceLandscape: boolean;
157
+ /**
158
+ * 移动端初始化初始化是否显示手柄
159
+ */
160
+ mobileVirtualJoystick: boolean;
161
+ /**
162
+ * mouseZoomDirection
163
+ * 用于移动端捏合缩放操作与应用鼠标缩放的对应关系
164
+ * 1:鼠标滚轮向上为放大,
165
+ * 0:鼠标滚轮向下为放大(default)
166
+ */
167
+ mouseZoomDirection: number;
168
+ /**
169
+ * 初始是否显示玩家列表
170
+ */
171
+ showPlayerList: boolean;
172
+ /**
173
+ * 优先使用的解码器
174
+ */
175
+ perferDecoder: 'auto' | 'vp8' | 'vp9' | 'h264' | 'av1x';
176
+ /**
177
+ * 触摸操作对应的操作方式,触摸屏还是鼠标
178
+ */
179
+ touchOperateMode: 'touchScreen' | 'mouse';
180
+ /**
181
+ * appid
182
+ */
183
+ appliId: string;
184
+ /**
185
+ *
186
+ */
187
+ syncLocalToCloudClipboard: boolean;
188
+ enableRttIcon: boolean;
189
+ enableSoundRequire: boolean;
190
+ toastLevel: number;
191
+ appKey: string;
192
+ groupId: string;
193
+ }
194
+ export declare enum AppliType {
195
+ DESKTOP = 1,
196
+ SHARED = 2,
197
+ PIXEL_STREAMING = 13,
198
+ VR = 3,
199
+ VR_STEAM = 5,
200
+ NV_VR = 6,
201
+ XR = 7,
202
+ PXY_AR = 9,
203
+ NV_AR = 11
204
+ }
205
+ export declare class AppliParams implements IAppliParams {
206
+ appServer: string;
207
+ appPort: string;
208
+ appliType: AppliType;
209
+ wsProxy: boolean;
210
+ preferPubOutIp: string;
211
+ taskid: string;
212
+ appliName: string;
213
+ width: number;
214
+ height: number;
215
+ scaleMode: ScaleMode;
216
+ logLevel: 'info' | 'warn' | 'error';
217
+ noOperationTimeout: number;
218
+ waterMark: boolean;
219
+ rttLimit: number;
220
+ packetLostLimit: number;
221
+ rttLimitInterval: number;
222
+ codeRate: number;
223
+ audioCodeRate: number;
224
+ frameRate: number;
225
+ network: 'local' | 'public';
226
+ language: string;
227
+ initCursorMode: boolean;
228
+ bgColor: string;
229
+ fullScreenMode: number;
230
+ mobileFullScreenMode: number;
231
+ playerMode: number;
232
+ userType: number;
233
+ nickname: string;
234
+ roomCode: number;
235
+ debugTask: boolean;
236
+ debugWebServer: string;
237
+ loadingTimeout: number;
238
+ shareUrl: boolean;
239
+ mobileForceLandscape: boolean;
240
+ mobileVirtualJoystick: boolean;
241
+ mouseZoomDirection: number;
242
+ showPlayerList: boolean;
243
+ perferDecoder: 'auto' | 'vp8' | 'vp9' | 'h264' | 'av1x';
244
+ touchOperateMode: 'touchScreen' | 'mouse';
245
+ appliId: string;
246
+ syncLocalToCloudClipboard: boolean;
247
+ enableRttIcon: boolean;
248
+ enableSoundRequire: boolean;
249
+ toastLevel: number;
250
+ appKey: string;
251
+ groupId: string;
252
+ static copyAndCreate(params?: IAppliParams): AppliParams;
253
+ static setUpWithSDKConfig(params: IAppliParams, config: ILarkSRConfig): AppliParams;
254
+ }
255
+ export declare function CreateAppliParams(): IAppliParams;
256
+ export declare class AppliParamsUtils {
257
+ static getScaleMode(init: number | null | undefined): string;
258
+ static getNetwork(init: number | null | undefined): 'local' | 'public';
259
+ static getLogLevel(level: string | null | undefined): 'info' | 'warn';
260
+ static getBoolOption(option: string | null | undefined | boolean, emptyValue?: boolean): boolean;
261
+ static getNumberBoolOption(option: string | null | undefined | number, emptyValue?: boolean): boolean;
262
+ static getStringOption(option: string | null | undefined, emptyValue?: string): string;
263
+ static getIntOption(option: string | null | undefined, emptyValue?: number): number;
264
+ static getBgColor(option: string | null | undefined): string;
265
+ }
266
+ export declare function LoadAppliParamsFromUrl(): IAppliParams;
267
+ export declare function LoadAppliParamsStartAppInfo(startAppInfo: StartAppInfo): IAppliParams;
File without changes
File without changes
File without changes
@@ -0,0 +1,59 @@
1
+ import ScaleModel from './utils/scale_mode';
2
+ export default class Config {
3
+ static BuildType: 'local' | 'public';
4
+ static LocalHomepagePath: string;
5
+ /**
6
+ */
7
+ static VersionMarjor: number;
8
+ static VersionMinorr: number;
9
+ static VersionRevise: number;
10
+ static VersionBuild: number;
11
+ /**
12
+ * webrtc 断开连接重试次数
13
+ */
14
+ static RetryTime: number;
15
+ /**
16
+ * design width/height
17
+ * TODO reset with 0. check with render server.
18
+ */
19
+ static OriginW: number;
20
+ static OriginH: number;
21
+ /**
22
+ * 默认码率从应用服务器接收码率
23
+ */
24
+ static CodeRate: number;
25
+ static AudioCodeRate: number;
26
+ static FrameRate: number;
27
+ /**
28
+ * default scale mode. 以应用原始尺寸的缩放
29
+ */
30
+ static ScaleMode: ScaleModel;
31
+ /**
32
+ * default net work.
33
+ */
34
+ static Network: 'local' | 'public';
35
+ /**
36
+ * 鼠标模式
37
+ * 0 == 相对
38
+ * 1 == 绝对
39
+ */
40
+ static MouseMode: number;
41
+ /**
42
+ * replace server ip for aws
43
+ */
44
+ static ForceIceAddr: boolean;
45
+ /**
46
+ * 禁用 VPX
47
+ */
48
+ static DisableVPX: boolean;
49
+ /**
50
+ * 是否启用相对鼠标移动虚拟摇杆
51
+ */
52
+ static RelativeMouseMove: boolean;
53
+ /**
54
+ * 虚拟摇杆精度
55
+ */
56
+ static VirtualRackerScale: number;
57
+ static ErrChromeAndroidVersion: string[];
58
+ static DownloadChromium: string;
59
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,25 @@
1
+ import 'core-js/stable/symbol';
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
+ declare const _default: {
4
+ LarkSR: typeof LarkSR;
5
+ CreateLarkSRClientFromePXYHost: typeof CreateLarkSRClientFromePXYHost;
6
+ CreateLarkSRClientFromeAPI: typeof CreateLarkSRClientFromeAPI;
7
+ CreateLarkSRClientFromeUrl: typeof CreateLarkSRClientFromeUrl;
8
+ API: typeof API;
9
+ AppliParams: typeof AppliParams;
10
+ LoadAppliParamsFromUrl: typeof LoadAppliParamsFromUrl;
11
+ AppliParamsUtils: typeof AppliParamsUtils;
12
+ LoadAppliParamsStartAppInfo: typeof LoadAppliParamsStartAppInfo;
13
+ EventBase: typeof EventBase;
14
+ ScaleMode: typeof ScaleMode;
15
+ Capabilities: typeof Capabilities;
16
+ CloudLark: typeof CloudLark;
17
+ FullScreen: typeof FullScreen;
18
+ LockPointer: typeof LockPointer;
19
+ Operation: typeof Operation;
20
+ LarkSRClientEvent: typeof LarkSRClientEvent;
21
+ LarkEventType: typeof LarkEventType;
22
+ KEYMAP: import("./operation/keymap").VritualKeyMapOptions;
23
+ };
24
+ export default _default;
25
+ export { ILarkSRConfig, PlayerModeType, UserType, LarkSREvent, };
File without changes
@@ -26,17 +26,18 @@ export declare enum APP_EVENT_TYPE {
26
26
  INFO = 3,
27
27
  APP_CLOSE = 4,
28
28
  REMOTE_STREAM = 5,
29
- SYNC_CURSORSTYLE = 6,
30
- APP_STATE_CHANGE = 7,
31
- NET_STATE = 8,
32
- LK_APP_RESIZE = 9,
33
- LK_APP_MOUSE_MODE = 10,
34
- LK_APP_PLAER_LIST = 11,
35
- LK_APP_REQUEST_TEXT = 12,
36
- LK_DATA_CHANNEL_RENDERSERVER_TEXT_MESSAGE = 13,
37
- LK_DATA_CHANNEL_RENDERSERVER_BINARY_MESSAGE = 14,
38
- LK_DATA_CHANNEL_RENDERSERVER_OPEN = 15,
39
- LK_DATA_CHANNEL_RENDERSERVER_CLOSE = 16
29
+ REMOTE_AUDIO_STREAM = 6,
30
+ SYNC_CURSORSTYLE = 7,
31
+ APP_STATE_CHANGE = 8,
32
+ NET_STATE = 9,
33
+ LK_APP_RESIZE = 10,
34
+ LK_APP_MOUSE_MODE = 11,
35
+ LK_APP_PLAER_LIST = 12,
36
+ LK_APP_REQUEST_TEXT = 13,
37
+ LK_DATA_CHANNEL_RENDERSERVER_TEXT_MESSAGE = 14,
38
+ LK_DATA_CHANNEL_RENDERSERVER_BINARY_MESSAGE = 15,
39
+ LK_DATA_CHANNEL_RENDERSERVER_OPEN = 16,
40
+ LK_DATA_CHANNEL_RENDERSERVER_CLOSE = 17
40
41
  }
41
42
  export interface AppEvent extends LocalEvent<APP_EVENT_TYPE> {
42
43
  data?: any;
@@ -76,6 +77,8 @@ export default class Application extends EventBase<APP_EVENT_TYPE, AppEvent> {
76
77
  setIce(sdpMlineindex: number, sdpmid: string, candidate: string): void;
77
78
  sendInput(input: Msg.CloudLark.ClientInput): void;
78
79
  sendInputBuffer(buffer: ArrayBuffer): void;
80
+ private sendToWebsocektChannelBuffer;
81
+ private sendToWebsocektChannelMsg;
79
82
  private onChannelOpen;
80
83
  private onClose;
81
84
  private onChannelMsg;
@@ -91,11 +94,15 @@ export default class Application extends EventBase<APP_EVENT_TYPE, AppEvent> {
91
94
  private onLocalSdp;
92
95
  private onLoacalIce;
93
96
  private onRemoteStream;
97
+ private onAudioRemoteStream;
94
98
  private onRtcError;
95
99
  private onIceStateChange;
96
100
  retryPeerconnection(): void;
97
101
  private onPeerConnectionDisconnect;
98
102
  private onBadNetwork;
103
+ private onPixelStreamingPlayerList;
104
+ private onPixelStreamingDataChannelState;
105
+ private onPixelStreamingDataChannelData;
99
106
  private onCursorStyle;
100
107
  private onAppResize;
101
108
  private onAppMouseMode;
File without changes
File without changes
File without changes
@@ -9,22 +9,23 @@ export declare enum IceState {
9
9
  }
10
10
  export declare enum WEBRTC_EVENT_TYPE {
11
11
  GOT_REMOTE_STREAM = 0,
12
- ICE_STATE_CHANGE = 1,
13
- LK_APP_RESIZE = 2,
14
- LK_APP_MOUSE_MODE = 3,
15
- LK_APP_PLAER_LIST = 4,
16
- LK_APP_REQUEST_TEXT = 5,
17
- LK_DATA_CHANNEL_RENDERSERVER_TEXT_MESSAGE = 6,
18
- LK_DATA_CHANNEL_RENDERSERVER_BINARY_MESSAGE = 7,
19
- LK_DATA_CHANNEL_RENDERSERVER_OPEN = 8,
20
- LK_DATA_CHANNEL_RENDERSERVER_CLOSE = 9,
21
- LK_RTC_EVENT_PEERCONNECTION_STATE = 10,
22
- NET_STATE = 11,
23
- SYNC_CURSORSTYLE = 12,
24
- BAD_NETWORK = 13,
25
- ERROR = 14,
26
- RTC_SDP = 15,
27
- RTC_ICECANDIDATE = 16
12
+ GOT_REMOTE_AUDIO_STREAM = 1,
13
+ ICE_STATE_CHANGE = 2,
14
+ LK_APP_RESIZE = 3,
15
+ LK_APP_MOUSE_MODE = 4,
16
+ LK_APP_PLAER_LIST = 5,
17
+ LK_APP_REQUEST_TEXT = 6,
18
+ LK_DATA_CHANNEL_RENDERSERVER_TEXT_MESSAGE = 7,
19
+ LK_DATA_CHANNEL_RENDERSERVER_BINARY_MESSAGE = 8,
20
+ LK_DATA_CHANNEL_RENDERSERVER_OPEN = 9,
21
+ LK_DATA_CHANNEL_RENDERSERVER_CLOSE = 10,
22
+ LK_RTC_EVENT_PEERCONNECTION_STATE = 11,
23
+ NET_STATE = 12,
24
+ SYNC_CURSORSTYLE = 13,
25
+ BAD_NETWORK = 14,
26
+ ERROR = 15,
27
+ RTC_SDP = 16,
28
+ RTC_ICECANDIDATE = 17
28
29
  }
29
30
  export interface GoogleBitRate {
30
31
  start: number;
@@ -84,6 +85,8 @@ export default class PeerConnection extends EventBase<WEBRTC_EVENT_TYPE, WebRTCE
84
85
  private lastPacktetsLost;
85
86
  private lastPacktetsReceived;
86
87
  private larksr;
88
+ private audioStream;
89
+ private videoStream;
87
90
  constructor(larksr: LarkSR, config: WebRTCConfig);
88
91
  create(): void;
89
92
  createOffer(): void;
@@ -105,7 +108,7 @@ export default class PeerConnection extends EventBase<WEBRTC_EVENT_TYPE, WebRTCE
105
108
  private onCreateOfferSuccess;
106
109
  private onIceCandidate;
107
110
  private onIceStateChange;
108
- private gotRemoteStream;
111
+ private ontrack;
109
112
  private addIceCandidate;
110
113
  private iceStateChange;
111
114
  private $emit;
File without changes
File without changes