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.
@@ -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;
@@ -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 事件
@@ -36,5 +36,6 @@ export declare enum EmitType {
36
36
  cloudStatusChanged = "cloudStatusChanged",
37
37
  statisticInfo = "statisticInfo",
38
38
  cloudClipData = "cloudClipData",
39
- screenshot = "screenshot"
39
+ screenshot = "screenshot",
40
+ groupError = "groupError"
40
41
  }
@@ -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 webRTCConfigList;
6
- private sdkList;
7
- private loopTimer;
8
- private visibilityMap;
9
- private previousVisibilityMap;
10
- startGroupControl(configList: WebRTCConfigOptions[]): void;
11
- stopGroupControl(): void;
12
- getConnectionList(): WebRTCConfigOptions[];
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 viewId 视图 ID
16
- * @param visible 是否可见
19
+ * 找到目标config, 设置为主控
20
+ * @param roomId
17
21
  */
18
- setViewVisibility(viewId: string, visible: boolean): void;
19
- sendChannelData(type: ChannelDataType, data: any): void;
20
- private startLoop;
21
- private stopLoop;
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,8 @@
1
+ export declare class LoopManager {
2
+ private interval;
3
+ private callback;
4
+ private timer;
5
+ constructor(interval: number, callback: () => void);
6
+ start(): void;
7
+ stop(): void;
8
+ }
@@ -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?: string;
2
+ signalServerUrl: string;
3
3
  myId?: string;
4
- roomId?: string;
4
+ roomId: string;
5
5
  targetId?: string;
6
6
  stunServerUri?: string;
7
7
  stunServerUriAli?: string;
8
8
  stunServerUriTel?: string;
9
- turnServerUri?: string;
9
+ turnServerUri: string;
10
10
  turnServerUserName?: string;
11
11
  turnServerPassword?: string;
12
- isControl?: boolean;
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?: WebRTCConfigOptions);
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 };