yjz-web-sdk 1.0.2 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  import { ChannelDataType } from "../core/data/WebrtcDataType.ts";
2
- export default function useKeyboardControl(emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void): {
3
- handleKeyDown: (e: KeyboardEvent) => void;
4
- startListening: (e: Event) => void;
2
+ import { type Ref } from "vue";
3
+ export default function useKeyboardControl(disabled: Ref<boolean>, emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void): {
4
+ startListening: () => void;
5
5
  stopListening: () => void;
6
6
  };
@@ -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
+ sendRequestScreenshot(visible: boolean): void;
20
21
  /**
21
22
  * 处理 signal 消息,根据不同消息类型分发到 webRTCClient 或直接触发 SDK 事件
22
23
  * @param message 信令消息
@@ -6,7 +6,8 @@ export declare enum MessageType {
6
6
  SignOut = "SignOut",
7
7
  NotAvailable = "NotAvailable",
8
8
  Ping = "Ping",
9
- Pong = "Pong"
9
+ Pong = "Pong",
10
+ SendScreenshot = "SendScreenshot"
10
11
  }
11
12
  export declare enum SendType {
12
13
  SignIn = "SignIn",
@@ -15,7 +16,8 @@ export declare enum SendType {
15
16
  Offer = "Offer",
16
17
  IceCandidates = "IceCandidates",
17
18
  Pong = "Pong",
18
- Identity = "Web"
19
+ Identity = "Web",
20
+ RequestScreenshot = "RequestScreenshot"
19
21
  }
20
22
  export declare enum IceConnectionState {
21
23
  NEW = "new",
@@ -34,5 +34,7 @@ export declare enum EmitType {
34
34
  streamTrack = "streamTrack",
35
35
  iceConnectionState = "iceConnectionState",
36
36
  cloudStatusChanged = "cloudStatusChanged",
37
- statisticInfo = "statisticInfo"
37
+ statisticInfo = "statisticInfo",
38
+ cloudClipData = "cloudClipData",
39
+ screenshot = "screenshot"
38
40
  }
@@ -6,7 +6,44 @@ export declare enum ChannelDataType {
6
6
  ActionChinese = "ActionChinese",
7
7
  ActionRequestCloudDeviceInfo = "ActionRequestCloudDeviceInfo",
8
8
  ActionClarity = "ActionClarity",
9
- ActionWheel = "ActionWheel"
9
+ ActionWheel = "ActionWheel",
10
+ CloudClipData = "CloudClipData",
11
+ ActionCommandEvent = "ActionCommandEvent",
12
+ ActionUpdateCloudStatus = "ActionUpdateCloudStatus",
13
+ ActionGesture = "ActionGesture"
14
+ }
15
+ export declare enum ActionCommandType {
16
+ /**
17
+ * 执行云机back
18
+ */
19
+ ActionBack = "ActionBack",
20
+ /**
21
+ * 执行云机Home
22
+ */
23
+ ActionHome = "ActionHome",
24
+ /**
25
+ * 执行云机Recent
26
+ */
27
+ ActionRecent = "ActionRecent",
28
+ /**
29
+ * 切换到虚拟按键模式
30
+ */
31
+ ActionSwitchNavButtons = "ActionSwitchNavButtons",
32
+ /**
33
+ * 切换到手势模式
34
+ */
35
+ ActionSwitchNavGestural = "ActionSwitchNavGestural"
36
+ }
37
+ export interface ActionCommand {
38
+ type: ActionCommandType;
39
+ }
40
+ export declare enum ActionCommandEventType {
41
+ /** 云机控制拉流端是否推流 Camera 和 MIC 数据到云机侧,或拉流端控制云机是否推流三方播放的音频 */
42
+ ACTION_CONTROL_VIDEO_AND_AUDIO = "ACTION_CONTROL_VIDEO_AND_AUDIO",
43
+ /** 控制是否推送视频 */
44
+ ACTION_CONTROL_VIDEO = "ACTION_CONTROL_VIDEO",
45
+ /** 控制是否推送音频 */
46
+ ACTION_CONTROL_AUDIO = "ACTION_CONTROL_AUDIO"
10
47
  }
11
48
  export declare const ActionType: {
12
49
  readonly ACTION_DOWN: 0;
@@ -60,6 +97,13 @@ export declare class KeyEventData {
60
97
  meta: number;
61
98
  constructor(keyCode: number, meta: number);
62
99
  }
100
+ /**
101
+ * GestureData - 导航模式
102
+ */
103
+ export declare class GestureData {
104
+ mode: number;
105
+ constructor(mode: number);
106
+ }
63
107
  export declare class ChannelData {
64
108
  type: ChannelDataType;
65
109
  data: string | null;
@@ -77,6 +121,7 @@ export declare class ChannelData {
77
121
  * @param touchData 触摸数据,可以是任意类型
78
122
  */
79
123
  static click(touchData: any): ChannelData;
124
+ static action(actionData: any): ChannelData;
80
125
  /**
81
126
  * 生成剪贴板数据
82
127
  * @param data 剪贴板数据,可以是字符串或其他类型
@@ -92,6 +137,11 @@ export declare class ChannelData {
92
137
  * @param data 输入数据对象
93
138
  */
94
139
  static wheel(data: any): ChannelData;
140
+ /**
141
+ * 切换手势模式数据
142
+ * @param data 输入数据对象
143
+ */
144
+ static gesture(data: any): ChannelData;
95
145
  /**
96
146
  * 生成中文输入数据
97
147
  * @param data 中文输入数据
@@ -118,9 +168,12 @@ export interface ScreenStats {
118
168
  bitrate: string;
119
169
  pliCount: number;
120
170
  averageDecodeTime: number;
171
+ framesDecoded: number;
172
+ framesReceived: number;
121
173
  }
122
174
  export interface CloudStatusPayload {
123
175
  direction: number;
124
176
  screenWidth: number;
125
177
  screenHeight: number;
178
+ gestureMode: number;
126
179
  }
@@ -0,0 +1,22 @@
1
+ import type { WebRTCConfigOptions } from "../rtc/WebRTCConfig.ts";
2
+ import { type ChannelDataType } from "../data/WebrtcDataType.ts";
3
+ import { EventEmitter } from "eventemitter3";
4
+ 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[];
13
+ /**
14
+ * 设置某个视图的可见状态
15
+ * @param viewId 视图 ID
16
+ * @param visible 是否可见
17
+ */
18
+ setViewVisibility(viewId: string, visible: boolean): void;
19
+ sendChannelData(type: ChannelDataType, data: any): void;
20
+ private startLoop;
21
+ private stopLoop;
22
+ }
@@ -9,6 +9,10 @@ export interface WebRTCConfigOptions {
9
9
  turnServerUri?: string;
10
10
  turnServerUserName?: string;
11
11
  turnServerPassword?: string;
12
+ isControl?: boolean;
13
+ screenshotWidth?: number;
14
+ screenshotHeight?: number;
15
+ screenshotQuality?: number;
12
16
  }
13
17
  export declare class WebRTCConfig {
14
18
  signalServerUrl: string;
@@ -21,5 +25,9 @@ export declare class WebRTCConfig {
21
25
  turnServerUri: string;
22
26
  turnServerUserName: string;
23
27
  turnServerPassword: string;
28
+ isControl: boolean;
29
+ screenshotWidth: number;
30
+ screenshotHeight: number;
31
+ screenshotQuality: number;
24
32
  constructor(options?: WebRTCConfigOptions);
25
33
  }
@@ -19,4 +19,9 @@ export declare class SignalingClient extends EventEmitter {
19
19
  */
20
20
  sendMessage(message: string): void;
21
21
  sendSignInMessage(): void;
22
+ /**
23
+ * 用于从控请求当前截屏
24
+ * @param visible 当前从控page控件是否可见
25
+ */
26
+ sendRequestScreenshot(visible: boolean): void;
22
27
  }
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const computeAndroidMetaState: (event: KeyboardEvent) => number;
7
7
  export interface KeyEventData {
8
- androidKeyCode: number;
9
- metaState: number;
8
+ keyCode: number;
9
+ meta: number;
10
10
  }
11
11
  /**
12
12
  * 根据 KeyboardEvent 生成 Android 平台下的按键数据
package/lib/index.d.ts CHANGED
@@ -1,7 +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 } from "./core/data/WebrtcDataType";
4
+ import { ActionType, ChannelDataType, ContainerDirection, InputData, KeyEventData, TouchData, WheelData, GestureData, type ActionCommand, ActionCommandType } from "./core/data/WebrtcDataType";
5
+ import type { WebRTCConfigOptions } from './core/rtc/WebRTCConfig';
6
+ import { GroupControllerManager } from "./core/groupctrl/GroupControllerManager.ts";
5
7
  import { EmitType } from "./core/data/WebRtcError";
6
8
  import RemotePlayer from './components/RemotePlayer/index.vue';
7
- export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, RemotePlayer };
9
+ export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, type ActionCommand, ActionCommandType, GroupControllerManager, type WebRTCConfigOptions, RemotePlayer };
@@ -1 +1 @@
1
- .vContainer[data-v-27488d0e]{transition:transform .2s linear}.flex[data-v-27488d0e]{display:flex}.flex-1[data-v-27488d0e]{flex:1 1 0}.items-center[data-v-27488d0e]{align-items:center}.justify-center[data-v-27488d0e]{justify-content:center}.video-control[data-v-27488d0e]{width:100%;height:100%;display:block;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.circle-cursor[data-v-27488d0e]{cursor:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3ccircle%20cx='12'%20cy='12'%20r='12'%20fill='%23fff'%20opacity='.6'/%3e%3ccircle%20cx='12'%20cy='12'%20r='10'%20fill='%23000'%20opacity='.6'/%3e%3c/svg%3e"),auto}.triangle-cursor[data-v-27488d0e]{cursor:url("data:image/svg+xml,%3csvg%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20d='M143.832313%205.834982H143.686438A108.676545%20108.676545%200%200%200%205.834982%20143.686438l34.499333-11.815839-34.499333%2011.815839%200.072938%200.218812%200.145874%200.437624%200.583498%201.750494%202.333993%206.71023%208.752474%2025.528047L49.232663%20269.867929a2254749.467572%202254749.467572%200%200%201%20223.917444%20652.351017l9.335972%2027.205605%202.552804%207.585476%200.729373%202.188119a72.572592%2072.572592%200%200%200%20126.181491%2040.844876%2072.134968%2072.134968%200%200%200%2014.076895-18.963693c3.282178-6.41848%205.689108-13.639271%208.023101-20.3495l0.072937-0.291749%2072.572592-209.329989%2047.409231-136.830334%2015.53564-44.710551%200.145874-0.364687%200.510561-0.145874%2045.002301-15.900327%20137.486769-48.649165c99.340573-35.228705%20202.984445-71.989094%20209.913487-74.906584l3.355115-1.312871c8.023101-3.136303%2022.391744-8.606599%2033.915834-20.130689a72.499655%2072.499655%200%200%200%200-102.549813L999.240712%20304.877823c-1.823432-1.969307-7.293728-7.731351-13.274585-11.961714a89.056417%2089.056417%200%200%200-27.205605-12.3264h-0.145874l-2.552805-0.875247L948.184617%20277.161657l-27.86204-9.263034-94.672588-31.800653A405018.007245%20405018.007245%200%200%201%20268.919745%2048.138604L178.039896%2017.504947%20152.657723%208.752473%20145.874556%206.637292%20144.196999%205.90792%20143.832313%205.834982z'%20fill='%23000000'%20opacity='.7'%3e%3c/path%3e%3c/svg%3e"),auto}.default-cursor[data-v-27488d0e]{cursor:default}.no-events[data-v-27488d0e]{pointer-events:none!important}
1
+ .vContainer[data-v-51dd3cb6]{transition:transform .2s linear}.flex[data-v-51dd3cb6]{display:flex}.flex-1[data-v-51dd3cb6]{flex:1 1 0}.items-center[data-v-51dd3cb6]{align-items:center}.justify-center[data-v-51dd3cb6]{justify-content:center}.video-control[data-v-51dd3cb6]{width:100%;height:100%;display:block;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.circle-cursor[data-v-51dd3cb6]{cursor:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3ccircle%20cx='12'%20cy='12'%20r='12'%20fill='%23fff'%20opacity='.6'/%3e%3ccircle%20cx='12'%20cy='12'%20r='10'%20fill='%23000'%20opacity='.6'/%3e%3c/svg%3e") 12 12,auto}.triangle-cursor[data-v-51dd3cb6]{cursor:url("data:image/svg+xml,%3csvg%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20d='M143.832313%205.834982H143.686438A108.676545%20108.676545%200%200%200%205.834982%20143.686438l34.499333-11.815839-34.499333%2011.815839%200.072938%200.218812%200.145874%200.437624%200.583498%201.750494%202.333993%206.71023%208.752474%2025.528047L49.232663%20269.867929a2254749.467572%202254749.467572%200%200%201%20223.917444%20652.351017l9.335972%2027.205605%202.552804%207.585476%200.729373%202.188119a72.572592%2072.572592%200%200%200%20126.181491%2040.844876%2072.134968%2072.134968%200%200%200%2014.076895-18.963693c3.282178-6.41848%205.689108-13.639271%208.023101-20.3495l0.072937-0.291749%2072.572592-209.329989%2047.409231-136.830334%2015.53564-44.710551%200.145874-0.364687%200.510561-0.145874%2045.002301-15.900327%20137.486769-48.649165c99.340573-35.228705%20202.984445-71.989094%20209.913487-74.906584l3.355115-1.312871c8.023101-3.136303%2022.391744-8.606599%2033.915834-20.130689a72.499655%2072.499655%200%200%200%200-102.549813L999.240712%20304.877823c-1.823432-1.969307-7.293728-7.731351-13.274585-11.961714a89.056417%2089.056417%200%200%200-27.205605-12.3264h-0.145874l-2.552805-0.875247L948.184617%20277.161657l-27.86204-9.263034-94.672588-31.800653A405018.007245%20405018.007245%200%200%201%20268.919745%2048.138604L178.039896%2017.504947%20152.657723%208.752473%20145.874556%206.637292%20144.196999%205.90792%20143.832313%205.834982z'%20fill='%23000000'%20opacity='.7'%3e%3c/path%3e%3c/svg%3e") 1 1,auto}.default-cursor[data-v-51dd3cb6]{cursor:default}.no-events[data-v-51dd3cb6]{pointer-events:none!important}