yjz-web-sdk 1.0.7-beta.2 → 1.0.8-beta.3
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/lib/core/WebRTCSdk.d.ts +13 -3
- package/lib/core/data/TurnType.d.ts +21 -0
- package/lib/core/data/WebRtcError.d.ts +5 -2
- package/lib/core/groupctrl/GroupControllerManager.d.ts +1 -7
- package/lib/core/rtc/WebRTCConfig.d.ts +6 -1
- package/lib/core/signal/SignalingClient.d.ts +1 -0
- package/lib/core/util/TurnTestUtil.d.ts +6 -0
- package/lib/index.d.ts +4 -2
- package/lib/yjz-web-sdk.js +306 -123
- package/lib/yjz-web-sdk.umd.cjs +25 -32
- package/package.json +1 -1
- package/lib/core/groupctrl/LoopManager.d.ts +0 -8
- package/lib/core/groupctrl/VisibilityManager.d.ts +0 -17
package/lib/core/WebRTCSdk.d.ts
CHANGED
|
@@ -5,13 +5,23 @@ import { WebRTCConfig } from "./rtc/WebRTCConfig.ts";
|
|
|
5
5
|
import type { WebRTCConfigOptions } from './rtc/WebRTCConfig';
|
|
6
6
|
import { ChannelDataType } from "./data/WebrtcDataType.ts";
|
|
7
7
|
export declare class WebRTCSdk extends EventEmitter {
|
|
8
|
-
config: WebRTCConfig;
|
|
9
|
-
signalingClient: SignalingClient;
|
|
10
|
-
webRTCClient: WebRTCClient;
|
|
8
|
+
config: WebRTCConfig | null;
|
|
9
|
+
signalingClient: SignalingClient | null;
|
|
10
|
+
webRTCClient: WebRTCClient | null;
|
|
11
|
+
options: WebRTCConfigOptions;
|
|
12
|
+
isConnected: boolean;
|
|
13
|
+
isConnecting: boolean;
|
|
14
|
+
private connectCount;
|
|
15
|
+
private MAX_COUNT;
|
|
11
16
|
constructor(options: WebRTCConfigOptions);
|
|
17
|
+
initConfig(): Promise<void>;
|
|
12
18
|
/** 开始连接 signal 服务 */
|
|
13
19
|
startConnection(): void;
|
|
20
|
+
private prepareConnection;
|
|
21
|
+
reconnect(): Promise<void>;
|
|
22
|
+
initConnectConfig(): void;
|
|
14
23
|
switchControl(isControl: boolean): void;
|
|
24
|
+
resetConfig(): void;
|
|
15
25
|
/** 停止连接,并发送退出信令 */
|
|
16
26
|
stop(): void;
|
|
17
27
|
/** 开始推流:触发媒体采集与轨道添加 */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type TurnServerConfig = {
|
|
2
|
+
urls: string;
|
|
3
|
+
username?: string;
|
|
4
|
+
credential?: string;
|
|
5
|
+
};
|
|
6
|
+
export interface TurnTestResult extends TurnServerConfig {
|
|
7
|
+
rtt: number;
|
|
8
|
+
}
|
|
9
|
+
export type PublicTurnTestResult = {
|
|
10
|
+
urls: string;
|
|
11
|
+
rtt: number;
|
|
12
|
+
};
|
|
13
|
+
export type TurnTestSummary = {
|
|
14
|
+
best?: PublicTurnTestResult;
|
|
15
|
+
all: PublicTurnTestResult[];
|
|
16
|
+
};
|
|
17
|
+
export interface TurnSelectionResult {
|
|
18
|
+
url?: string;
|
|
19
|
+
rtt?: number;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
@@ -14,7 +14,9 @@ export declare enum FailCode {
|
|
|
14
14
|
DATACHANNEL_ERR = 10013,
|
|
15
15
|
STREAM_STATE = 10014,
|
|
16
16
|
AUTH_FAILED = 10015,
|
|
17
|
-
KICK_OUT_ERR = 10016
|
|
17
|
+
KICK_OUT_ERR = 10016,
|
|
18
|
+
STATE_ERR = 10017,
|
|
19
|
+
OPTION_ERR = 10018
|
|
18
20
|
}
|
|
19
21
|
export declare const FailInfoMap: Record<FailCode, {
|
|
20
22
|
type: string;
|
|
@@ -39,5 +41,6 @@ export declare enum EmitType {
|
|
|
39
41
|
statisticInfo = "statisticInfo",
|
|
40
42
|
cloudClipData = "cloudClipData",
|
|
41
43
|
screenshot = "screenshot",
|
|
42
|
-
groupError = "groupError"
|
|
44
|
+
groupError = "groupError",
|
|
45
|
+
reconnect = "reconnect"
|
|
43
46
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from "eventemitter3";
|
|
2
2
|
import type { WebRTCConfigOptions } from "../rtc/WebRTCConfig.ts";
|
|
3
|
-
import { VisibilityManager } from "./VisibilityManager.ts";
|
|
4
3
|
import { SdkController } from "./SdkController.ts";
|
|
5
4
|
import { type ChannelDataType } from "../data/WebrtcDataType.ts";
|
|
6
5
|
export declare class GroupControllerManager extends EventEmitter {
|
|
7
6
|
private configs;
|
|
8
7
|
private controllers;
|
|
9
|
-
|
|
10
|
-
private loopManager;
|
|
11
|
-
constructor(interval?: number, visibility?: VisibilityManager);
|
|
8
|
+
constructor();
|
|
12
9
|
startControl(configMap: Map<string, WebRTCConfigOptions>): void;
|
|
13
10
|
switchToMain(newRoomId: string, oldRoomId: string): void;
|
|
14
11
|
switchControl(roomId: string, isControl: boolean): void;
|
|
@@ -27,9 +24,6 @@ export declare class GroupControllerManager extends EventEmitter {
|
|
|
27
24
|
getController(roomId: string): SdkController | undefined;
|
|
28
25
|
refreshController(roomId: string): void;
|
|
29
26
|
updateProperty<K extends keyof WebRTCConfigOptions>(roomId: string, key: K, value: WebRTCConfigOptions[K]): void;
|
|
30
|
-
setVisibility(viewId: string, visible: boolean): void;
|
|
31
|
-
setViewIds(viewIds: string[], visible: boolean): void;
|
|
32
27
|
sendData(type: ChannelDataType, data: any): void;
|
|
33
28
|
sendControlEvent(key: number): void;
|
|
34
|
-
private handleLoop;
|
|
35
29
|
}
|
|
@@ -6,7 +6,7 @@ export interface WebRTCConfigOptions {
|
|
|
6
6
|
stunServerUri?: string;
|
|
7
7
|
stunServerUriAli?: string;
|
|
8
8
|
stunServerUriTel?: string;
|
|
9
|
-
turnServerUri
|
|
9
|
+
turnServerUri?: string;
|
|
10
10
|
turnServerUserName?: string;
|
|
11
11
|
turnServerPassword?: string;
|
|
12
12
|
isControl: boolean;
|
|
@@ -19,6 +19,10 @@ export interface WebRTCConfigOptions {
|
|
|
19
19
|
cloudName?: string;
|
|
20
20
|
token: string;
|
|
21
21
|
isGroup: boolean;
|
|
22
|
+
turnKey?: Array<string>;
|
|
23
|
+
hostTurn: Array<string>;
|
|
24
|
+
spareTurn: Array<string>;
|
|
25
|
+
maxRecount?: number;
|
|
22
26
|
}
|
|
23
27
|
export declare class WebRTCConfig {
|
|
24
28
|
signalServerUrl: string;
|
|
@@ -37,5 +41,6 @@ export declare class WebRTCConfig {
|
|
|
37
41
|
screenshotQuality: number;
|
|
38
42
|
token: string;
|
|
39
43
|
isGroup: boolean;
|
|
44
|
+
turnKey: Array<string>;
|
|
40
45
|
constructor(options: WebRTCConfigOptions);
|
|
41
46
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TurnSelectionResult, TurnServerConfig, TurnTestResult, TurnTestSummary } from "../data/TurnType.ts";
|
|
2
|
+
import type { WebRTCConfigOptions } from "../rtc/WebRTCConfig.ts";
|
|
3
|
+
export declare const testTurnServer: (turnConfig: TurnServerConfig, timeoutMs?: number) => Promise<TurnTestResult>;
|
|
4
|
+
export declare const testMultipleTurnServers: (servers: string[], timeoutMs?: number) => Promise<TurnTestSummary>;
|
|
5
|
+
export declare const areTurnListsEmpty: (options: WebRTCConfigOptions) => boolean;
|
|
6
|
+
export declare const selectBestTurnServer: (turnList: string[]) => Promise<TurnSelectionResult>;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { WebRTCSdk } from './core/WebRTCSdk';
|
|
2
2
|
import { getKeyEventData } from "./core/util/KeyCodeUtil";
|
|
3
|
+
import { testMultipleTurnServers } from './core/util/TurnTestUtil';
|
|
3
4
|
import { transformCoordinate, valueToPercentage } from "./core/util/ScreenControlUtil";
|
|
4
5
|
import { ActionType, ChannelDataType, ContainerDirection, InputData, KeyEventData, TouchData, WheelData, GestureData, type ActionCommand, ActionCommandType, ActionCommandEventType, ActionCommandEventValue, TrackEventData, ClarityData } from "./core/data/WebrtcDataType";
|
|
6
|
+
import { type TurnServerConfig, type TurnTestResult, type TurnTestSummary } from "./core/data/TurnType";
|
|
5
7
|
import type { WebRTCConfigOptions } from './core/rtc/WebRTCConfig';
|
|
6
|
-
import { GroupControllerManager } from "./core/groupctrl/GroupControllerManager
|
|
8
|
+
import { GroupControllerManager } from "./core/groupctrl/GroupControllerManager";
|
|
7
9
|
import { EmitType } from "./core/data/WebRtcError";
|
|
8
10
|
import RemotePlayer from './components/RemotePlayer/index.vue';
|
|
9
|
-
export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, ClarityData, type ActionCommand, ActionCommandType, GroupControllerManager, type WebRTCConfigOptions, ActionCommandEventType, ActionCommandEventValue, RemotePlayer, TrackEventData };
|
|
11
|
+
export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, ClarityData, type ActionCommand, ActionCommandType, GroupControllerManager, type WebRTCConfigOptions, ActionCommandEventType, ActionCommandEventValue, RemotePlayer, TrackEventData, type TurnServerConfig, type TurnTestResult, type TurnTestSummary, testMultipleTurnServers };
|