yjz-web-sdk 1.0.0 → 1.0.2-beta.0

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.
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import type { Ref } from 'vue';
2
+ export default function useCursorStyle(cursorType: Ref<number>): any;
@@ -0,0 +1,6 @@
1
+ export default function useDeviceMode(): {
2
+ isMobile: any;
3
+ checkDeviceMode: () => void;
4
+ checkTouchSupport: () => void;
5
+ handleUp: () => void;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { ChannelDataType } from "../core/data/WebrtcDataType.ts";
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
+ stopListening: () => void;
6
+ };
@@ -0,0 +1,25 @@
1
+ import type { Ref } from 'vue';
2
+ import { ChannelDataType } from "../core/data/WebrtcDataType.ts";
3
+ import type { Dimension } from "../components/RemotePlayer/index.ts";
4
+ interface MouseTouchControlOptions {
5
+ isMobile: Ref<boolean>;
6
+ remoteVideoElement: Ref<HTMLVideoElement | null>;
7
+ cloudDeviceSize: Ref<Dimension>;
8
+ streamAngle: Ref<number>;
9
+ videoAngle: Ref<number>;
10
+ widthRadio: Ref<number>;
11
+ emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void;
12
+ }
13
+ export default function useMouseTouchControl(options: MouseTouchControlOptions): {
14
+ isPointerDown: any;
15
+ onTouchStart: (e: TouchEvent) => void;
16
+ onTouchMove: (e: TouchEvent) => void;
17
+ onTouchEnd: (e: TouchEvent) => void;
18
+ handleMouseDown: (event: PointerEvent) => void;
19
+ handleMouseMove: (event: PointerEvent) => void;
20
+ handleMouseEnter: (event: PointerEvent) => void;
21
+ handleMouseUp: (event: PointerEvent) => void;
22
+ handleMouseLeave: (event: PointerEvent) => void;
23
+ handleWheel: (e: WheelEvent) => void;
24
+ };
25
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Ref } from 'vue';
2
+ export default function useRemoteVideo(videoContainer: Ref<HTMLElement | null>, remoteVideoElement: Ref<HTMLVideoElement | null>, videoAngle: Ref<number>): {
3
+ videoSize: any;
4
+ remoteVideo: any;
5
+ dimensions: any;
6
+ widthRadio: any;
7
+ heightRadio: any;
8
+ screenStatus: any;
9
+ initVideoContainer: () => void;
10
+ startPlay: (track: MediaStreamTrack) => void;
11
+ stopPlay: () => void;
12
+ };
@@ -0,0 +1,3 @@
1
+ import type { Ref } from 'vue';
2
+ import type { Dimension } from "../components/RemotePlayer/index.ts";
3
+ export default function useResizeObserver(target: Ref<HTMLElement | null>, dimension: Ref<Dimension>): void;
@@ -34,5 +34,6 @@ 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"
38
39
  }
@@ -5,13 +5,43 @@ export declare enum ChannelDataType {
5
5
  ActionInput = "ActionInput",
6
6
  ActionChinese = "ActionChinese",
7
7
  ActionRequestCloudDeviceInfo = "ActionRequestCloudDeviceInfo",
8
- ActionClarity = "ActionClarity"
8
+ ActionClarity = "ActionClarity",
9
+ ActionWheel = "ActionWheel",
10
+ CloudClipData = "CloudClipData",
11
+ ActionCommandEvent = "ActionCommandEvent",
12
+ ActionUpdateCloudStatus = "ActionUpdateCloudStatus",
13
+ ActionGesture = "ActionGesture"
9
14
  }
10
- export declare const ActionType: Readonly<{
11
- ACTION_DOWN: 0;
12
- ACTION_MOVE: 2;
13
- ACTION_UP: 1;
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 const ActionType: {
41
+ readonly ACTION_DOWN: 0;
42
+ readonly ACTION_MOVE: 2;
43
+ readonly ACTION_UP: 1;
44
+ };
15
45
  export type ActionType = typeof ActionType[keyof typeof ActionType];
16
46
  export declare const StreamRotation: {
17
47
  readonly ROTATION_0: 0;
@@ -44,6 +74,13 @@ export declare class InputData {
44
74
  text: string;
45
75
  constructor(text: string);
46
76
  }
77
+ /**
78
+ * WheelData - 鼠标滚动事件
79
+ */
80
+ export declare class WheelData {
81
+ axis: number;
82
+ constructor(axis: number);
83
+ }
47
84
  /**
48
85
  * KeyEventData - 键盘事件数据类,包含键码及修饰状态
49
86
  */
@@ -52,6 +89,13 @@ export declare class KeyEventData {
52
89
  meta: number;
53
90
  constructor(keyCode: number, meta: number);
54
91
  }
92
+ /**
93
+ * GestureData - 导航模式
94
+ */
95
+ export declare class GestureData {
96
+ mode: number;
97
+ constructor(mode: number);
98
+ }
55
99
  export declare class ChannelData {
56
100
  type: ChannelDataType;
57
101
  data: string | null;
@@ -68,22 +112,33 @@ export declare class ChannelData {
68
112
  * 生成点击数据
69
113
  * @param touchData 触摸数据,可以是任意类型
70
114
  */
71
- static click(touchData: unknown): ChannelData;
115
+ static click(touchData: any): ChannelData;
116
+ static action(actionData: any): ChannelData;
72
117
  /**
73
118
  * 生成剪贴板数据
74
119
  * @param data 剪贴板数据,可以是字符串或其他类型
75
120
  */
76
- static clipboard(data: unknown): ChannelData;
121
+ static clipboard(data: any): ChannelData;
77
122
  /**
78
123
  * 生成输入数据
79
124
  * @param data 输入数据对象
80
125
  */
81
- static input(data: unknown): ChannelData;
126
+ static input(data: any): ChannelData;
127
+ /**
128
+ * 生成鼠标滚动数据
129
+ * @param data 输入数据对象
130
+ */
131
+ static wheel(data: any): ChannelData;
132
+ /**
133
+ * 切换手势模式数据
134
+ * @param data 输入数据对象
135
+ */
136
+ static gesture(data: any): ChannelData;
82
137
  /**
83
138
  * 生成中文输入数据
84
139
  * @param data 中文输入数据
85
140
  */
86
- static chinese(data: unknown): ChannelData;
141
+ static chinese(data: any): ChannelData;
87
142
  /**
88
143
  * 生成请求云设备信息数据
89
144
  */
@@ -92,7 +147,7 @@ export declare class ChannelData {
92
147
  * 生成清晰度数据(clarity)
93
148
  * @param data 清晰度数据
94
149
  */
95
- static clarity(data: unknown): ChannelData;
150
+ static clarity(data: any): ChannelData;
96
151
  }
97
152
  export interface RTCStatsReportExtended extends RTCStatsReport {
98
153
  get(id: string): RTCStats | undefined;
@@ -110,4 +165,5 @@ export interface CloudStatusPayload {
110
165
  direction: number;
111
166
  screenWidth: number;
112
167
  screenHeight: number;
168
+ gestureMode: number;
113
169
  }
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
- import { ChannelDataType } from '../data/WebRTCDataType';
3
2
  import type { WebRTCConfig } from "./WebRTCConfig.ts";
3
+ import { ChannelDataType } from "../data/WebrtcDataType.ts";
4
4
  export declare class WebRTCClient extends EventEmitter {
5
- private config;
5
+ private readonly config;
6
6
  private peerConnection;
7
7
  private localStream;
8
8
  private isPushingStream;
@@ -14,16 +14,15 @@ export declare class WebRTCClient extends EventEmitter {
14
14
  private lastPacketsReceived;
15
15
  private lostPacketCount;
16
16
  private maxLostRate;
17
- private decodedCount;
18
17
  private lastSecondDecodedCount;
19
18
  constructor(config: WebRTCConfig);
20
19
  startPush(): Promise<void>;
21
- handleOffer(offerSdp: RTCSessionDescriptionInit): void;
22
- handleAnswer(answerSdp: RTCSessionDescriptionInit): void;
20
+ handleOffer(offerSdp: string): void;
21
+ handleAnswer(answerSdp: string): void;
23
22
  handleIceCandidate(candidate: RTCIceCandidateInit): void;
24
23
  sendChannelData(type: ChannelDataType, data: any): void;
25
24
  closeConnection(): void;
26
- private readyCapture;
25
+ readyCapture(): Promise<void>;
27
26
  private getRotatedStream;
28
27
  private setVideoParams;
29
28
  stopPush(): void;
@@ -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,6 +1,7 @@
1
- import { WebRTCSdk } from './core/WebRTCSdk.ts';
2
- import { getKeyEventData } from "./core/util/KeyCodeUtil.ts";
3
- import { transformCoordinate, valueToPercentage } from "./core/util/ScreenControlUtil.ts";
4
- import { ActionType, ChannelDataType, ContainerDirection, InputData, KeyEventData, TouchData } from "./core/data/WebrtcDataType.ts";
5
- import { EmitType } from "./core/data/WebRtcError.ts";
6
- export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType };
1
+ import { WebRTCSdk } from './core/WebRTCSdk';
2
+ import { getKeyEventData } from "./core/util/KeyCodeUtil";
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";
5
+ import { EmitType } from "./core/data/WebRtcError";
6
+ import RemotePlayer from './components/RemotePlayer/index.vue';
7
+ export { WebRTCSdk, getKeyEventData, transformCoordinate, valueToPercentage, ActionType, ChannelDataType, InputData, KeyEventData, TouchData, ContainerDirection, EmitType, WheelData, GestureData, type ActionCommand, ActionCommandType, RemotePlayer };
@@ -0,0 +1 @@
1
+ .vContainer[data-v-7587342f]{transition:transform .2s linear}.flex[data-v-7587342f]{display:flex}.flex-1[data-v-7587342f]{flex:1 1 0}.items-center[data-v-7587342f]{align-items:center}.justify-center[data-v-7587342f]{justify-content:center}.video-control[data-v-7587342f]{width:100%;height:100%;display:block;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.circle-cursor[data-v-7587342f]{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-7587342f]{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-7587342f]{cursor:default}.no-events[data-v-7587342f]{pointer-events:none!important}