yjz-web-sdk 1.0.11-beta.7 → 1.0.11-beta.8
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/{ScreenControlUtil-Bf1obwOj.js → ScreenControlUtil-hkrPNY6q.js} +30 -7
- package/lib/core/rtc/WebRTCClient.d.ts +2 -0
- package/lib/core/rtc/WebRtcNegotiate.d.ts +1 -1
- package/lib/uni/RemoteCanvasController.d.ts +1 -3
- package/lib/uni-sdk.js +7 -7
- package/lib/yjz-web-sdk.js +6 -2
- package/package.json +1 -1
|
@@ -3306,9 +3306,11 @@ const configPeerConnection = (peerConnection, onICEMessage, onTrack, onConnectSt
|
|
|
3306
3306
|
onTrack == null ? void 0 : onTrack(track);
|
|
3307
3307
|
};
|
|
3308
3308
|
};
|
|
3309
|
-
const setRemoteDescriptionWithHandleAnswer = (peerConnection, sdp2, onError) => {
|
|
3309
|
+
const setRemoteDescriptionWithHandleAnswer = (peerConnection, sdp2, onSuccess, onError) => {
|
|
3310
3310
|
const description = new RTCSessionDescription({ type: "answer", sdp: sdp2 });
|
|
3311
|
-
peerConnection.setRemoteDescription(description).
|
|
3311
|
+
peerConnection.setRemoteDescription(description).then(() => {
|
|
3312
|
+
onSuccess == null ? void 0 : onSuccess();
|
|
3313
|
+
}).catch((err) => onError == null ? void 0 : onError(createWebRtcError(FailCode.REMOTE_DES, err)));
|
|
3312
3314
|
};
|
|
3313
3315
|
const createOffer = async (peerConnection, sendOfferMessage) => {
|
|
3314
3316
|
try {
|
|
@@ -3587,6 +3589,8 @@ class WebRTCClient extends EventEmitter {
|
|
|
3587
3589
|
__publicField(this, "rafId", 0);
|
|
3588
3590
|
__publicField(this, "currentMedia", null);
|
|
3589
3591
|
__publicField(this, "fileImage");
|
|
3592
|
+
__publicField(this, "reConnectTimer", null);
|
|
3593
|
+
__publicField(this, "canPushStream", false);
|
|
3590
3594
|
__publicField(this, "startPushLocal", async (file) => {
|
|
3591
3595
|
if (this.isPushingLocalStream || !file) return;
|
|
3592
3596
|
try {
|
|
@@ -3638,7 +3642,16 @@ class WebRTCClient extends EventEmitter {
|
|
|
3638
3642
|
}, (err) => this.emit(EmitType.webrtcError, err));
|
|
3639
3643
|
}
|
|
3640
3644
|
handleAnswer(answerSdp) {
|
|
3641
|
-
setRemoteDescriptionWithHandleAnswer(this.peerConnection, answerSdp ?? "", (
|
|
3645
|
+
setRemoteDescriptionWithHandleAnswer(this.peerConnection, answerSdp ?? "", () => {
|
|
3646
|
+
this.canPushStream = true;
|
|
3647
|
+
}, (_err) => {
|
|
3648
|
+
this.canPushStream = false;
|
|
3649
|
+
this.reConnectTimer = setTimeout(async () => {
|
|
3650
|
+
await createOffer(this.peerConnection, (sdp2) => {
|
|
3651
|
+
this.emit(EmitType.sendOffer, sdp2);
|
|
3652
|
+
});
|
|
3653
|
+
}, 3e3);
|
|
3654
|
+
});
|
|
3642
3655
|
}
|
|
3643
3656
|
handleIceCandidate(candidate) {
|
|
3644
3657
|
addIceCandidate(this.peerConnection, candidate, (err) => this.emit(EmitType.webrtcError, err));
|
|
@@ -3724,6 +3737,10 @@ class WebRTCClient extends EventEmitter {
|
|
|
3724
3737
|
(_a2 = transceiver.stop) == null ? void 0 : _a2.call(transceiver);
|
|
3725
3738
|
});
|
|
3726
3739
|
}
|
|
3740
|
+
if (this.reConnectTimer) {
|
|
3741
|
+
clearTimeout(this.reConnectTimer);
|
|
3742
|
+
this.reConnectTimer = null;
|
|
3743
|
+
}
|
|
3727
3744
|
this.removeAllListeners();
|
|
3728
3745
|
(_a = this.videoDataChannel) == null ? void 0 : _a.close();
|
|
3729
3746
|
this.videoDataChannel = null;
|
|
@@ -3756,6 +3773,11 @@ class WebRTCClient extends EventEmitter {
|
|
|
3756
3773
|
});
|
|
3757
3774
|
this.rotatedStream = await this.getRotatedStream(this.localStream, useBackCamera);
|
|
3758
3775
|
await this.onConnected();
|
|
3776
|
+
if (!this.canPushStream) {
|
|
3777
|
+
await createOffer(this.peerConnection, (sdp2) => {
|
|
3778
|
+
this.emit(EmitType.sendOffer, sdp2);
|
|
3779
|
+
});
|
|
3780
|
+
}
|
|
3759
3781
|
} catch (err) {
|
|
3760
3782
|
if (err instanceof DOMException) {
|
|
3761
3783
|
switch (err.name) {
|
|
@@ -3794,6 +3816,11 @@ class WebRTCClient extends EventEmitter {
|
|
|
3794
3816
|
const rotatedStream = await this.getRotatedStream(this.localStream, useBackCamera);
|
|
3795
3817
|
this.rotatedStream = rotatedStream;
|
|
3796
3818
|
await this.onConnected();
|
|
3819
|
+
if (!this.canPushStream) {
|
|
3820
|
+
await createOffer(this.peerConnection, (sdp2) => {
|
|
3821
|
+
this.emit(EmitType.sendOffer, sdp2);
|
|
3822
|
+
});
|
|
3823
|
+
}
|
|
3797
3824
|
} catch (err) {
|
|
3798
3825
|
this.isPushingStream = false;
|
|
3799
3826
|
if (err instanceof DOMException) {
|
|
@@ -3922,9 +3949,6 @@ class WebRTCClient extends EventEmitter {
|
|
|
3922
3949
|
this.emit(EmitType.iceConnectionState, state);
|
|
3923
3950
|
if (state === "connected") {
|
|
3924
3951
|
this.checkStats();
|
|
3925
|
-
await createOffer(this.peerConnection, (sdp2) => {
|
|
3926
|
-
this.emit(EmitType.sendOffer, sdp2);
|
|
3927
|
-
});
|
|
3928
3952
|
}
|
|
3929
3953
|
}, (err) => this.emit(EmitType.webrtcError, err));
|
|
3930
3954
|
this.configDataChannel();
|
|
@@ -3955,7 +3979,6 @@ class WebRTCClient extends EventEmitter {
|
|
|
3955
3979
|
const data = JSON.parse(event.data);
|
|
3956
3980
|
if (data.type === ChannelDataType.ActionCommandEvent) {
|
|
3957
3981
|
const { action, value, cameraId } = JSON.parse(data.data);
|
|
3958
|
-
console.error("data===>", data.data);
|
|
3959
3982
|
if (action === "ACTION_CONTROL_VIDEO") {
|
|
3960
3983
|
if (value === "ENABLE") {
|
|
3961
3984
|
if (this.isPushingStream) {
|
|
@@ -26,6 +26,8 @@ export declare class WebRTCClient extends EventEmitter {
|
|
|
26
26
|
private rafId;
|
|
27
27
|
private currentMedia;
|
|
28
28
|
private fileImage?;
|
|
29
|
+
private reConnectTimer;
|
|
30
|
+
private canPushStream;
|
|
29
31
|
constructor(config: WebRTCConfig);
|
|
30
32
|
startPush(useBackCamera?: boolean): Promise<void>;
|
|
31
33
|
handleOffer(offerSdp: string): void;
|
|
@@ -3,7 +3,7 @@ import { WebRTCConfig } from "./WebRTCConfig.ts";
|
|
|
3
3
|
export declare const setRemoteDescriptionWithHandleOffer: (peerConnection: RTCPeerConnection, sdp: string, sendAnswer?: (sdp: string) => void, onError?: (err: WebRtcError) => void) => void;
|
|
4
4
|
export declare const createPeerConnection: (config: WebRTCConfig) => RTCPeerConnection;
|
|
5
5
|
export declare const configPeerConnection: (peerConnection: RTCPeerConnection, onICEMessage: (candidate: string) => void, onTrack?: (track: MediaStreamTrack) => void, onConnectState?: (state: RTCIceConnectionState) => void, onError?: (error: WebRtcError) => void) => void;
|
|
6
|
-
export declare const setRemoteDescriptionWithHandleAnswer: (peerConnection: RTCPeerConnection, sdp: string, onError?: (error: WebRtcError) => void) => void;
|
|
6
|
+
export declare const setRemoteDescriptionWithHandleAnswer: (peerConnection: RTCPeerConnection, sdp: string, onSuccess?: () => void, onError?: (error: WebRtcError) => void) => void;
|
|
7
7
|
export declare const createOffer: (peerConnection: RTCPeerConnection, sendOfferMessage: (sdp: string) => void) => Promise<void>;
|
|
8
8
|
export declare const setLocalDescriptionWithCreateOffer: (peerConnection: RTCPeerConnection, offer: RTCSessionDescriptionInit, sendOfferMessage: (sdp: string) => void) => Promise<void>;
|
|
9
9
|
export declare const addIceCandidate: (peerConnection: RTCPeerConnection, candidate: RTCIceCandidateInit, onError?: (error: WebRtcError) => void) => void;
|
|
@@ -2,9 +2,7 @@ import RemoteControllerBase from "./RemoteControllerBase";
|
|
|
2
2
|
declare class RemoteCanvasController implements RemoteControllerBase {
|
|
3
3
|
remoteElement: HTMLElement | null;
|
|
4
4
|
audioElement?: HTMLAudioElement | null | undefined;
|
|
5
|
-
constructor(
|
|
6
|
-
remoteElement: HTMLElement;
|
|
7
|
-
});
|
|
5
|
+
constructor();
|
|
8
6
|
startDecode(arrayBuffer: ArrayBuffer): void;
|
|
9
7
|
startPlay(track: MediaStreamTrack): void;
|
|
10
8
|
stopPlay(): void;
|
package/lib/uni-sdk.js
CHANGED
|
@@ -10,7 +10,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
10
10
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
11
11
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
12
12
|
var _screenStatus, _isComposing, _direction, _screenWidth, _screenHeight, _clarityLevel, _gestureMode;
|
|
13
|
-
import { W as WheelData, t as transformCoordinate, A as ActionType, v as valueToPercentage, T as TouchData, g as getKeyEventData, I as InputData, i as isFunctionKey, E as EventEmitter, C as ChannelDataType, a as WebRTCSdk, b as EmitType, F as FailCode, c as ContainerDirection, K as KeyEventData, j as ActionCommandEventValue, h as ActionCommandEventType, d as ClarityData, G as GestureData } from "./ScreenControlUtil-
|
|
13
|
+
import { W as WheelData, t as transformCoordinate, A as ActionType, v as valueToPercentage, T as TouchData, g as getKeyEventData, I as InputData, i as isFunctionKey, E as EventEmitter, C as ChannelDataType, a as WebRTCSdk, b as EmitType, F as FailCode, c as ContainerDirection, K as KeyEventData, j as ActionCommandEventValue, h as ActionCommandEventType, d as ClarityData, G as GestureData } from "./ScreenControlUtil-hkrPNY6q.js";
|
|
14
14
|
var DocumentEvent = /* @__PURE__ */ ((DocumentEvent2) => {
|
|
15
15
|
DocumentEvent2["KEY_DOWN"] = "keydown";
|
|
16
16
|
DocumentEvent2["POINTER_ENTER"] = "pointerenter";
|
|
@@ -143,7 +143,7 @@ class RemoteVideoController {
|
|
|
143
143
|
(_a = this.loadedSuccess) == null ? void 0 : _a.call(this);
|
|
144
144
|
});
|
|
145
145
|
this.logger = new Logger({
|
|
146
|
-
prefix: "
|
|
146
|
+
prefix: "RemoteController",
|
|
147
147
|
enabledDebug
|
|
148
148
|
});
|
|
149
149
|
this.rootContainer = rootContainer;
|
|
@@ -241,17 +241,16 @@ class RemoteVideoController {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
destroy() {
|
|
244
|
-
this.logger.log("
|
|
244
|
+
this.logger.log("destroy");
|
|
245
245
|
this.stopPlay();
|
|
246
246
|
this.offEvent();
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
_screenStatus = new WeakMap();
|
|
250
250
|
class RemoteCanvasController {
|
|
251
|
-
constructor(
|
|
252
|
-
__publicField(this, "remoteElement");
|
|
251
|
+
constructor() {
|
|
252
|
+
__publicField(this, "remoteElement", null);
|
|
253
253
|
__publicField(this, "audioElement");
|
|
254
|
-
this.remoteElement = remoteElement;
|
|
255
254
|
}
|
|
256
255
|
startDecode(arrayBuffer) {
|
|
257
256
|
}
|
|
@@ -746,7 +745,7 @@ const _WebRTCWrapper = class _WebRTCWrapper extends EventEmitter {
|
|
|
746
745
|
__privateAdd(this, _clarityLevel);
|
|
747
746
|
__privateAdd(this, _gestureMode);
|
|
748
747
|
this.logger = new Logger({
|
|
749
|
-
prefix: "
|
|
748
|
+
prefix: "Wrapper",
|
|
750
749
|
enabledDebug
|
|
751
750
|
});
|
|
752
751
|
const webRtcSDKInstance = new WebRTCSdk(connectConfig);
|
|
@@ -889,6 +888,7 @@ const _WebRTCWrapper = class _WebRTCWrapper extends EventEmitter {
|
|
|
889
888
|
}
|
|
890
889
|
destroy() {
|
|
891
890
|
var _a;
|
|
891
|
+
this.logger.log("destroy");
|
|
892
892
|
(_a = this.webRtcSDKInstance) == null ? void 0 : _a.stop();
|
|
893
893
|
this.offEvents();
|
|
894
894
|
this.webRtcSDKInstance = null;
|
package/lib/yjz-web-sdk.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
import { A as ActionType, C as ChannelDataType, W as WheelData, t as transformCoordinate, v as valueToPercentage, T as TouchData, I as InputData, i as isFunctionKey, g as getKeyEventData, E as EventEmitter, a as WebRTCSdk, b as EmitType, e as enableLog, s as setLogLevel, K as KeyEventData } from "./ScreenControlUtil-
|
|
6
|
-
import { h, j, f, d, l, c, F, G, k, m } from "./ScreenControlUtil-
|
|
5
|
+
import { A as ActionType, C as ChannelDataType, W as WheelData, t as transformCoordinate, v as valueToPercentage, T as TouchData, I as InputData, i as isFunctionKey, g as getKeyEventData, E as EventEmitter, a as WebRTCSdk, b as EmitType, e as enableLog, s as setLogLevel, K as KeyEventData } from "./ScreenControlUtil-hkrPNY6q.js";
|
|
6
|
+
import { h, j, f, d, l, c, F, G, k, m } from "./ScreenControlUtil-hkrPNY6q.js";
|
|
7
7
|
import { computed, onMounted, onUnmounted, ref, onBeforeUnmount, defineComponent, toRefs, createElementBlock, openBlock, createElementVNode, normalizeStyle, unref, createCommentVNode, normalizeClass } from "vue";
|
|
8
8
|
function useCursorStyle(cursorType) {
|
|
9
9
|
return computed(() => {
|
|
@@ -296,6 +296,7 @@ function useMouseTouchControl(options) {
|
|
|
296
296
|
const handleMouseEnter = (event) => {
|
|
297
297
|
event.preventDefault();
|
|
298
298
|
event.stopPropagation();
|
|
299
|
+
if (event.pointerType !== "mouse") return;
|
|
299
300
|
if (event.buttons === 1 && !pointers.value.has(event.pointerId)) {
|
|
300
301
|
if (remoteVideoElement.value) remoteVideoElement.value.setPointerCapture(event.pointerId);
|
|
301
302
|
handlePointerEvent(event, ActionType.ACTION_DOWN, event.pointerId);
|
|
@@ -304,6 +305,7 @@ function useMouseTouchControl(options) {
|
|
|
304
305
|
const handleMouseLeave = (event) => {
|
|
305
306
|
event.preventDefault();
|
|
306
307
|
event.stopPropagation();
|
|
308
|
+
if (event.pointerType !== "mouse") return;
|
|
307
309
|
if (pointers.value.has(event.pointerId)) {
|
|
308
310
|
handlePointerEvent(event, ActionType.ACTION_UP, event.pointerId);
|
|
309
311
|
if (remoteVideoElement.value) remoteVideoElement.value.releasePointerCapture(event.pointerId);
|
|
@@ -327,6 +329,7 @@ function useMouseTouchControl(options) {
|
|
|
327
329
|
function useKeyboardControl(imeInput, disabled, emit) {
|
|
328
330
|
const isComposing = ref(false);
|
|
329
331
|
const handleKeyDown = (e) => {
|
|
332
|
+
e.preventDefault();
|
|
330
333
|
const data = getKeyEventData(e);
|
|
331
334
|
emit("channelEvent", ChannelDataType.ActionInput, data);
|
|
332
335
|
};
|
|
@@ -372,6 +375,7 @@ function useKeyboardControl(imeInput, disabled, emit) {
|
|
|
372
375
|
function onKeyDown(event) {
|
|
373
376
|
if (isComposing.value) return;
|
|
374
377
|
if (isFunctionKey(event)) {
|
|
378
|
+
event.preventDefault();
|
|
375
379
|
const data = getKeyEventData(event);
|
|
376
380
|
if (data.keyCode === 50 && data.meta === 4096) return;
|
|
377
381
|
emit("channelEvent", ChannelDataType.ActionInput, data);
|