yjz-web-sdk 1.0.10 → 1.0.11-beta.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.
- package/README.md +90 -0
- package/lib/ScreenControlUtil-D4-BTCo9.js +5230 -0
- package/lib/components/RemotePlayer/index.vue.d.ts +1 -73
- package/lib/composables/useCursorStyle.d.ts +1 -1
- package/lib/composables/useKeyboardControl.d.ts +5 -1
- package/lib/composables/useMouseTouchControl.d.ts +5 -4
- package/lib/composables/useRemoteVideo.d.ts +8 -25
- package/lib/composables/useResizeObserver.d.ts +1 -1
- package/lib/core/WebRTCSdk.d.ts +3 -0
- package/lib/core/data/WebRtcError.d.ts +3 -3
- package/lib/core/data/WebrtcDataType.d.ts +1 -11
- package/lib/core/groupctrl/SdkController.d.ts +2 -2
- package/lib/core/rtc/WebRTCClient.d.ts +13 -3
- package/lib/core/rtc/WebRTCConfig.d.ts +3 -1
- package/lib/core/rtc/WebRtcNegotiate.d.ts +3 -3
- package/lib/core/signal/SignalingClient.d.ts +1 -1
- package/lib/core/util/KeyCodeUtil.d.ts +6 -0
- package/lib/core/util/TurnTestUtil.d.ts +4 -4
- package/lib/index.d.ts +3 -3
- 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 +11 -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/{components/RemotePlayer → uni}/type.d.ts +1 -0
- package/lib/uni-sdk.js +1263 -0
- package/lib/yjz-web-sdk.js +312 -5955
- package/package.json +10 -20
- package/lib/core/data/TurnType.d.ts +0 -21
- package/lib/core/util/MapCache.d.ts +0 -20
- package/lib/render/Canvas2DRenderer.d.ts +0 -10
- package/lib/render/WebGLRenderer.d.ts +0 -16
- package/lib/render/WebGPURenderer.d.ts +0 -18
- package/lib/types/index.d.ts +0 -13
- package/lib/util/WasmUtil.d.ts +0 -17
- package/lib/worker/worker.d.ts +0 -1
- package/src/assets/icon/circle.svg +0 -1
- package/src/assets/icon/triangle.svg +0 -1
- package/src/assets/wasm/h264-atomic.wasm +0 -0
- package/src/assets/wasm/h264-simd.wasm +0 -0
- package/src/components/RemotePlayer/index.vue +0 -170
- package/src/components/RemotePlayer/type.ts +0 -11
- package/src/composables/useCursorStyle.ts +0 -15
- package/src/composables/useKeyboardControl.ts +0 -32
- package/src/composables/useMouseTouchControl.ts +0 -158
- package/src/composables/useRemoteVideo.ts +0 -248
- package/src/composables/useResizeObserver.ts +0 -27
- package/src/core/WebRTCSdk.ts +0 -561
- package/src/core/data/MessageType.ts +0 -70
- package/src/core/data/TurnType.ts +0 -25
- package/src/core/data/WebRtcError.ts +0 -93
- package/src/core/data/WebrtcDataType.ts +0 -354
- package/src/core/groupctrl/GroupCtrlSocketManager.ts +0 -94
- package/src/core/groupctrl/SdkController.ts +0 -96
- package/src/core/rtc/WebRTCClient.ts +0 -862
- package/src/core/rtc/WebRTCConfig.ts +0 -86
- package/src/core/rtc/WebRtcNegotiate.ts +0 -164
- package/src/core/signal/SignalingClient.ts +0 -221
- package/src/core/util/FileTypeUtils.ts +0 -75
- package/src/core/util/KeyCodeUtil.ts +0 -162
- package/src/core/util/Logger.ts +0 -83
- package/src/core/util/MapCache.ts +0 -135
- package/src/core/util/ScreenControlUtil.ts +0 -174
- package/src/core/util/TurnTestUtil.ts +0 -123
- package/src/env.d.ts +0 -30
- package/src/index.ts +0 -61
- package/src/render/Canvas2DRenderer.ts +0 -38
- package/src/render/WebGLRenderer.ts +0 -150
- package/src/render/WebGPURenderer.ts +0 -194
- package/src/types/index.ts +0 -15
- package/src/types/webgpu.d.ts +0 -1158
- package/src/util/WasmUtil.ts +0 -291
- package/src/worker/worker.ts +0 -292
|
@@ -1,74 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
interface Props {
|
|
3
|
-
streamAngle?: number;
|
|
4
|
-
videoAngle?: number;
|
|
5
|
-
cursorType?: number;
|
|
6
|
-
cloudDeviceSize?: Dimension;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
bgColor?: string;
|
|
9
|
-
isGroup?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
12
|
-
streamAngle: number;
|
|
13
|
-
videoAngle: number;
|
|
14
|
-
cursorType: number;
|
|
15
|
-
cloudDeviceSize: () => {
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
};
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
bgColor: string;
|
|
21
|
-
isGroup: boolean;
|
|
22
|
-
}>>, {
|
|
23
|
-
startDecode: (arrayBuffer: ArrayBuffer) => void;
|
|
24
|
-
stopPlay: () => void;
|
|
25
|
-
remoteVideoElement: import("vue").Ref<HTMLCanvasElement, HTMLCanvasElement>;
|
|
26
|
-
startPlay: (track: MediaStreamTrack) => void;
|
|
27
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
loadedSuccess: (...args: any[]) => void;
|
|
29
|
-
loadedFailure: (...args: any[]) => void;
|
|
30
|
-
channelEvent: (...args: any[]) => void;
|
|
31
|
-
groupControlEvent: (...args: any[]) => void;
|
|
32
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
33
|
-
streamAngle: number;
|
|
34
|
-
videoAngle: number;
|
|
35
|
-
cursorType: number;
|
|
36
|
-
cloudDeviceSize: () => {
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
};
|
|
40
|
-
disabled: boolean;
|
|
41
|
-
bgColor: string;
|
|
42
|
-
isGroup: boolean;
|
|
43
|
-
}>>> & Readonly<{
|
|
44
|
-
onLoadedSuccess?: (...args: any[]) => any;
|
|
45
|
-
onLoadedFailure?: (...args: any[]) => any;
|
|
46
|
-
onChannelEvent?: (...args: any[]) => any;
|
|
47
|
-
onGroupControlEvent?: (...args: any[]) => any;
|
|
48
|
-
}>, {
|
|
49
|
-
cloudDeviceSize: Dimension;
|
|
50
|
-
streamAngle: number;
|
|
51
|
-
videoAngle: number;
|
|
52
|
-
isGroup: boolean;
|
|
53
|
-
cursorType: number;
|
|
54
|
-
disabled: boolean;
|
|
55
|
-
bgColor: string;
|
|
56
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
declare const _default: any;
|
|
57
2
|
export default _default;
|
|
58
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
59
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
60
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
61
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
62
|
-
} : {
|
|
63
|
-
type: import('vue').PropType<T[K]>;
|
|
64
|
-
required: true;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
type __VLS_WithDefaults<P, D> = {
|
|
68
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
69
|
-
default: D[K];
|
|
70
|
-
}> : P[K];
|
|
71
|
-
};
|
|
72
|
-
type __VLS_Prettify<T> = {
|
|
73
|
-
[K in keyof T]: T[K];
|
|
74
|
-
} & {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
|
-
export default function useCursorStyle(cursorType: Ref<number>):
|
|
2
|
+
export default function useCursorStyle(cursorType: Ref<number>): any;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ChannelDataType } from "../core/data/WebrtcDataType";
|
|
2
2
|
import { type Ref } from "vue";
|
|
3
|
-
export default function useKeyboardControl(disabled: Ref<boolean>, emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void): {
|
|
3
|
+
export default function useKeyboardControl(imeInput: Ref<HTMLTextAreaElement | null>, disabled: Ref<boolean>, emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void): {
|
|
4
4
|
startListening: () => void;
|
|
5
5
|
stopListening: () => void;
|
|
6
|
+
onCompositionStart: (_e: CompositionEvent) => void;
|
|
7
|
+
onCompositionEnd: (e: CompositionEvent) => void;
|
|
8
|
+
onInput: (e: InputEvent) => void;
|
|
9
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
6
10
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import { ChannelDataType } from "../core/data/WebrtcDataType";
|
|
3
|
-
import type { Dimension } from "../components/RemotePlayer/
|
|
3
|
+
import type { Dimension } from "../components/RemotePlayer/index.ts";
|
|
4
4
|
interface MouseTouchControlOptions {
|
|
5
|
-
remoteVideoElement: Ref<
|
|
5
|
+
remoteVideoElement: Ref<HTMLVideoElement | null>;
|
|
6
6
|
cloudDeviceSize: Ref<Dimension>;
|
|
7
7
|
streamAngle: Ref<number>;
|
|
8
8
|
videoAngle: Ref<number>;
|
|
9
9
|
widthRadio: Ref<number>;
|
|
10
10
|
isGroup: Ref<boolean>;
|
|
11
|
+
isMove: Ref<boolean>;
|
|
11
12
|
emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void;
|
|
12
13
|
}
|
|
13
14
|
export default function useMouseTouchControl(options: MouseTouchControlOptions): {
|
|
14
|
-
|
|
15
|
+
pointers: any;
|
|
15
16
|
handleMouseDown: (event: PointerEvent) => void;
|
|
16
17
|
handleMouseMove: (event: PointerEvent) => void;
|
|
17
|
-
handleMouseEnter: (event: PointerEvent) => void;
|
|
18
18
|
handleMouseUp: (event: PointerEvent) => void;
|
|
19
|
+
handleMouseEnter: (event: PointerEvent) => void;
|
|
19
20
|
handleMouseLeave: (event: PointerEvent) => void;
|
|
20
21
|
handleWheel: (e: WheelEvent) => void;
|
|
21
22
|
};
|
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
}, Partial<Dimension> | {
|
|
12
|
-
width?: number;
|
|
13
|
-
height?: number;
|
|
14
|
-
}>;
|
|
15
|
-
dimensions: Ref<{
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
}, Dimension | {
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
}>;
|
|
22
|
-
widthRadio: Ref<number, number>;
|
|
23
|
-
heightRadio: Ref<number, number>;
|
|
24
|
-
screenStatus: Ref<boolean, boolean>;
|
|
2
|
+
export default function useRemoteVideo(videoContainer: Ref<HTMLElement | null>, remoteVideoElement: Ref<HTMLVideoElement | null>, videoAngle: Ref<number>, emit: (event: 'loadedSuccess') => void): {
|
|
3
|
+
videoSize: any;
|
|
4
|
+
remoteVideo: any;
|
|
5
|
+
dimensions: any;
|
|
6
|
+
widthRadio: any;
|
|
7
|
+
heightRadio: any;
|
|
8
|
+
screenStatus: any;
|
|
25
9
|
initVideoContainer: () => void;
|
|
26
|
-
startDecode: (arrayBuffer: ArrayBuffer) => void;
|
|
27
|
-
stopPlay: () => void;
|
|
28
10
|
startPlay: (track: MediaStreamTrack) => void;
|
|
11
|
+
stopPlay: () => void;
|
|
29
12
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
|
-
import type { Dimension } from "../components/RemotePlayer/
|
|
2
|
+
import type { Dimension } from "../components/RemotePlayer/index.ts";
|
|
3
3
|
export default function useResizeObserver(target: Ref<HTMLElement | null>, dimension: Ref<Dimension>): void;
|
package/lib/core/WebRTCSdk.d.ts
CHANGED
|
@@ -15,11 +15,13 @@ export declare class WebRTCSdk extends EventEmitter {
|
|
|
15
15
|
private connectCount;
|
|
16
16
|
private MAX_COUNT;
|
|
17
17
|
private timeout;
|
|
18
|
+
private reconnectTimer;
|
|
18
19
|
constructor(options: WebRTCConfigOptions);
|
|
19
20
|
initConfig(): Promise<void>;
|
|
20
21
|
/** 开始连接 signal 服务 */
|
|
21
22
|
startConnection(): void;
|
|
22
23
|
private prepareConnection;
|
|
24
|
+
private scheduleReconnect;
|
|
23
25
|
reconnect(): Promise<void>;
|
|
24
26
|
initConnectConfig(initConfig?: boolean): void;
|
|
25
27
|
initSignalingClient(): void;
|
|
@@ -53,4 +55,5 @@ export declare class WebRTCSdk extends EventEmitter {
|
|
|
53
55
|
sendPong(): void;
|
|
54
56
|
sendSignOut(): void;
|
|
55
57
|
groupSendAction(type: ChannelDataType, data: any): void;
|
|
58
|
+
private clearReconnectTimer;
|
|
56
59
|
}
|
|
@@ -16,7 +16,8 @@ export declare enum FailCode {
|
|
|
16
16
|
AUTH_FAILED = 10015,
|
|
17
17
|
KICK_OUT_ERR = 10016,
|
|
18
18
|
STATE_ERR = 10017,
|
|
19
|
-
OPTION_ERR = 10018
|
|
19
|
+
OPTION_ERR = 10018,
|
|
20
|
+
NO_OPTION_LONGTIME = 10019
|
|
20
21
|
}
|
|
21
22
|
export declare const FailInfoMap: Record<FailCode, {
|
|
22
23
|
type: string;
|
|
@@ -52,6 +53,5 @@ export declare enum EmitType {
|
|
|
52
53
|
cloudClipData = "cloudClipData",
|
|
53
54
|
screenshot = "screenshot",
|
|
54
55
|
reconnect = "reconnect",
|
|
55
|
-
groupError = "groupError"
|
|
56
|
-
arrayBuffer = "arrayBuffer"
|
|
56
|
+
groupError = "groupError"
|
|
57
57
|
}
|
|
@@ -11,8 +11,7 @@ export declare enum ChannelDataType {
|
|
|
11
11
|
ActionCommandEvent = "ActionCommandEvent",
|
|
12
12
|
ActionUpdateCloudStatus = "ActionUpdateCloudStatus",
|
|
13
13
|
ActionGesture = "ActionGesture",
|
|
14
|
-
ActionTrack = "ActionTrack"
|
|
15
|
-
RequestKeyFrame = "RequestKeyFrame"
|
|
14
|
+
ActionTrack = "ActionTrack"
|
|
16
15
|
}
|
|
17
16
|
export declare enum ActionCommandEventValue {
|
|
18
17
|
ENABLE = "ENABLE",
|
|
@@ -175,7 +174,6 @@ export declare class ChannelData {
|
|
|
175
174
|
static clarity(data: any): ChannelData;
|
|
176
175
|
static switchAudio(data: any): ChannelData;
|
|
177
176
|
static changeSender(data: any): ChannelData;
|
|
178
|
-
static requestKeyFrame(data: any): ChannelData;
|
|
179
177
|
}
|
|
180
178
|
export interface RTCStatsReportExtended extends RTCStatsReport {
|
|
181
179
|
get(id: string): RTCStats | undefined;
|
|
@@ -210,11 +208,3 @@ export interface ScreenShotData {
|
|
|
210
208
|
roomId: string;
|
|
211
209
|
base64: string;
|
|
212
210
|
}
|
|
213
|
-
export declare class BitReader {
|
|
214
|
-
private data;
|
|
215
|
-
private byteOffset;
|
|
216
|
-
private bitOffset;
|
|
217
|
-
constructor(data: Uint8Array);
|
|
218
|
-
readBits(count: number): number;
|
|
219
|
-
readUEG(): number;
|
|
220
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import type { WebRTCConfigOptions } from '../rtc/WebRTCConfig';
|
|
2
|
+
import type { WebRTCConfigOptions } from '../rtc/WebRTCConfig.ts';
|
|
3
3
|
import { WebRTCSdk } from '../WebRTCSdk';
|
|
4
|
-
import type { ChannelDataType } from '../data/WebrtcDataType';
|
|
4
|
+
import type { ChannelDataType } from '../data/WebrtcDataType.ts';
|
|
5
5
|
import type { ConnectorType } from '../data/MessageType';
|
|
6
6
|
export declare class SdkController extends EventEmitter {
|
|
7
7
|
private readonly sdk;
|
|
@@ -19,12 +19,19 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
19
19
|
private maxLostRate;
|
|
20
20
|
private lastSecondDecodedCount;
|
|
21
21
|
private fileVideo?;
|
|
22
|
+
private videoTransceiver?;
|
|
23
|
+
private audioTransceiver?;
|
|
22
24
|
private canvas?;
|
|
23
25
|
private canvasStream;
|
|
24
26
|
private rafId;
|
|
25
27
|
private currentMedia;
|
|
26
28
|
private fileImage?;
|
|
27
|
-
private
|
|
29
|
+
private reConnectTimer;
|
|
30
|
+
private canPushStream;
|
|
31
|
+
private idleTimer;
|
|
32
|
+
private retryCount;
|
|
33
|
+
private readonly MAX_RETRY_PER_RECONNECT;
|
|
34
|
+
private lastIdleResetTime;
|
|
28
35
|
constructor(config: WebRTCConfig);
|
|
29
36
|
startPush(useBackCamera?: boolean): Promise<void>;
|
|
30
37
|
handleOffer(offerSdp: string): void;
|
|
@@ -39,10 +46,10 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
39
46
|
switchCamera(useBackCamera: boolean): Promise<void>;
|
|
40
47
|
private getRotatedStream;
|
|
41
48
|
private setVideoParams;
|
|
42
|
-
stopPush(): void
|
|
49
|
+
stopPush(): Promise<void>;
|
|
43
50
|
private resetPeerConnection;
|
|
51
|
+
private onConnected;
|
|
44
52
|
private configDataChannel;
|
|
45
|
-
private handleVideoChannelMessage;
|
|
46
53
|
private handleDataChannelMessage;
|
|
47
54
|
private checkStats;
|
|
48
55
|
private processStatsOptimized;
|
|
@@ -57,4 +64,7 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
57
64
|
getFileImage(): HTMLImageElement;
|
|
58
65
|
/** 停止推流并释放资源 */
|
|
59
66
|
stopLocal(): void;
|
|
67
|
+
private resetIdleTimer;
|
|
68
|
+
/** 停止空闲计时器 */
|
|
69
|
+
private clearIdleTimer;
|
|
60
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConnectorType } from '../data/MessageType';
|
|
2
|
-
import { LogLevel } from "../util/Logger";
|
|
2
|
+
import { LogLevel } from "../util/Logger.ts";
|
|
3
3
|
export interface WebRTCConfigOptions {
|
|
4
4
|
signalServerUrl: string;
|
|
5
5
|
myId?: string;
|
|
@@ -33,6 +33,7 @@ export interface WebRTCConfigOptions {
|
|
|
33
33
|
cacheTimeout?: number;
|
|
34
34
|
enableLogger?: boolean;
|
|
35
35
|
loggerLevel?: LogLevel;
|
|
36
|
+
operateTimeout?: number;
|
|
36
37
|
}
|
|
37
38
|
export declare class WebRTCConfig {
|
|
38
39
|
signalServerUrl: string;
|
|
@@ -56,5 +57,6 @@ export declare class WebRTCConfig {
|
|
|
56
57
|
turnKey: Array<string>;
|
|
57
58
|
traceId: string;
|
|
58
59
|
signAgain: boolean;
|
|
60
|
+
operateTimeout: number;
|
|
59
61
|
constructor(options: WebRTCConfigOptions);
|
|
60
62
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type WebRtcError } from "../data/WebRtcError";
|
|
2
|
-
import { WebRTCConfig } from "./WebRTCConfig";
|
|
1
|
+
import { type WebRtcError } from "../data/WebRtcError.ts";
|
|
2
|
+
import { WebRTCConfig } from "./WebRTCConfig.ts";
|
|
3
3
|
export declare const setRemoteDescriptionWithHandleOffer: (peerConnection: RTCPeerConnection, sdp: string, sendAnswer?: (sdp: string) => void, onError?: (err: WebRtcError) => void) => void;
|
|
4
4
|
export declare const createPeerConnection: (config: WebRTCConfig) => RTCPeerConnection;
|
|
5
5
|
export declare const configPeerConnection: (peerConnection: RTCPeerConnection, onICEMessage: (candidate: string) => void, onTrack?: (track: MediaStreamTrack) => void, onConnectState?: (state: RTCIceConnectionState) => void, onError?: (error: WebRtcError) => void) => void;
|
|
6
|
-
export declare const setRemoteDescriptionWithHandleAnswer: (peerConnection: RTCPeerConnection, sdp: string, onError?: (error: WebRtcError) => void) => void;
|
|
6
|
+
export declare const setRemoteDescriptionWithHandleAnswer: (peerConnection: RTCPeerConnection, sdp: string, onSuccess?: () => void, onError?: (error: WebRtcError) => void) => void;
|
|
7
7
|
export declare const createOffer: (peerConnection: RTCPeerConnection, sendOfferMessage: (sdp: string) => void) => Promise<void>;
|
|
8
8
|
export declare const setLocalDescriptionWithCreateOffer: (peerConnection: RTCPeerConnection, offer: RTCSessionDescriptionInit, sendOfferMessage: (sdp: string) => void) => Promise<void>;
|
|
9
9
|
export declare const addIceCandidate: (peerConnection: RTCPeerConnection, candidate: RTCIceCandidateInit, onError?: (error: WebRtcError) => void) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import type { WebRTCConfig } from '../rtc/WebRTCConfig';
|
|
2
|
+
import type { WebRTCConfig } from '../rtc/WebRTCConfig.ts';
|
|
3
3
|
import { ConnectorType } from '../data/MessageType';
|
|
4
4
|
export declare class SignalingClient extends EventEmitter {
|
|
5
5
|
private config;
|
|
@@ -14,3 +14,9 @@ export interface KeyEventData {
|
|
|
14
14
|
* @returns 包含 androidKeyCode 和 metaState 的对象
|
|
15
15
|
*/
|
|
16
16
|
export declare const getKeyEventData: (event: KeyboardEvent) => KeyEventData;
|
|
17
|
+
/**
|
|
18
|
+
* 判断当前按键是否属于功能键
|
|
19
|
+
* @param event - 浏览器 KeyboardEvent
|
|
20
|
+
* @returns true 表示是功能键
|
|
21
|
+
*/
|
|
22
|
+
export declare const isFunctionKey: (event: KeyboardEvent) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TurnSelectionResult, TurnServerConfig, TurnTestResult, TurnTestSummary } from '../data/TurnType';
|
|
2
|
-
import type { WebRTCConfigOptions } from '../rtc/WebRTCConfig';
|
|
1
|
+
import type { TurnSelectionResult, TurnServerConfig, TurnTestResult, TurnTestSummary } from '../data/TurnType.ts';
|
|
2
|
+
import type { WebRTCConfigOptions } from '../rtc/WebRTCConfig.ts';
|
|
3
3
|
export declare const testTurnServer: (turnConfig: TurnServerConfig, timeoutMs?: number) => Promise<TurnTestResult>;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const testMultipleTurnServersFast: (servers: string[], timeoutMs?: number, concurrency?: number) => Promise<TurnTestSummary>;
|
|
5
5
|
export declare const areTurnListsEmpty: (options: WebRTCConfigOptions) => boolean;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const selectBestTurnServerFast: (turnList: string[]) => Promise<TurnSelectionResult>;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { WebRTCSdk } from './core/WebRTCSdk';
|
|
2
2
|
import { getKeyEventData } from "./core/util/KeyCodeUtil";
|
|
3
|
-
import {
|
|
3
|
+
import { selectBestTurnServerFast } from './core/util/TurnTestUtil';
|
|
4
4
|
import { transformCoordinate, valueToPercentage } from "./core/util/ScreenControlUtil";
|
|
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,
|
|
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, type CameraError, type WebRtcError, ConnectorType, GroupCtrlSocketManager, FailCode, selectBestTurnServerFast };
|
|
@@ -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,11 @@
|
|
|
1
|
+
import RemoteControllerBase from "./RemoteControllerBase";
|
|
2
|
+
declare class RemoteCanvasController implements RemoteControllerBase {
|
|
3
|
+
remoteElement: HTMLElement | null;
|
|
4
|
+
audioElement?: HTMLAudioElement | null | undefined;
|
|
5
|
+
constructor();
|
|
6
|
+
startDecode(arrayBuffer: ArrayBuffer): void;
|
|
7
|
+
startPlay(track: MediaStreamTrack): void;
|
|
8
|
+
stopPlay(): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
}
|
|
11
|
+
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;
|