yjz-web-sdk 1.0.11-beta.2 → 1.0.11-beta.4
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/README.md +90 -0
- package/lib/ScreenControlUtil-CeBJPwr0.js +5065 -0
- package/lib/core/WebRTCSdk.d.ts +0 -2
- package/lib/core/rtc/WebRTCClient.d.ts +7 -3
- package/lib/index.d.ts +2 -2
- package/lib/uni/KeyboardControl.d.ts +53 -0
- package/lib/uni/Logger.d.ts +13 -0
- package/lib/uni/MouseTouchControl.d.ts +56 -0
- package/lib/uni/RemoteCanvasController.d.ts +13 -0
- package/lib/uni/RemoteController.d.ts +23 -0
- package/lib/uni/RemoteVideoController.d.ts +38 -0
- package/lib/uni/WebRTCWrapper.d.ts +57 -0
- package/lib/uni/constants.d.ts +42 -0
- package/lib/uni/index.d.ts +110 -0
- package/lib/uni/type.d.ts +10 -0
- package/lib/uni-sdk.js +1260 -0
- package/lib/yjz-web-sdk.js +15 -5083
- package/package.json +6 -5
- package/lib/core/data/TurnType.d.ts +0 -21
package/lib/core/WebRTCSdk.d.ts
CHANGED
|
@@ -12,8 +12,6 @@ export declare class WebRTCSdk extends EventEmitter {
|
|
|
12
12
|
options: WebRTCConfigOptions;
|
|
13
13
|
isConnected: boolean;
|
|
14
14
|
isConnecting: boolean;
|
|
15
|
-
private connectCount;
|
|
16
|
-
private MAX_COUNT;
|
|
17
15
|
private timeout;
|
|
18
16
|
constructor(options: WebRTCConfigOptions);
|
|
19
17
|
initConfig(): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import type { WebRTCConfig } from "./WebRTCConfig
|
|
3
|
-
import { ChannelDataType } from "../data/WebrtcDataType
|
|
2
|
+
import type { WebRTCConfig } from "./WebRTCConfig";
|
|
3
|
+
import { ChannelDataType } from "../data/WebrtcDataType";
|
|
4
4
|
export declare class WebRTCClient extends EventEmitter {
|
|
5
5
|
private readonly config;
|
|
6
6
|
private peerConnection;
|
|
@@ -9,6 +9,7 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
9
9
|
private isPushingStream;
|
|
10
10
|
private isPushingLocalStream;
|
|
11
11
|
private dataChannel;
|
|
12
|
+
private videoDataChannel;
|
|
12
13
|
private statsTimer;
|
|
13
14
|
private lastReportTime;
|
|
14
15
|
private lastBytesReceived;
|
|
@@ -18,6 +19,8 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
18
19
|
private maxLostRate;
|
|
19
20
|
private lastSecondDecodedCount;
|
|
20
21
|
private fileVideo?;
|
|
22
|
+
private videoTransceiver?;
|
|
23
|
+
private audioTransceiver?;
|
|
21
24
|
private canvas?;
|
|
22
25
|
private canvasStream;
|
|
23
26
|
private rafId;
|
|
@@ -37,8 +40,9 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
37
40
|
switchCamera(useBackCamera: boolean): Promise<void>;
|
|
38
41
|
private getRotatedStream;
|
|
39
42
|
private setVideoParams;
|
|
40
|
-
stopPush(): void
|
|
43
|
+
stopPush(): Promise<void>;
|
|
41
44
|
private resetPeerConnection;
|
|
45
|
+
private onConnected;
|
|
42
46
|
private configDataChannel;
|
|
43
47
|
private handleDataChannelMessage;
|
|
44
48
|
private checkStats;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { transformCoordinate, valueToPercentage } from "./core/util/ScreenContro
|
|
|
5
5
|
import { ActionType, ChannelDataType, ContainerDirection, InputData, KeyEventData, TouchData, WheelData, GestureData, type ActionCommand, ActionCommandType, ActionCommandEventType, ActionCommandEventValue, TrackEventData, ClarityData } from "./core/data/WebrtcDataType";
|
|
6
6
|
import { type TurnServerConfig, type TurnTestResult, type TurnTestSummary } from "./core/data/TurnType";
|
|
7
7
|
import type { WebRTCConfigOptions } from './core/rtc/WebRTCConfig';
|
|
8
|
-
import { EmitType, type CameraError, type WebRtcError } from "./core/data/WebRtcError";
|
|
8
|
+
import { EmitType, FailCode, type CameraError, type WebRtcError } from "./core/data/WebRtcError";
|
|
9
9
|
import RemotePlayer from './components/RemotePlayer/index.vue';
|
|
10
10
|
import { ConnectorType } from './core/data/MessageType';
|
|
11
11
|
import { GroupCtrlSocketManager } from './core/groupctrl/GroupCtrlSocketManager';
|
|
12
|
-
export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, ClarityData, type ActionCommand, ActionCommandType, type WebRTCConfigOptions, ActionCommandEventType, ActionCommandEventValue, RemotePlayer, TrackEventData, type TurnServerConfig, type TurnTestResult, type TurnTestSummary, testMultipleTurnServers, type CameraError, type WebRtcError, ConnectorType, GroupCtrlSocketManager };
|
|
12
|
+
export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, ClarityData, type ActionCommand, ActionCommandType, type WebRTCConfigOptions, ActionCommandEventType, ActionCommandEventValue, RemotePlayer, TrackEventData, type TurnServerConfig, type TurnTestResult, type TurnTestSummary, testMultipleTurnServers, type CameraError, type WebRtcError, ConnectorType, GroupCtrlSocketManager, FailCode };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InputData, KeyEventData } from "../core/data/WebrtcDataType";
|
|
2
|
+
import Logger from "./Logger";
|
|
3
|
+
interface KeyboardControlOptions {
|
|
4
|
+
rootContainer: HTMLElement;
|
|
5
|
+
inputDataUpdateCallback: (data: KeyEventData) => void;
|
|
6
|
+
chineseDataUpdateCallback: (data: InputData) => void;
|
|
7
|
+
videoAngle: number;
|
|
8
|
+
enabledIMEKeyboard?: boolean;
|
|
9
|
+
enabledDebug?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare class KeyboardControl {
|
|
13
|
+
#private;
|
|
14
|
+
logger: Logger;
|
|
15
|
+
rootContainer: HTMLElement;
|
|
16
|
+
keyboardContainerElement: HTMLElement | null;
|
|
17
|
+
inputMethodEditorElement: HTMLTextAreaElement | null;
|
|
18
|
+
inputDataUpdateCallback: KeyboardControlOptions['inputDataUpdateCallback'];
|
|
19
|
+
chineseDataUpdateCallback: KeyboardControlOptions['chineseDataUpdateCallback'];
|
|
20
|
+
videoAngle: KeyboardControlOptions['videoAngle'];
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
enabledIMEKeyboard?: boolean;
|
|
23
|
+
constructor({ rootContainer, inputDataUpdateCallback, chineseDataUpdateCallback, enabledDebug, disabled, enabledIMEKeyboard, videoAngle }: KeyboardControlOptions);
|
|
24
|
+
createKeyboardContainerElement(): HTMLDivElement;
|
|
25
|
+
createInputMethodEditor(): HTMLTextAreaElement;
|
|
26
|
+
mountNode(): void;
|
|
27
|
+
init(): void;
|
|
28
|
+
clearInput: () => void;
|
|
29
|
+
focusIME: () => void;
|
|
30
|
+
blurIME: () => void;
|
|
31
|
+
setKeyboardContainerSize(width: number, height: number): void;
|
|
32
|
+
setKeyboardContainerElementStyle(style: {
|
|
33
|
+
rotate: number;
|
|
34
|
+
}): void;
|
|
35
|
+
setVideoAngle(value: number): void;
|
|
36
|
+
openIMEKeyboard(): void;
|
|
37
|
+
closeIMEKeyboard(): void;
|
|
38
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
39
|
+
handleKeyboardContainerPointerenter: () => void;
|
|
40
|
+
handleKeyboardContainerPointerleave: () => void;
|
|
41
|
+
handleIMECompositionStart: (_e: CompositionEvent) => void;
|
|
42
|
+
handleIMECompositionEnd: (e: CompositionEvent) => void;
|
|
43
|
+
handleIMEInput: (e: Event) => void;
|
|
44
|
+
handleIMEKeyDown: (event: KeyboardEvent) => void;
|
|
45
|
+
addKeyboardContainerEvent(): void;
|
|
46
|
+
offKeyboardContainerEvent(): void;
|
|
47
|
+
addInputMethodEditorEvent(): void;
|
|
48
|
+
offInputMethodEditorEvent(): void;
|
|
49
|
+
addEvent(): void;
|
|
50
|
+
offEvent(): void;
|
|
51
|
+
destroy(): void;
|
|
52
|
+
}
|
|
53
|
+
export default KeyboardControl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare class Logger {
|
|
2
|
+
prefix: string;
|
|
3
|
+
enabledDebug: boolean;
|
|
4
|
+
constructor({ prefix, enabledDebug }: {
|
|
5
|
+
prefix: string;
|
|
6
|
+
enabledDebug?: boolean;
|
|
7
|
+
});
|
|
8
|
+
output(type: 'log' | 'warn' | 'error' | 'debug', ...args: any[]): void;
|
|
9
|
+
log(...args: any[]): void;
|
|
10
|
+
warn(...args: any[]): void;
|
|
11
|
+
error(...args: any[]): void;
|
|
12
|
+
}
|
|
13
|
+
export default Logger;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ActionType, TouchData, WheelData } from "../core/data/WebrtcDataType";
|
|
2
|
+
import Logger from "./Logger";
|
|
3
|
+
import type { Dimension, TouchEventData } from "./type";
|
|
4
|
+
interface MouseTouchControlOptions {
|
|
5
|
+
remoteElement: HTMLElement | null;
|
|
6
|
+
cloudDeviceSize: Dimension;
|
|
7
|
+
streamAngle: number;
|
|
8
|
+
videoAngle: number;
|
|
9
|
+
widthRatio: number;
|
|
10
|
+
isGroup: boolean;
|
|
11
|
+
isMove: boolean;
|
|
12
|
+
touchDataUpdateCallback: (data: TouchData) => void;
|
|
13
|
+
wheelDataUpdateCallback: (data: WheelData) => void;
|
|
14
|
+
enabledDebug?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface PointerState {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
downTime: number;
|
|
20
|
+
isDown: boolean;
|
|
21
|
+
bound: number;
|
|
22
|
+
index: number;
|
|
23
|
+
groupIndex: number;
|
|
24
|
+
}
|
|
25
|
+
declare class MouseTouchControl {
|
|
26
|
+
logger: Logger;
|
|
27
|
+
remoteElement: MouseTouchControlOptions['remoteElement'];
|
|
28
|
+
cloudDeviceSize: MouseTouchControlOptions['cloudDeviceSize'];
|
|
29
|
+
streamAngle: number;
|
|
30
|
+
videoAngle: number;
|
|
31
|
+
widthRatio: number;
|
|
32
|
+
isGroup: boolean;
|
|
33
|
+
pointers: Map<number, PointerState>;
|
|
34
|
+
groupIndexCounter: number;
|
|
35
|
+
isMove: boolean;
|
|
36
|
+
touchDataUpdateCallback: MouseTouchControlOptions['touchDataUpdateCallback'];
|
|
37
|
+
wheelDataUpdateCallback: MouseTouchControlOptions['wheelDataUpdateCallback'];
|
|
38
|
+
constructor({ remoteElement, isGroup, widthRatio, videoAngle, streamAngle, cloudDeviceSize, touchDataUpdateCallback, wheelDataUpdateCallback, enabledDebug, isMove }: MouseTouchControlOptions);
|
|
39
|
+
setVideoAngle(angle: number): void;
|
|
40
|
+
setStreamAngle(angle: number): void;
|
|
41
|
+
setWidthRatio(value: number): void;
|
|
42
|
+
setCloudDeviceSize(value: MouseTouchControlOptions['cloudDeviceSize']): void;
|
|
43
|
+
validateParams(): void;
|
|
44
|
+
handleWheel: (e: WheelEvent) => void;
|
|
45
|
+
handlePointerEvent: (event: PointerEvent | TouchEventData, action: ActionType, pointerId: number) => void;
|
|
46
|
+
handleMouseDown: (event: PointerEvent) => any;
|
|
47
|
+
handleMouseMove: (event: PointerEvent) => void;
|
|
48
|
+
handleMouseUp: (event: PointerEvent) => void;
|
|
49
|
+
handleMouseEnter: (event: PointerEvent) => void;
|
|
50
|
+
handleMouseLeave: (event: PointerEvent) => void;
|
|
51
|
+
addEvent(): void;
|
|
52
|
+
offEvent(): void;
|
|
53
|
+
init(): void;
|
|
54
|
+
destroy(): void;
|
|
55
|
+
}
|
|
56
|
+
export default MouseTouchControl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RemoteControllerBase from "./RemoteControllerBase";
|
|
2
|
+
declare class RemoteCanvasController implements RemoteControllerBase {
|
|
3
|
+
remoteElement: HTMLElement | null;
|
|
4
|
+
audioElement?: HTMLAudioElement | null | undefined;
|
|
5
|
+
constructor({ remoteElement }: {
|
|
6
|
+
remoteElement: HTMLElement;
|
|
7
|
+
});
|
|
8
|
+
startDecode(arrayBuffer: ArrayBuffer): void;
|
|
9
|
+
startPlay(track: MediaStreamTrack): void;
|
|
10
|
+
stopPlay(): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
13
|
+
export default RemoteCanvasController;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CursorType } from "./constants";
|
|
2
|
+
import RemoteControllerBase from "./RemoteControllerBase";
|
|
3
|
+
interface RemoteControllerParams {
|
|
4
|
+
rootContainer: HTMLElement;
|
|
5
|
+
cursorType?: CursorType;
|
|
6
|
+
remoteViewBackgroundColor?: string;
|
|
7
|
+
loadedSuccess?: () => void;
|
|
8
|
+
loadedFailure?: (reason: string) => void;
|
|
9
|
+
enabledDebug?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare class RemoteController implements RemoteControllerBase {
|
|
12
|
+
remoteController: RemoteControllerBase;
|
|
13
|
+
constructor({ rootContainer, loadedSuccess, loadedFailure, enabledDebug, enabledDecode, cursorType, remoteViewBackgroundColor, }: RemoteControllerParams & {
|
|
14
|
+
enabledDecode: boolean;
|
|
15
|
+
});
|
|
16
|
+
get audioElement(): HTMLAudioElement;
|
|
17
|
+
get remoteElement(): HTMLElement;
|
|
18
|
+
startPlay(track: MediaStreamTrack): void;
|
|
19
|
+
startDecode(arrayBuffer: ArrayBuffer): void;
|
|
20
|
+
stopPlay(): void;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
export default RemoteController;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CursorType } from "./constants";
|
|
2
|
+
import Logger from "./Logger";
|
|
3
|
+
import RemoteControllerBase from "./RemoteControllerBase";
|
|
4
|
+
interface RemoteVideoControllerParams {
|
|
5
|
+
rootContainer: HTMLElement;
|
|
6
|
+
cursorType?: CursorType;
|
|
7
|
+
remoteViewBackgroundColor?: string;
|
|
8
|
+
loadedSuccess?: () => void;
|
|
9
|
+
loadedFailure?: (reason: string) => void;
|
|
10
|
+
enabledDebug?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare class RemoteVideoController implements RemoteControllerBase {
|
|
13
|
+
#private;
|
|
14
|
+
rootContainer: RemoteVideoControllerParams['rootContainer'];
|
|
15
|
+
remoteElement: HTMLVideoElement | null;
|
|
16
|
+
cursorType: CursorType;
|
|
17
|
+
remoteViewBackgroundColor: string;
|
|
18
|
+
logger: Logger;
|
|
19
|
+
loadedSuccess?: () => void;
|
|
20
|
+
loadedFailure?: (reason: string) => void;
|
|
21
|
+
constructor({ rootContainer, loadedSuccess, loadedFailure, enabledDebug, cursorType, remoteViewBackgroundColor, }: RemoteVideoControllerParams);
|
|
22
|
+
validateParams(): void;
|
|
23
|
+
createVideoElement(): HTMLVideoElement;
|
|
24
|
+
mountNode(): void;
|
|
25
|
+
init(): Promise<void>;
|
|
26
|
+
documentClickListener: () => void;
|
|
27
|
+
addDocumentClick(): void;
|
|
28
|
+
offDocumentClick(): void;
|
|
29
|
+
handleMetaDataListener: () => void;
|
|
30
|
+
addEvent(): void;
|
|
31
|
+
offEvent(): void;
|
|
32
|
+
startPlay(track: MediaStreamTrack): void;
|
|
33
|
+
replaceVideoTrack(video: HTMLVideoElement, newTrack: MediaStreamTrack): void;
|
|
34
|
+
updateTrack(stream: MediaStream, newTrack: MediaStreamTrack): void;
|
|
35
|
+
stopPlay(): void;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
export default RemoteVideoController;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import EventEmitter from "eventemitter3";
|
|
2
|
+
import type { WebRTCConfigOptions } from "../core/rtc/WebRTCConfig";
|
|
3
|
+
import { WebRTCSdk } from "../core/WebRTCSdk";
|
|
4
|
+
import { ChannelDataType } from "../core/data/WebrtcDataType";
|
|
5
|
+
import Logger from "./Logger";
|
|
6
|
+
declare class WebRTCWrapper extends EventEmitter {
|
|
7
|
+
#private;
|
|
8
|
+
static EVENTS: {
|
|
9
|
+
CONNECTED: string;
|
|
10
|
+
DIRECTION_CHANGE: string;
|
|
11
|
+
RESIZE: string;
|
|
12
|
+
CLARITY_LEVEL_CHANGE: string;
|
|
13
|
+
GESTURE_MODE_CHANGE: string;
|
|
14
|
+
RECEIVE_MEDIA_STREAM_TRACK: string;
|
|
15
|
+
RECEIVE_ARRAY_BUFFER: string;
|
|
16
|
+
ERROR: string;
|
|
17
|
+
STOP_CONNECT: string;
|
|
18
|
+
STATISTIC_INFO: string;
|
|
19
|
+
CLICK_DATA: ChannelDataType;
|
|
20
|
+
};
|
|
21
|
+
logger: Logger;
|
|
22
|
+
webRtcSDKInstance: WebRTCSdk | null;
|
|
23
|
+
constructor({ connectConfig, enabledDebug }: {
|
|
24
|
+
connectConfig: WebRTCConfigOptions;
|
|
25
|
+
enabledDebug?: boolean;
|
|
26
|
+
});
|
|
27
|
+
addEvent(): void;
|
|
28
|
+
offEvents(): void;
|
|
29
|
+
startConnection(): void;
|
|
30
|
+
sendChannelData(type: ChannelDataType, data: any): void;
|
|
31
|
+
sendClickData(data: any): void;
|
|
32
|
+
sendActionWheel(data: any): void;
|
|
33
|
+
sendActionInput(data: any): void;
|
|
34
|
+
sendActionChinese(data: any): void;
|
|
35
|
+
goBack(): void;
|
|
36
|
+
goHome(): void;
|
|
37
|
+
goTask(): void;
|
|
38
|
+
enableAudio(): void;
|
|
39
|
+
disableAudio(): void;
|
|
40
|
+
/**
|
|
41
|
+
* @param level
|
|
42
|
+
* 高清: 3
|
|
43
|
+
* 标清: 2
|
|
44
|
+
* 流畅: 1
|
|
45
|
+
*/
|
|
46
|
+
changeLevel(level: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* @param value
|
|
49
|
+
* 发送剪贴板的内容
|
|
50
|
+
*/
|
|
51
|
+
sendClipboardData(value: string): void;
|
|
52
|
+
setNavigationMode(mode: number): void;
|
|
53
|
+
switchToGestureNavigation(): void;
|
|
54
|
+
switchToThreeButtonNavigation(): void;
|
|
55
|
+
destroy(): void;
|
|
56
|
+
}
|
|
57
|
+
export default WebRTCWrapper;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare enum DocumentEvent {
|
|
2
|
+
KEY_DOWN = "keydown",
|
|
3
|
+
POINTER_ENTER = "pointerenter",
|
|
4
|
+
POINTER_LEAVE = "pointerleave",
|
|
5
|
+
POINTER_DOWN = "pointerdown",
|
|
6
|
+
POINTER_UP = "pointerup",
|
|
7
|
+
POINTER_MOVE = "pointermove",
|
|
8
|
+
WHEEL = "wheel",
|
|
9
|
+
COMPOSITION_START = "compositionstart",
|
|
10
|
+
COMPOSITION_END = "compositionend",
|
|
11
|
+
INPUT = "input"
|
|
12
|
+
}
|
|
13
|
+
export declare enum MenuKey {
|
|
14
|
+
HOME = 3,
|
|
15
|
+
BACK = 4,
|
|
16
|
+
TASK = 187
|
|
17
|
+
}
|
|
18
|
+
export declare enum ClarityLevel {
|
|
19
|
+
FLUENT = 1,// 流畅
|
|
20
|
+
STANDARD = 2,// 标清
|
|
21
|
+
HIGH_DEFINITION = 3
|
|
22
|
+
}
|
|
23
|
+
export declare const CLARITY_LEVEL_LIST: {
|
|
24
|
+
label: string;
|
|
25
|
+
value: ClarityLevel;
|
|
26
|
+
}[];
|
|
27
|
+
export declare enum GestureMode {
|
|
28
|
+
THREE_BUTTON_NAVIGATION = 0,
|
|
29
|
+
GESTURE_NAVIGATION = 2
|
|
30
|
+
}
|
|
31
|
+
export declare const CLASS_NAME: {
|
|
32
|
+
CONTAINER_CLASS_NAME: string;
|
|
33
|
+
KEYBOARD_CONTAINER_CLASS_NAME: string;
|
|
34
|
+
REMOTE_VIDEO_CLASS_NAME: string;
|
|
35
|
+
INPUT_METHOD_EDITOR_CLASS_NAME: string;
|
|
36
|
+
};
|
|
37
|
+
export declare enum CursorType {
|
|
38
|
+
DEFAULT_CURSOR = 0,
|
|
39
|
+
CIRCLE_CURSOR = 1,
|
|
40
|
+
TRIANGLE_CURSOR = 2
|
|
41
|
+
}
|
|
42
|
+
export declare const cursorClassMap: Record<CursorType, string>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { type WebRTCConfigOptions } from '../core/rtc/WebRTCConfig';
|
|
3
|
+
import RemoteController from './RemoteController';
|
|
4
|
+
import MouseTouchControl from './MouseTouchControl';
|
|
5
|
+
import KeyboardControl from './KeyboardControl';
|
|
6
|
+
import WebRTCWrapper from './WebRTCWrapper';
|
|
7
|
+
import Logger from './Logger';
|
|
8
|
+
import { ClarityLevel, CursorType } from './constants';
|
|
9
|
+
import { Dimension, MakeOptional } from './type';
|
|
10
|
+
interface SDKParams {
|
|
11
|
+
mountedElement: string | HTMLElement;
|
|
12
|
+
connectConfig: MakeOptional<WebRTCConfigOptions, 'isGroup'>;
|
|
13
|
+
cloudDeviceSize?: Dimension;
|
|
14
|
+
cursorType?: number;
|
|
15
|
+
remoteViewBackgroundColor?: string;
|
|
16
|
+
videoAngle?: number;
|
|
17
|
+
isGroup?: boolean;
|
|
18
|
+
disabledVerticalSwipe?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
enabledDebug?: boolean;
|
|
21
|
+
enabledIMEKeyboard?: boolean;
|
|
22
|
+
enabledDecode?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare enum SDKEvents {
|
|
25
|
+
CHANNEL_EVENT = "channelEvent",
|
|
26
|
+
GROUP_CONTROL_EVENT = "groupControlEvent",
|
|
27
|
+
LOADED_SUCCESS = "loadedSuccess",
|
|
28
|
+
LOADED_FAILURE = "loadedFailure"
|
|
29
|
+
}
|
|
30
|
+
declare class UniSDK extends EventEmitter {
|
|
31
|
+
static EVENTS: {
|
|
32
|
+
CONNECTED: string;
|
|
33
|
+
DIRECTION_CHANGE: string;
|
|
34
|
+
RESIZE: string;
|
|
35
|
+
CLARITY_LEVEL_CHANGE: string;
|
|
36
|
+
GESTURE_MODE_CHANGE: string;
|
|
37
|
+
RECEIVE_MEDIA_STREAM_TRACK: string;
|
|
38
|
+
RECEIVE_ARRAY_BUFFER: string;
|
|
39
|
+
ERROR: string;
|
|
40
|
+
STOP_CONNECT: string;
|
|
41
|
+
STATISTIC_INFO: string;
|
|
42
|
+
CLICK_DATA: import("../index").ChannelDataType;
|
|
43
|
+
CHANNEL_EVENT: SDKEvents.CHANNEL_EVENT;
|
|
44
|
+
GROUP_CONTROL_EVENT: SDKEvents.GROUP_CONTROL_EVENT;
|
|
45
|
+
LOADED_SUCCESS: SDKEvents.LOADED_SUCCESS;
|
|
46
|
+
LOADED_FAILURE: SDKEvents.LOADED_FAILURE;
|
|
47
|
+
};
|
|
48
|
+
static CURSOR_TYPE: typeof CursorType;
|
|
49
|
+
static CLARITY_LEVEL: typeof ClarityLevel;
|
|
50
|
+
static CLARITY_LEVEL_LIST: {
|
|
51
|
+
label: string;
|
|
52
|
+
value: ClarityLevel;
|
|
53
|
+
}[];
|
|
54
|
+
logger: Logger;
|
|
55
|
+
mountedElement: SDKParams['mountedElement'];
|
|
56
|
+
connectConfig: SDKParams['connectConfig'];
|
|
57
|
+
cloudDeviceSize: SDKParams['cloudDeviceSize'];
|
|
58
|
+
videoContainerElement: HTMLDivElement | null;
|
|
59
|
+
containerResizeObserver: ResizeObserver | null;
|
|
60
|
+
remoteViewBackgroundColor: string;
|
|
61
|
+
remoteController: RemoteController | null;
|
|
62
|
+
webRtcSDKInstance: WebRTCWrapper | null;
|
|
63
|
+
mouseTouchControl: MouseTouchControl | null;
|
|
64
|
+
keyboardControl: KeyboardControl | null;
|
|
65
|
+
isGroup: boolean;
|
|
66
|
+
videoAngle: number;
|
|
67
|
+
streamAngle: number;
|
|
68
|
+
widthRatio: number;
|
|
69
|
+
heightRatio: number;
|
|
70
|
+
cursorType: CursorType;
|
|
71
|
+
disabled: boolean;
|
|
72
|
+
enabledDebug: boolean;
|
|
73
|
+
disabledVerticalSwipe: boolean;
|
|
74
|
+
enabledIMEKeyboard: boolean;
|
|
75
|
+
enabledDecode: boolean;
|
|
76
|
+
constructor({ mountedElement, connectConfig, cloudDeviceSize, disabled, enabledDebug, isGroup, disabledVerticalSwipe, enabledIMEKeyboard, remoteViewBackgroundColor, videoAngle, cursorType, enabledDecode }: SDKParams);
|
|
77
|
+
setVideoAngle(angle: number): void;
|
|
78
|
+
getVideoAngle(): number;
|
|
79
|
+
setStreamAngle(angle: number): void;
|
|
80
|
+
setCloudDeviceSize(value: Dimension): void;
|
|
81
|
+
validateParams(): boolean;
|
|
82
|
+
init(): void;
|
|
83
|
+
createVideoContainerElement(): HTMLDivElement;
|
|
84
|
+
setKeyboardContainerSize(width: number, height: number): void;
|
|
85
|
+
createNode(): void;
|
|
86
|
+
calculateSize(w: number, h: number): void;
|
|
87
|
+
addContainerResizeListener(): void;
|
|
88
|
+
offContainerResizeListener(): void;
|
|
89
|
+
addEvent(): void;
|
|
90
|
+
offEvents(): void;
|
|
91
|
+
createRemoteController(): RemoteController;
|
|
92
|
+
createMouseTouchControl(remoteElement: HTMLElement): MouseTouchControl;
|
|
93
|
+
createKeyboardControl(): KeyboardControl;
|
|
94
|
+
mounted(): Promise<void>;
|
|
95
|
+
startConnection(): void;
|
|
96
|
+
goBack(): void;
|
|
97
|
+
goHome(): void;
|
|
98
|
+
goTask(): void;
|
|
99
|
+
enableAudio(): void;
|
|
100
|
+
disableAudio(): void;
|
|
101
|
+
changeLevel(value: number): void;
|
|
102
|
+
sendClipboardData(value: string): void;
|
|
103
|
+
openIMEKeyboard(): void;
|
|
104
|
+
closeIMEKeyboard(): void;
|
|
105
|
+
switchToGestureNavigation(): void;
|
|
106
|
+
switchToThreeButtonNavigation(): void;
|
|
107
|
+
destroy(): void;
|
|
108
|
+
}
|
|
109
|
+
export * from './type';
|
|
110
|
+
export { UniSDK };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Dimension {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface TouchEventData {
|
|
6
|
+
clientX: number;
|
|
7
|
+
clientY: number;
|
|
8
|
+
timeStamp: DOMHighResTimeStamp;
|
|
9
|
+
}
|
|
10
|
+
export type MakeOptional<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|