yjz-web-sdk 1.0.0 → 1.0.2
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/components/RemotePlayer/index.vue.d.ts +2 -0
- package/lib/composables/useCursorStyle.d.ts +2 -0
- package/lib/composables/useDeviceMode.d.ts +6 -0
- package/lib/composables/useKeyboardControl.d.ts +6 -0
- package/lib/composables/useMouseTouchControl.d.ts +25 -0
- package/lib/composables/useRemoteVideo.d.ts +12 -0
- package/lib/composables/useResizeObserver.d.ts +3 -0
- package/lib/core/data/{WebRTCDataType.d.ts → WebrtcDataType.d.ts} +24 -11
- package/lib/core/rtc/WebRTCClient.d.ts +5 -6
- package/lib/index.d.ts +7 -6
- package/lib/yjz-web-sdk.css +1 -0
- package/lib/yjz-web-sdk.js +628 -188
- package/lib/yjz-web-sdk.umd.cjs +44 -31
- package/package.json +3 -1
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
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
|
+
};
|
|
@@ -5,13 +5,14 @@ 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"
|
|
9
10
|
}
|
|
10
|
-
export declare const ActionType:
|
|
11
|
-
ACTION_DOWN: 0;
|
|
12
|
-
ACTION_MOVE: 2;
|
|
13
|
-
ACTION_UP: 1;
|
|
14
|
-
}
|
|
11
|
+
export declare const ActionType: {
|
|
12
|
+
readonly ACTION_DOWN: 0;
|
|
13
|
+
readonly ACTION_MOVE: 2;
|
|
14
|
+
readonly ACTION_UP: 1;
|
|
15
|
+
};
|
|
15
16
|
export type ActionType = typeof ActionType[keyof typeof ActionType];
|
|
16
17
|
export declare const StreamRotation: {
|
|
17
18
|
readonly ROTATION_0: 0;
|
|
@@ -44,6 +45,13 @@ export declare class InputData {
|
|
|
44
45
|
text: string;
|
|
45
46
|
constructor(text: string);
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* WheelData - 鼠标滚动事件
|
|
50
|
+
*/
|
|
51
|
+
export declare class WheelData {
|
|
52
|
+
axis: number;
|
|
53
|
+
constructor(axis: number);
|
|
54
|
+
}
|
|
47
55
|
/**
|
|
48
56
|
* KeyEventData - 键盘事件数据类,包含键码及修饰状态
|
|
49
57
|
*/
|
|
@@ -68,22 +76,27 @@ export declare class ChannelData {
|
|
|
68
76
|
* 生成点击数据
|
|
69
77
|
* @param touchData 触摸数据,可以是任意类型
|
|
70
78
|
*/
|
|
71
|
-
static click(touchData:
|
|
79
|
+
static click(touchData: any): ChannelData;
|
|
72
80
|
/**
|
|
73
81
|
* 生成剪贴板数据
|
|
74
82
|
* @param data 剪贴板数据,可以是字符串或其他类型
|
|
75
83
|
*/
|
|
76
|
-
static clipboard(data:
|
|
84
|
+
static clipboard(data: any): ChannelData;
|
|
77
85
|
/**
|
|
78
86
|
* 生成输入数据
|
|
79
87
|
* @param data 输入数据对象
|
|
80
88
|
*/
|
|
81
|
-
static input(data:
|
|
89
|
+
static input(data: any): ChannelData;
|
|
90
|
+
/**
|
|
91
|
+
* 生成鼠标滚动数据
|
|
92
|
+
* @param data 输入数据对象
|
|
93
|
+
*/
|
|
94
|
+
static wheel(data: any): ChannelData;
|
|
82
95
|
/**
|
|
83
96
|
* 生成中文输入数据
|
|
84
97
|
* @param data 中文输入数据
|
|
85
98
|
*/
|
|
86
|
-
static chinese(data:
|
|
99
|
+
static chinese(data: any): ChannelData;
|
|
87
100
|
/**
|
|
88
101
|
* 生成请求云设备信息数据
|
|
89
102
|
*/
|
|
@@ -92,7 +105,7 @@ export declare class ChannelData {
|
|
|
92
105
|
* 生成清晰度数据(clarity)
|
|
93
106
|
* @param data 清晰度数据
|
|
94
107
|
*/
|
|
95
|
-
static clarity(data:
|
|
108
|
+
static clarity(data: any): ChannelData;
|
|
96
109
|
}
|
|
97
110
|
export interface RTCStatsReportExtended extends RTCStatsReport {
|
|
98
111
|
get(id: string): RTCStats | undefined;
|
|
@@ -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:
|
|
22
|
-
handleAnswer(answerSdp:
|
|
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
|
-
|
|
25
|
+
readyCapture(): Promise<void>;
|
|
27
26
|
private getRotatedStream;
|
|
28
27
|
private setVideoParams;
|
|
29
28
|
stopPush(): void;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 } from "./core/data/WebrtcDataType
|
|
5
|
-
import { EmitType } from "./core/data/WebRtcError
|
|
6
|
-
|
|
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 } 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, RemotePlayer };
|
|
@@ -0,0 +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}
|