yjz-web-sdk 1.0.4 → 1.0.5-beta.1
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/composables/useRemoteVideo.d.ts +1 -1
- package/lib/core/WebRTCSdk.d.ts +1 -0
- package/lib/core/data/WebRtcError.d.ts +2 -1
- package/lib/core/data/WebrtcDataType.d.ts +12 -0
- package/lib/core/groupctrl/GroupControllerManager.d.ts +28 -16
- package/lib/core/groupctrl/LoopManager.d.ts +8 -0
- package/lib/core/groupctrl/SdkController.d.ts +15 -0
- package/lib/core/groupctrl/VisibilityManager.d.ts +17 -0
- package/lib/core/rtc/WebRTCConfig.d.ts +9 -5
- package/lib/index.d.ts +2 -2
- package/lib/yjz-web-sdk.js +340 -138
- package/lib/yjz-web-sdk.umd.cjs +47 -35
- package/package.json +3 -1
- package/lib/yjz-web-sdk.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
|
-
export default function useRemoteVideo(videoContainer: Ref<HTMLElement | null>, remoteVideoElement: Ref<HTMLVideoElement | null>, videoAngle: Ref<number
|
|
2
|
+
export default function useRemoteVideo(videoContainer: Ref<HTMLElement | null>, remoteVideoElement: Ref<HTMLVideoElement | null>, videoAngle: Ref<number>, emit: (event: 'loadedSuccess') => void): {
|
|
3
3
|
videoSize: any;
|
|
4
4
|
remoteVideo: any;
|
|
5
5
|
dimensions: any;
|
package/lib/core/WebRTCSdk.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare class WebRTCSdk extends EventEmitter {
|
|
|
17
17
|
startPush(): Promise<void>;
|
|
18
18
|
/** 发送信道数据 */
|
|
19
19
|
sendChannelData(type: ChannelDataType, data: any): void;
|
|
20
|
+
sendControlEvent(key: number): void;
|
|
20
21
|
sendRequestScreenshot(visible: boolean): void;
|
|
21
22
|
/**
|
|
22
23
|
* 处理 signal 消息,根据不同消息类型分发到 webRTCClient 或直接触发 SDK 事件
|
|
@@ -12,6 +12,10 @@ export declare enum ChannelDataType {
|
|
|
12
12
|
ActionUpdateCloudStatus = "ActionUpdateCloudStatus",
|
|
13
13
|
ActionGesture = "ActionGesture"
|
|
14
14
|
}
|
|
15
|
+
export declare enum ActionCommandEventValue {
|
|
16
|
+
ENABLE = "ENABLE",
|
|
17
|
+
DISABLE = "DISABLE"
|
|
18
|
+
}
|
|
15
19
|
export declare enum ActionCommandType {
|
|
16
20
|
/**
|
|
17
21
|
* 执行云机back
|
|
@@ -156,6 +160,7 @@ export declare class ChannelData {
|
|
|
156
160
|
* @param data 清晰度数据
|
|
157
161
|
*/
|
|
158
162
|
static clarity(data: any): ChannelData;
|
|
163
|
+
static switchAudio(data: any): ChannelData;
|
|
159
164
|
}
|
|
160
165
|
export interface RTCStatsReportExtended extends RTCStatsReport {
|
|
161
166
|
get(id: string): RTCStats | undefined;
|
|
@@ -177,3 +182,10 @@ export interface CloudStatusPayload {
|
|
|
177
182
|
screenHeight: number;
|
|
178
183
|
gestureMode: number;
|
|
179
184
|
}
|
|
185
|
+
export interface CloudPointer {
|
|
186
|
+
rect: DOMRect;
|
|
187
|
+
x: number;
|
|
188
|
+
y: number;
|
|
189
|
+
action: ActionType;
|
|
190
|
+
offsetTime: number;
|
|
191
|
+
}
|
|
@@ -1,22 +1,34 @@
|
|
|
1
|
+
import { EventEmitter } from "eventemitter3";
|
|
1
2
|
import type { WebRTCConfigOptions } from "../rtc/WebRTCConfig.ts";
|
|
3
|
+
import { VisibilityManager } from "./VisibilityManager.ts";
|
|
4
|
+
import { SdkController } from "./SdkController.ts";
|
|
2
5
|
import { type ChannelDataType } from "../data/WebrtcDataType.ts";
|
|
3
|
-
import { EventEmitter } from "eventemitter3";
|
|
4
6
|
export declare class GroupControllerManager extends EventEmitter {
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
private configs;
|
|
8
|
+
private controllers;
|
|
9
|
+
private visibility;
|
|
10
|
+
private loopManager;
|
|
11
|
+
constructor(interval?: number, visibility?: VisibilityManager);
|
|
12
|
+
startControl(configMap: Map<string, WebRTCConfigOptions>): void;
|
|
13
|
+
switchToMain(newRoomId: string, oldRoomId: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* 找到当前主控config, 设置为从控
|
|
16
|
+
*/
|
|
17
|
+
clearCurrentControl(): string | undefined;
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
16
|
-
* @param visible 是否可见
|
|
19
|
+
* 找到目标config, 设置为主控
|
|
20
|
+
* @param roomId
|
|
17
21
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
+
setAsControl(roomId: string): string | undefined;
|
|
23
|
+
stopControl(): void;
|
|
24
|
+
private addController;
|
|
25
|
+
getConfigs(): Map<string, WebRTCConfigOptions>;
|
|
26
|
+
getController(roomId: string): SdkController | undefined;
|
|
27
|
+
refreshController(roomId: string): void;
|
|
28
|
+
updateProperty<K extends keyof WebRTCConfigOptions>(roomId: string, key: K, value: WebRTCConfigOptions[K]): void;
|
|
29
|
+
setVisibility(viewId: string, visible: boolean): void;
|
|
30
|
+
setViewIds(viewIds: string[], visible: boolean): void;
|
|
31
|
+
sendData(type: ChannelDataType, data: any): void;
|
|
32
|
+
sendControlEvent(key: number): void;
|
|
33
|
+
private handleLoop;
|
|
22
34
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EventEmitter } from "eventemitter3";
|
|
2
|
+
import type { WebRTCConfigOptions } from "../rtc/WebRTCConfig.ts";
|
|
3
|
+
import type { ChannelDataType } from "../data/WebrtcDataType.ts";
|
|
4
|
+
export declare class SdkController extends EventEmitter {
|
|
5
|
+
private sdk;
|
|
6
|
+
private config;
|
|
7
|
+
constructor(config: WebRTCConfigOptions);
|
|
8
|
+
private initSdk;
|
|
9
|
+
setIsControl(value: boolean): void;
|
|
10
|
+
start(): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
sendData(type: ChannelDataType, data: any): void;
|
|
13
|
+
sendControlData(key: number): void;
|
|
14
|
+
requestScreenshot(visible: boolean): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class VisibilityManager {
|
|
2
|
+
private visibility;
|
|
3
|
+
private prevVisibility;
|
|
4
|
+
set(viewId: string, visible: boolean): void;
|
|
5
|
+
/**
|
|
6
|
+
* 设置视图的可见性,替换所有可见项
|
|
7
|
+
* @param viewIds
|
|
8
|
+
* @param visible
|
|
9
|
+
*/
|
|
10
|
+
setViewIds(viewIds: string[], visible: boolean): void;
|
|
11
|
+
getChanges(): {
|
|
12
|
+
viewId: string;
|
|
13
|
+
nowVisible: boolean;
|
|
14
|
+
wasVisible: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
clear(): void;
|
|
17
|
+
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
export interface WebRTCConfigOptions {
|
|
2
|
-
signalServerUrl
|
|
2
|
+
signalServerUrl: string;
|
|
3
3
|
myId?: string;
|
|
4
|
-
roomId
|
|
4
|
+
roomId: string;
|
|
5
5
|
targetId?: string;
|
|
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
|
-
isControl
|
|
12
|
+
isControl: boolean;
|
|
13
13
|
screenshotWidth?: number;
|
|
14
14
|
screenshotHeight?: number;
|
|
15
15
|
screenshotQuality?: number;
|
|
16
|
+
canOperate?: boolean;
|
|
17
|
+
screenUrl?: string;
|
|
18
|
+
connectStatus?: number;
|
|
19
|
+
cloudName?: string;
|
|
16
20
|
}
|
|
17
21
|
export declare class WebRTCConfig {
|
|
18
22
|
signalServerUrl: string;
|
|
@@ -29,5 +33,5 @@ export declare class WebRTCConfig {
|
|
|
29
33
|
screenshotWidth: number;
|
|
30
34
|
screenshotHeight: number;
|
|
31
35
|
screenshotQuality: number;
|
|
32
|
-
constructor(options
|
|
36
|
+
constructor(options: WebRTCConfigOptions);
|
|
33
37
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WebRTCSdk } from './core/WebRTCSdk';
|
|
2
2
|
import { getKeyEventData } from "./core/util/KeyCodeUtil";
|
|
3
3
|
import { transformCoordinate, valueToPercentage } from "./core/util/ScreenControlUtil";
|
|
4
|
-
import { ActionType, ChannelDataType, ContainerDirection, InputData, KeyEventData, TouchData, WheelData, GestureData, type ActionCommand, ActionCommandType } from "./core/data/WebrtcDataType";
|
|
4
|
+
import { ActionType, ChannelDataType, ContainerDirection, InputData, KeyEventData, TouchData, WheelData, GestureData, type ActionCommand, ActionCommandType, ActionCommandEventType, ActionCommandEventValue } from "./core/data/WebrtcDataType";
|
|
5
5
|
import type { WebRTCConfigOptions } from './core/rtc/WebRTCConfig';
|
|
6
6
|
import { GroupControllerManager } from "./core/groupctrl/GroupControllerManager.ts";
|
|
7
7
|
import { EmitType } from "./core/data/WebRtcError";
|
|
8
8
|
import RemotePlayer from './components/RemotePlayer/index.vue';
|
|
9
|
-
export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, type ActionCommand, ActionCommandType, GroupControllerManager, type WebRTCConfigOptions, RemotePlayer };
|
|
9
|
+
export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, type ActionCommand, ActionCommandType, GroupControllerManager, type WebRTCConfigOptions, ActionCommandEventType, ActionCommandEventValue, RemotePlayer };
|