yjz-web-sdk 1.0.11-beta.1 → 1.0.11-beta.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,10 @@
1
- import { ChannelDataType } from "../core/data/WebrtcDataType.ts";
1
+ import { ChannelDataType } from "../core/data/WebrtcDataType";
2
2
  import { type Ref } from "vue";
3
- export default function useKeyboardControl(disabled: Ref<boolean>, emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void): {
3
+ export default function useKeyboardControl(imeInput: Ref<HTMLTextAreaElement | null>, disabled: Ref<boolean>, emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void): {
4
4
  startListening: () => void;
5
5
  stopListening: () => void;
6
+ onCompositionStart: (_e: CompositionEvent) => void;
7
+ onCompositionEnd: (e: CompositionEvent) => void;
8
+ onInput: (e: InputEvent) => void;
9
+ onKeyDown: (event: KeyboardEvent) => void;
6
10
  };
@@ -1,5 +1,5 @@
1
1
  import type { Ref } from 'vue';
2
- import { ChannelDataType } from "../core/data/WebrtcDataType.ts";
2
+ import { ChannelDataType } from "../core/data/WebrtcDataType";
3
3
  import type { Dimension } from "../components/RemotePlayer/index.ts";
4
4
  interface MouseTouchControlOptions {
5
5
  remoteVideoElement: Ref<HTMLVideoElement | null>;
@@ -8,14 +8,15 @@ interface MouseTouchControlOptions {
8
8
  videoAngle: Ref<number>;
9
9
  widthRadio: Ref<number>;
10
10
  isGroup: Ref<boolean>;
11
+ isMove: Ref<boolean>;
11
12
  emit: (event: 'channelEvent', payload: ChannelDataType, data: any) => void;
12
13
  }
13
14
  export default function useMouseTouchControl(options: MouseTouchControlOptions): {
14
- isPointerDown: any;
15
+ pointers: any;
15
16
  handleMouseDown: (event: PointerEvent) => void;
16
17
  handleMouseMove: (event: PointerEvent) => void;
17
- handleMouseEnter: (event: PointerEvent) => void;
18
18
  handleMouseUp: (event: PointerEvent) => void;
19
+ handleMouseEnter: (event: PointerEvent) => void;
19
20
  handleMouseLeave: (event: PointerEvent) => void;
20
21
  handleWheel: (e: WheelEvent) => void;
21
22
  };
@@ -12,8 +12,6 @@ export declare class WebRTCSdk extends EventEmitter {
12
12
  options: WebRTCConfigOptions;
13
13
  isConnected: boolean;
14
14
  isConnecting: boolean;
15
- private connectCount;
16
- private MAX_COUNT;
17
15
  private timeout;
18
16
  constructor(options: WebRTCConfigOptions);
19
17
  initConfig(): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
- import type { WebRTCConfig } from "./WebRTCConfig.ts";
3
- import { ChannelDataType } from "../data/WebrtcDataType.ts";
2
+ import type { WebRTCConfig } from "./WebRTCConfig";
3
+ import { ChannelDataType } from "../data/WebrtcDataType";
4
4
  export declare class WebRTCClient extends EventEmitter {
5
5
  private readonly config;
6
6
  private peerConnection;
@@ -9,6 +9,7 @@ export declare class WebRTCClient extends EventEmitter {
9
9
  private isPushingStream;
10
10
  private isPushingLocalStream;
11
11
  private dataChannel;
12
+ private videoDataChannel;
12
13
  private statsTimer;
13
14
  private lastReportTime;
14
15
  private lastBytesReceived;
@@ -18,6 +19,8 @@ export declare class WebRTCClient extends EventEmitter {
18
19
  private maxLostRate;
19
20
  private lastSecondDecodedCount;
20
21
  private fileVideo?;
22
+ private videoTransceiver?;
23
+ private audioTransceiver?;
21
24
  private canvas?;
22
25
  private canvasStream;
23
26
  private rafId;
@@ -37,8 +40,9 @@ export declare class WebRTCClient extends EventEmitter {
37
40
  switchCamera(useBackCamera: boolean): Promise<void>;
38
41
  private getRotatedStream;
39
42
  private setVideoParams;
40
- stopPush(): void;
43
+ stopPush(): Promise<void>;
41
44
  private resetPeerConnection;
45
+ private onConnected;
42
46
  private configDataChannel;
43
47
  private handleDataChannelMessage;
44
48
  private checkStats;
@@ -14,3 +14,9 @@ export interface KeyEventData {
14
14
  * @returns 包含 androidKeyCode 和 metaState 的对象
15
15
  */
16
16
  export declare const getKeyEventData: (event: KeyboardEvent) => KeyEventData;
17
+ /**
18
+ * 判断当前按键是否属于功能键
19
+ * @param event - 浏览器 KeyboardEvent
20
+ * @returns true 表示是功能键
21
+ */
22
+ export declare const isFunctionKey: (event: KeyboardEvent) => boolean;
@@ -1,8 +1,8 @@
1
- !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".vContainer[data-v-611728c2]{transition:transform .2s linear;transform-origin:center center;margin:0;overflow:hidden;transform:translateZ(0);will-change:transform}.flex[data-v-611728c2]{display:flex}.flex-1[data-v-611728c2]{flex:1 1 0}.items-center[data-v-611728c2]{align-items:center}.justify-center[data-v-611728c2]{justify-content:center}.video-control[data-v-611728c2]{width:100%;height:100%;display:block;-webkit-user-select:none;user-select:none;object-fit:cover;clip-path:inset(0 1px);-webkit-user-drag:none;touch-action:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform:translateZ(0)}.circle-cursor[data-v-611728c2]{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-611728c2]{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-611728c2]{cursor:default}.no-events[data-v-611728c2]{pointer-events:none!important}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
1
+ !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".vContainer[data-v-ae395fc8]{transition:transform .2s linear;transform-origin:center center;margin:0;overflow:hidden;background:transparent;transform:translateZ(0);will-change:transform}.flex[data-v-ae395fc8]{display:flex}.flex-1[data-v-ae395fc8]{flex:1 1 0}.items-center[data-v-ae395fc8]{align-items:center}.justify-center[data-v-ae395fc8]{justify-content:center}.video-control[data-v-ae395fc8]{width:100%;height:100%;display:block;-webkit-user-select:none;user-select:none;object-fit:cover;background:transparent;clip-path:inset(0 1px);-webkit-user-drag:none;touch-action:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform:translateZ(0)}.circle-cursor[data-v-ae395fc8]{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-ae395fc8]{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-ae395fc8]{cursor:default}.no-events[data-v-ae395fc8]{pointer-events:none!important}.ime-input[data-v-ae395fc8]{position:absolute;opacity:0;right:0;bottom:0;width:1px;height:1px;border:none;outline:none;resize:none;z-index:-1}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
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 { computed, onMounted, onUnmounted, ref, onBeforeUnmount, defineComponent, toRefs, createElementBlock, openBlock, createElementVNode, normalizeStyle, unref, normalizeClass } from "vue";
5
+ import { computed, onMounted, onUnmounted, ref, onBeforeUnmount, defineComponent, toRefs, createElementBlock, openBlock, createElementVNode, normalizeStyle, unref, createCommentVNode, normalizeClass } from "vue";
6
6
  function _mergeNamespaces(n, m) {
7
7
  for (var i = 0; i < m.length; i++) {
8
8
  const e = m[i];
@@ -3571,7 +3571,6 @@ const formattedTime = (timestamp) => {
3571
3571
  return `${h}:${m}:${s}.${ms}`;
3572
3572
  };
3573
3573
  class WebRTCClient extends EventEmitter {
3574
- // private isFireFox: boolean = false;
3575
3574
  constructor(config) {
3576
3575
  super();
3577
3576
  __publicField(this, "config");
@@ -3581,6 +3580,7 @@ class WebRTCClient extends EventEmitter {
3581
3580
  __publicField(this, "isPushingStream", false);
3582
3581
  __publicField(this, "isPushingLocalStream", false);
3583
3582
  __publicField(this, "dataChannel", null);
3583
+ __publicField(this, "videoDataChannel", null);
3584
3584
  __publicField(this, "statsTimer");
3585
3585
  __publicField(this, "lastReportTime", 0);
3586
3586
  __publicField(this, "lastBytesReceived", 0);
@@ -3590,27 +3590,19 @@ class WebRTCClient extends EventEmitter {
3590
3590
  __publicField(this, "maxLostRate", 0);
3591
3591
  __publicField(this, "lastSecondDecodedCount", 0);
3592
3592
  __publicField(this, "fileVideo");
3593
+ __publicField(this, "videoTransceiver");
3594
+ __publicField(this, "audioTransceiver");
3593
3595
  __publicField(this, "canvas");
3594
3596
  __publicField(this, "canvasStream", null);
3595
3597
  __publicField(this, "rafId", 0);
3596
3598
  __publicField(this, "currentMedia", null);
3597
3599
  __publicField(this, "fileImage");
3598
3600
  __publicField(this, "startPushLocal", async (file) => {
3599
- var _a;
3600
3601
  if (this.isPushingLocalStream || !file) return;
3601
3602
  try {
3602
3603
  await this.loadMedia(file);
3603
- this.startCanvasStream();
3604
- const senders = [];
3605
- (_a = this.canvasStream) == null ? void 0 : _a.getTracks().forEach((track) => {
3606
- track.contentHint = "detail";
3607
- const sender = this.peerConnection.addTrack(track, this.canvasStream);
3608
- senders.push(sender);
3609
- });
3610
- senders.forEach((sender) => this.setVideoParams(sender));
3611
- await createOffer(this.peerConnection, (sdp2) => {
3612
- this.emit(EmitType.sendOffer, sdp2);
3613
- });
3604
+ this.rotatedStream = this.startCanvasStream();
3605
+ await this.onConnected();
3614
3606
  this.isPushingLocalStream = true;
3615
3607
  } catch (err) {
3616
3608
  this.isPushingLocalStream = false;
@@ -3711,6 +3703,7 @@ class WebRTCClient extends EventEmitter {
3711
3703
  }
3712
3704
  }
3713
3705
  closeConnection() {
3706
+ var _a, _b;
3714
3707
  Logger.info("信息日志:", "关闭webrtc连接=======>");
3715
3708
  if (this.statsTimer) {
3716
3709
  clearInterval(this.statsTimer);
@@ -3721,27 +3714,30 @@ class WebRTCClient extends EventEmitter {
3721
3714
  if (this.peerConnection) {
3722
3715
  if (typeof this.peerConnection.getSenders === "function" && this.peerConnection.getSenders) {
3723
3716
  this.peerConnection.getSenders().forEach((sender) => {
3724
- var _a, _b;
3717
+ var _a2, _b2;
3725
3718
  if (sender.track) {
3726
- (_b = (_a = sender.track).stop) == null ? void 0 : _b.call(_a);
3719
+ (_b2 = (_a2 = sender.track).stop) == null ? void 0 : _b2.call(_a2);
3727
3720
  }
3728
3721
  });
3729
3722
  }
3730
3723
  if (typeof this.peerConnection.getReceivers === "function" && this.peerConnection.getReceivers) {
3731
3724
  this.peerConnection.getReceivers().forEach((receiver) => {
3732
- var _a, _b;
3725
+ var _a2, _b2;
3733
3726
  if (receiver.track) {
3734
- (_b = (_a = receiver.track).stop) == null ? void 0 : _b.call(_a);
3727
+ (_b2 = (_a2 = receiver.track).stop) == null ? void 0 : _b2.call(_a2);
3735
3728
  }
3736
3729
  });
3737
3730
  }
3738
3731
  if (this.peerConnection.getTransceivers) {
3739
3732
  this.peerConnection.getTransceivers().forEach((transceiver) => {
3740
- var _a;
3741
- (_a = transceiver.stop) == null ? void 0 : _a.call(transceiver);
3733
+ var _a2;
3734
+ (_a2 = transceiver.stop) == null ? void 0 : _a2.call(transceiver);
3742
3735
  });
3743
3736
  }
3744
3737
  this.removeAllListeners();
3738
+ (_a = this.videoDataChannel) == null ? void 0 : _a.close();
3739
+ this.videoDataChannel = null;
3740
+ (_b = this.dataChannel) == null ? void 0 : _b.close();
3745
3741
  this.dataChannel = null;
3746
3742
  this.peerConnection.onicecandidate = null;
3747
3743
  this.peerConnection.ontrack = null;
@@ -3756,31 +3752,20 @@ class WebRTCClient extends EventEmitter {
3756
3752
  }
3757
3753
  }
3758
3754
  async readyCapture(useBackCamera) {
3759
- this.resetPeerConnection();
3760
- this.stopPush();
3755
+ await this.resetPeerConnection();
3761
3756
  Logger.info("信息日志:", "启用摄像头推流到云机=======>", useBackCamera);
3762
3757
  try {
3763
3758
  this.localStream = await navigator.mediaDevices.getUserMedia({
3764
3759
  video: {
3765
3760
  width: { ideal: 960 },
3766
- height: { ideal: 720 },
3761
+ height: { ideal: 540 },
3767
3762
  facingMode: useBackCamera ? { ideal: "environment" } : { ideal: "user" },
3768
3763
  frameRate: { ideal: 20, max: 30 }
3769
3764
  },
3770
3765
  audio: true
3771
3766
  });
3772
- const senders = [];
3773
- const rotatedStream = await this.getRotatedStream(this.localStream, useBackCamera);
3774
- this.rotatedStream = rotatedStream;
3775
- rotatedStream.getTracks().forEach((track) => {
3776
- track.contentHint = "motion";
3777
- const sender = this.peerConnection.addTrack(track, rotatedStream);
3778
- senders.push(sender);
3779
- });
3780
- await createOffer(this.peerConnection, (sdp2) => {
3781
- this.emit(EmitType.sendOffer, sdp2);
3782
- });
3783
- senders.forEach((sender) => this.setVideoParams(sender));
3767
+ this.rotatedStream = await this.getRotatedStream(this.localStream, useBackCamera);
3768
+ await this.onConnected();
3784
3769
  } catch (err) {
3785
3770
  if (err instanceof DOMException) {
3786
3771
  switch (err.name) {
@@ -3803,27 +3788,22 @@ class WebRTCClient extends EventEmitter {
3803
3788
  * ✅ 切换前后摄像头(无缝)
3804
3789
  */
3805
3790
  async switchCamera(useBackCamera) {
3806
- var _a;
3807
3791
  try {
3808
3792
  Logger.info("信息日志:", `切换摄像头 => ${useBackCamera ? "后置" : "前置"}`);
3809
3793
  this.isPushingStream = true;
3810
3794
  this.localStream = await navigator.mediaDevices.getUserMedia({
3811
3795
  video: {
3812
3796
  width: { ideal: 960 },
3813
- height: { ideal: 720 },
3797
+ height: { ideal: 540 },
3814
3798
  facingMode: useBackCamera ? { ideal: "environment" } : { ideal: "user" },
3815
3799
  frameRate: { ideal: 20, max: 30 }
3816
3800
  },
3817
- audio: false
3801
+ audio: true
3818
3802
  // 音频不需要重新采集
3819
3803
  });
3820
3804
  const rotatedStream = await this.getRotatedStream(this.localStream, useBackCamera);
3821
3805
  this.rotatedStream = rotatedStream;
3822
- const newTrack = this.rotatedStream.getVideoTracks()[0];
3823
- const sender = (_a = this.peerConnection) == null ? void 0 : _a.getSenders().find((s) => s.track && s.track.kind === "video");
3824
- if (sender) {
3825
- await sender.replaceTrack(newTrack);
3826
- }
3806
+ await this.onConnected();
3827
3807
  } catch (err) {
3828
3808
  this.isPushingStream = false;
3829
3809
  if (err instanceof DOMException) {
@@ -3897,18 +3877,6 @@ class WebRTCClient extends EventEmitter {
3897
3877
  });
3898
3878
  return stream;
3899
3879
  }
3900
- // private async setVideoParams(sender: RTCRtpSender) {
3901
- // Logger.info('信息日志:', '设置推流视频参数=======>')
3902
- // const params = sender.getParameters();
3903
- // params.degradationPreference = 'balanced';
3904
- // const isMobile = /Android|iPhone|iPad/i.test(navigator.userAgent);
3905
- // params.encodings.forEach(encoding => {
3906
- // encoding.maxBitrate = isMobile ? 800000 : 1000000;
3907
- // encoding.priority = 'high';
3908
- // encoding.scaleResolutionDownBy = 1.0;
3909
- // });
3910
- // await sender.setParameters(params);
3911
- // }
3912
3880
  async setVideoParams(sender) {
3913
3881
  const params = sender.getParameters();
3914
3882
  const isMobile = /Android|iPhone|iPad/i.test(navigator.userAgent);
@@ -3931,40 +3899,60 @@ class WebRTCClient extends EventEmitter {
3931
3899
  Logger.error("设置推流参数失败:", e);
3932
3900
  }
3933
3901
  }
3934
- stopPush() {
3935
- var _a, _b, _c;
3902
+ async stopPush() {
3903
+ var _a, _b, _c, _d;
3904
+ Logger.info("信息日志:", `停止推流到云机=======>${this.isPushingStream}`);
3936
3905
  if (!this.isPushingStream) return;
3937
3906
  this.isPushingStream = false;
3938
- Logger.info("信息日志:", "停止推流到云机=======>");
3939
3907
  (_a = this.localStream) == null ? void 0 : _a.getTracks().forEach((track) => track.stop());
3940
3908
  this.localStream = null;
3941
3909
  (_b = this.rotatedStream) == null ? void 0 : _b.getTracks().forEach((track) => track.stop());
3942
3910
  this.rotatedStream = null;
3943
- (_c = this.peerConnection) == null ? void 0 : _c.getSenders().forEach((sender) => {
3944
- var _a2;
3945
- try {
3946
- (_a2 = this.peerConnection) == null ? void 0 : _a2.removeTrack(sender);
3947
- } catch (e) {
3948
- console.warn("removeTrack error:", e);
3949
- }
3950
- });
3911
+ if ((_c = this.videoTransceiver) == null ? void 0 : _c.sender) {
3912
+ await this.videoTransceiver.sender.replaceTrack(null);
3913
+ }
3914
+ if ((_d = this.audioTransceiver) == null ? void 0 : _d.sender) {
3915
+ await this.audioTransceiver.sender.replaceTrack(null);
3916
+ }
3951
3917
  }
3952
- resetPeerConnection() {
3918
+ async resetPeerConnection() {
3953
3919
  if (!this.peerConnection) {
3954
3920
  this.peerConnection = createPeerConnection(this.config);
3921
+ this.videoTransceiver = this.peerConnection.addTransceiver("video", {
3922
+ direction: "sendrecv"
3923
+ });
3924
+ this.audioTransceiver = this.peerConnection.addTransceiver("audio", {
3925
+ direction: "sendrecv"
3926
+ });
3955
3927
  configPeerConnection(this.peerConnection, (candidate) => {
3956
3928
  this.emit(EmitType.sendICEMessage, candidate);
3957
3929
  }, (track) => {
3958
3930
  this.emit(EmitType.streamTrack, track);
3959
- }, (state) => {
3931
+ }, async (state) => {
3960
3932
  this.emit(EmitType.iceConnectionState, state);
3961
3933
  if (state === "connected") {
3962
3934
  this.checkStats();
3935
+ await createOffer(this.peerConnection, (sdp2) => {
3936
+ this.emit(EmitType.sendOffer, sdp2);
3937
+ });
3963
3938
  }
3964
3939
  }, (err) => this.emit(EmitType.webrtcError, err));
3965
3940
  this.configDataChannel();
3966
3941
  }
3967
3942
  }
3943
+ async onConnected() {
3944
+ var _a, _b;
3945
+ Logger.info("信息日志:", "WebRTC connected,启用轨道");
3946
+ if (this.rotatedStream && ((_a = this.videoTransceiver) == null ? void 0 : _a.sender)) {
3947
+ const videoTrack = this.rotatedStream.getVideoTracks()[0];
3948
+ await this.videoTransceiver.sender.replaceTrack(videoTrack);
3949
+ await this.setVideoParams(this.videoTransceiver.sender);
3950
+ }
3951
+ if (this.localStream && ((_b = this.audioTransceiver) == null ? void 0 : _b.sender)) {
3952
+ const audioTrack = this.localStream.getAudioTracks()[0];
3953
+ await this.audioTransceiver.sender.replaceTrack(audioTrack);
3954
+ }
3955
+ }
3968
3956
  configDataChannel() {
3969
3957
  this.peerConnection.ondatachannel = (event) => {
3970
3958
  this.dataChannel = event.channel;
@@ -3973,19 +3961,19 @@ class WebRTCClient extends EventEmitter {
3973
3961
  this.sendChannelData(ChannelDataType.ActionRequestCloudDeviceInfo, "");
3974
3962
  };
3975
3963
  }
3976
- handleDataChannelMessage(event) {
3964
+ async handleDataChannelMessage(event) {
3977
3965
  const data = JSON.parse(event.data);
3978
3966
  if (data.type === ChannelDataType.ActionCommandEvent) {
3979
3967
  const { action, value, cameraId } = JSON.parse(data.data);
3980
3968
  if (action === "ACTION_CONTROL_VIDEO") {
3981
3969
  if (value === "ENABLE") {
3982
3970
  if (this.isPushingStream) {
3983
- this.switchCamera(Number(cameraId) === 0);
3971
+ await this.switchCamera(Number(cameraId) === 0);
3984
3972
  } else {
3985
- this.startPush(Number(cameraId) === 0);
3973
+ await this.startPush(Number(cameraId) === 0);
3986
3974
  }
3987
3975
  } else {
3988
- this.stopPush();
3976
+ await this.stopPush();
3989
3977
  this.stopLocal();
3990
3978
  }
3991
3979
  }
@@ -4133,8 +4121,7 @@ class WebRTCClient extends EventEmitter {
4133
4121
  }
4134
4122
  if (kind === "video") {
4135
4123
  return new Promise((resolve, reject) => {
4136
- const url = URL.createObjectURL(file);
4137
- video.src = url;
4124
+ video.src = URL.createObjectURL(file);
4138
4125
  video.onloadedmetadata = () => resolve();
4139
4126
  video.onerror = () => reject(new Error(`视频文件加载失败: ${file.name}`));
4140
4127
  video.play().catch((err) => reject(new Error(`视频播放失败: ${err}`)));
@@ -4142,8 +4129,7 @@ class WebRTCClient extends EventEmitter {
4142
4129
  });
4143
4130
  } else if (kind === "image") {
4144
4131
  return new Promise((resolve, reject) => {
4145
- const url = URL.createObjectURL(file);
4146
- img.src = url;
4132
+ img.src = URL.createObjectURL(file);
4147
4133
  img.onload = () => resolve();
4148
4134
  img.onerror = () => reject(new Error(`图片文件加载失败: ${file.name}`));
4149
4135
  this.currentMedia = img;
@@ -4209,20 +4195,12 @@ class WebRTCClient extends EventEmitter {
4209
4195
  }
4210
4196
  /** 停止推流并释放资源 */
4211
4197
  stopLocal() {
4212
- var _a, _b;
4198
+ var _a;
4213
4199
  if (!this.isPushingLocalStream) return;
4214
4200
  this.isPushingLocalStream = false;
4215
4201
  cancelAnimationFrame(this.rafId);
4216
4202
  (_a = this.canvasStream) == null ? void 0 : _a.getTracks().forEach((track) => track.stop());
4217
4203
  this.canvasStream = null;
4218
- (_b = this.peerConnection) == null ? void 0 : _b.getSenders().forEach((sender) => {
4219
- var _a2;
4220
- try {
4221
- (_a2 = this.peerConnection) == null ? void 0 : _a2.removeTrack(sender);
4222
- } catch (e) {
4223
- Logger.error("错误日志:", `移除音视频轨道失败=====>`, e);
4224
- }
4225
- });
4226
4204
  if (this.fileVideo) {
4227
4205
  this.fileVideo.pause();
4228
4206
  this.fileVideo.src = "";
@@ -4320,8 +4298,8 @@ class WebRTCSdk extends EventEmitter {
4320
4298
  __publicField(this, "options");
4321
4299
  __publicField(this, "isConnected", false);
4322
4300
  __publicField(this, "isConnecting", false);
4323
- __publicField(this, "connectCount", 0);
4324
- __publicField(this, "MAX_COUNT", 1);
4301
+ // private connectCount: number = 0
4302
+ // private MAX_COUNT: number = 1
4325
4303
  __publicField(this, "timeout", null);
4326
4304
  /**
4327
4305
  * 处理 signal 消息,根据不同消息类型分发到 webRTCClient 或直接触发 SDK 事件
@@ -4489,9 +4467,6 @@ class WebRTCSdk extends EventEmitter {
4489
4467
  }
4490
4468
  }
4491
4469
  }
4492
- if (this.options.maxRecount) {
4493
- this.MAX_COUNT = this.options.maxRecount;
4494
- }
4495
4470
  }
4496
4471
  async initConfig() {
4497
4472
  var _a, _b;
@@ -4611,14 +4586,8 @@ class WebRTCSdk extends EventEmitter {
4611
4586
  (clipData) => this.emit(EmitType.cloudClipData, clipData)
4612
4587
  );
4613
4588
  (_h = this.webRTCClient) == null ? void 0 : _h.on(EmitType.webrtcError, (err) => {
4614
- if (err.code === FailCode.ICE_STATE && this.connectCount < this.MAX_COUNT && this.isConnected) {
4615
- this.connectCount++;
4616
- this.emit(EmitType.reconnect);
4617
- this.reconnect();
4618
- } else {
4619
- Logger.error("错误信息:", `sdk调试错误日志======>`, err);
4620
- this.emit(EmitType.webrtcError, err);
4621
- }
4589
+ Logger.error("错误信息:", `sdk调试错误日志======>`, err);
4590
+ this.emit(EmitType.webrtcError, err);
4622
4591
  });
4623
4592
  (_i = this.webRTCClient) == null ? void 0 : _i.on(EmitType.cameraError, (err) => {
4624
4593
  this.emit(EmitType.cameraError, err);
@@ -4676,7 +4645,6 @@ class WebRTCSdk extends EventEmitter {
4676
4645
  this.signalingClient = null;
4677
4646
  this.webRTCClient = null;
4678
4647
  this.config = null;
4679
- this.connectCount = 0;
4680
4648
  this.isConnected = false;
4681
4649
  this.isConnecting = false;
4682
4650
  }
@@ -4945,6 +4913,61 @@ const getKeyEventData = (event) => {
4945
4913
  meta
4946
4914
  };
4947
4915
  };
4916
+ const FunctionKeys = /* @__PURE__ */ new Set([
4917
+ // 方向键
4918
+ "ArrowUp",
4919
+ "ArrowDown",
4920
+ "ArrowLeft",
4921
+ "ArrowRight",
4922
+ // 编辑键
4923
+ "Backspace",
4924
+ "Delete",
4925
+ "Enter",
4926
+ "Tab",
4927
+ "Escape",
4928
+ "Space",
4929
+ // 修饰键
4930
+ "ShiftLeft",
4931
+ "ShiftRight",
4932
+ "ControlLeft",
4933
+ "ControlRight",
4934
+ "AltLeft",
4935
+ "AltRight",
4936
+ "MetaLeft",
4937
+ "MetaRight",
4938
+ // 锁定键
4939
+ "CapsLock",
4940
+ "NumLock",
4941
+ "ScrollLock",
4942
+ // 功能键
4943
+ "F1",
4944
+ "F2",
4945
+ "F3",
4946
+ "F4",
4947
+ "F5",
4948
+ "F6",
4949
+ "F7",
4950
+ "F8",
4951
+ "F9",
4952
+ "F10",
4953
+ "F11",
4954
+ "F12",
4955
+ // 系统键
4956
+ "Insert",
4957
+ "Home",
4958
+ "End",
4959
+ "PageUp",
4960
+ "PageDown",
4961
+ "PrintScreen",
4962
+ "Pause",
4963
+ "ContextMenu"
4964
+ ]);
4965
+ const isFunctionKey = (event) => {
4966
+ if (FunctionKeys.has(event.code)) {
4967
+ return true;
4968
+ }
4969
+ return event.ctrlKey || event.altKey || event.shiftKey || event.metaKey;
4970
+ };
4948
4971
  function transformCoordinate(viewWidth, viewHeight, cloudWidth, cloudHeight, viewAngle, streamAngle, inputX, inputY) {
4949
4972
  let realShortWidth;
4950
4973
  let short;
@@ -5179,6 +5202,13 @@ function useRemoteVideo(videoContainer, remoteVideoElement, videoAngle, emit) {
5179
5202
  stopPlay
5180
5203
  };
5181
5204
  }
5205
+ function getEventXY(event, rect) {
5206
+ if ("clientX" in event && "clientY" in event) {
5207
+ return [event.clientX - rect.left, event.clientY - rect.top];
5208
+ } else {
5209
+ return [0, 0];
5210
+ }
5211
+ }
5182
5212
  function useMouseTouchControl(options) {
5183
5213
  const {
5184
5214
  remoteVideoElement,
@@ -5187,20 +5217,15 @@ function useMouseTouchControl(options) {
5187
5217
  videoAngle,
5188
5218
  widthRadio,
5189
5219
  isGroup,
5220
+ isMove,
5190
5221
  emit
5191
5222
  } = options;
5192
- const isPointerDown = ref(false);
5193
- const bound = ref(0);
5194
- const pointerList = ref(new Array(20).fill(0));
5195
- const pointerDownTime = ref(new Array(10).fill(0));
5196
- const index2 = ref(0);
5197
- const groupIndex = ref(0);
5198
- const handlePointerEvent = (event, action) => {
5223
+ const pointers = ref(/* @__PURE__ */ new Map());
5224
+ const groupIndexCounter = ref(0);
5225
+ const handlePointerEvent = (event, action, pointerId) => {
5199
5226
  if (!remoteVideoElement.value) return;
5200
- const offsetTime = Math.trunc(event.timeStamp - pointerDownTime.value[0]);
5201
5227
  const rect = remoteVideoElement.value.getBoundingClientRect();
5202
- let x = event.clientX - rect.left;
5203
- let y = event.clientY - rect.top;
5228
+ let [x, y] = getEventXY(event, rect);
5204
5229
  const cloudWidth = cloudDeviceSize.value.width;
5205
5230
  const cloudHeight = cloudDeviceSize.value.height;
5206
5231
  const result = transformCoordinate(
@@ -5213,24 +5238,38 @@ function useMouseTouchControl(options) {
5213
5238
  x,
5214
5239
  y
5215
5240
  );
5216
- if (!result || result.length < 2) return;
5241
+ if (!result) return;
5217
5242
  x = result[0];
5218
5243
  y = result[1];
5219
- if (action === ActionType.ACTION_MOVE) {
5220
- const flipY = pointerList.value[10] - y;
5221
- const flipX = pointerList.value[0] - x;
5222
- if (Math.abs(flipY) < bound.value && Math.abs(flipX) < bound.value) return;
5223
- }
5224
- if (isGroup.value) {
5225
- if (action === ActionType.ACTION_DOWN) {
5226
- index2.value = 0;
5227
- groupIndex.value++;
5228
- } else if (action === ActionType.ACTION_UP || action === ActionType.ACTION_MOVE) {
5229
- index2.value++;
5244
+ let pointerState = pointers.value.get(pointerId);
5245
+ if (action === ActionType.ACTION_DOWN) {
5246
+ pointerState = {
5247
+ x,
5248
+ y,
5249
+ downTime: event.timeStamp,
5250
+ isDown: true,
5251
+ bound: Math.trunc(6 / widthRadio.value),
5252
+ index: 0,
5253
+ groupIndex: groupIndexCounter.value++
5254
+ };
5255
+ pointers.value.set(pointerId, pointerState);
5256
+ } else {
5257
+ if (!pointerState) return;
5258
+ if (action === ActionType.ACTION_MOVE) {
5259
+ let dx = x - pointerState.x;
5260
+ let dy = y - pointerState.y;
5261
+ if (isMove.value) {
5262
+ dy = 0;
5263
+ y = pointerState.y;
5264
+ }
5265
+ if (Math.abs(dx) < pointerState.bound && Math.abs(dy) < pointerState.bound) {
5266
+ return;
5267
+ }
5268
+ pointerState.x = x;
5269
+ pointerState.y = y;
5270
+ pointerState.index++;
5230
5271
  }
5231
5272
  }
5232
- pointerList.value[0] = x;
5233
- pointerList.value[10] = y;
5234
5273
  const [px, py] = valueToPercentage(
5235
5274
  rect.width,
5236
5275
  rect.height,
@@ -5241,24 +5280,40 @@ function useMouseTouchControl(options) {
5241
5280
  x,
5242
5281
  y
5243
5282
  );
5244
- const touchData = isGroup.value ? new TouchData(action, 0, px, py, offsetTime, "web", index2.value, groupIndex.value) : new TouchData(action, 0, px, py, offsetTime, "web");
5283
+ const offsetTime = Math.trunc(event.timeStamp - pointerState.downTime);
5284
+ const touchData = isGroup.value ? new TouchData(
5285
+ action,
5286
+ pointerId,
5287
+ px,
5288
+ py,
5289
+ offsetTime,
5290
+ "web",
5291
+ pointerState.index,
5292
+ pointerState.groupIndex
5293
+ ) : new TouchData(
5294
+ action,
5295
+ pointerId,
5296
+ px,
5297
+ py,
5298
+ offsetTime,
5299
+ "web"
5300
+ );
5245
5301
  emit("channelEvent", ChannelDataType.ClickData, touchData);
5302
+ if (action === ActionType.ACTION_UP) {
5303
+ pointers.value.delete(pointerId);
5304
+ }
5246
5305
  };
5247
5306
  const handleMouseDown = (event) => {
5248
- isPointerDown.value = true;
5249
- if (remoteVideoElement.value) {
5250
- remoteVideoElement.value.setPointerCapture(event.pointerId);
5251
- }
5252
- pointerDownTime.value[0] = event.timeStamp;
5253
- bound.value = Math.trunc(6 / widthRadio.value);
5254
- handlePointerEvent(event, ActionType.ACTION_DOWN);
5307
+ event.preventDefault();
5308
+ event.stopPropagation();
5309
+ if (remoteVideoElement.value) remoteVideoElement.value.setPointerCapture(event.pointerId);
5310
+ handlePointerEvent(event, ActionType.ACTION_DOWN, event.pointerId);
5255
5311
  };
5256
5312
  const handleMouseMove = (event) => {
5257
- if (!isPointerDown.value) return;
5258
- handlePointerEvent(event, ActionType.ACTION_MOVE);
5259
- if (!remoteVideoElement.value) {
5260
- return;
5261
- }
5313
+ event.preventDefault();
5314
+ event.stopPropagation();
5315
+ handlePointerEvent(event, ActionType.ACTION_MOVE, event.pointerId);
5316
+ if (!remoteVideoElement.value) return;
5262
5317
  const rect = remoteVideoElement.value.getBoundingClientRect();
5263
5318
  const { clientX: x, clientY: y } = event;
5264
5319
  if (x < rect.left || x > rect.right || y < rect.top || y > rect.bottom) {
@@ -5266,31 +5321,25 @@ function useMouseTouchControl(options) {
5266
5321
  }
5267
5322
  };
5268
5323
  const handleMouseUp = (event) => {
5269
- if (!isPointerDown.value) return;
5270
- isPointerDown.value = false;
5271
- handlePointerEvent(event, ActionType.ACTION_UP);
5272
- if (remoteVideoElement.value) {
5273
- remoteVideoElement.value.releasePointerCapture(event.pointerId);
5274
- }
5324
+ event.preventDefault();
5325
+ event.stopPropagation();
5326
+ handlePointerEvent(event, ActionType.ACTION_UP, event.pointerId);
5327
+ if (remoteVideoElement.value) remoteVideoElement.value.releasePointerCapture(event.pointerId);
5275
5328
  };
5276
5329
  const handleMouseEnter = (event) => {
5277
- if (event.buttons === 1 && !isPointerDown.value) {
5278
- isPointerDown.value = true;
5279
- if (remoteVideoElement.value) {
5280
- remoteVideoElement.value.setPointerCapture(event.pointerId);
5281
- }
5282
- pointerDownTime.value[0] = event.timeStamp;
5283
- bound.value = Math.trunc(6 / widthRadio.value);
5284
- handlePointerEvent(event, ActionType.ACTION_DOWN);
5330
+ event.preventDefault();
5331
+ event.stopPropagation();
5332
+ if (event.buttons === 1 && !pointers.value.has(event.pointerId)) {
5333
+ if (remoteVideoElement.value) remoteVideoElement.value.setPointerCapture(event.pointerId);
5334
+ handlePointerEvent(event, ActionType.ACTION_DOWN, event.pointerId);
5285
5335
  }
5286
5336
  };
5287
5337
  const handleMouseLeave = (event) => {
5288
- if (isPointerDown.value) {
5289
- handlePointerEvent(event, ActionType.ACTION_UP);
5290
- isPointerDown.value = false;
5291
- if (remoteVideoElement.value) {
5292
- remoteVideoElement.value.releasePointerCapture(event.pointerId);
5293
- }
5338
+ event.preventDefault();
5339
+ event.stopPropagation();
5340
+ if (pointers.value.has(event.pointerId)) {
5341
+ handlePointerEvent(event, ActionType.ACTION_UP, event.pointerId);
5342
+ if (remoteVideoElement.value) remoteVideoElement.value.releasePointerCapture(event.pointerId);
5294
5343
  }
5295
5344
  };
5296
5345
  const handleWheel = (e) => {
@@ -5299,38 +5348,90 @@ function useMouseTouchControl(options) {
5299
5348
  emit("channelEvent", ChannelDataType.ActionWheel, wheelData);
5300
5349
  };
5301
5350
  return {
5302
- isPointerDown,
5351
+ pointers,
5303
5352
  handleMouseDown,
5304
5353
  handleMouseMove,
5305
- handleMouseEnter,
5306
5354
  handleMouseUp,
5355
+ handleMouseEnter,
5307
5356
  handleMouseLeave,
5308
5357
  handleWheel
5309
5358
  };
5310
5359
  }
5311
- function useKeyboardControl(disabled, emit) {
5312
- const listening = ref(false);
5360
+ function useKeyboardControl(imeInput, disabled, emit) {
5361
+ const isComposing = ref(false);
5313
5362
  const handleKeyDown = (e) => {
5314
5363
  const data = getKeyEventData(e);
5315
5364
  emit("channelEvent", ChannelDataType.ActionInput, data);
5316
5365
  };
5366
+ function onCompositionStart(_e) {
5367
+ isComposing.value = true;
5368
+ }
5369
+ function onCompositionEnd(e) {
5370
+ isComposing.value = false;
5371
+ const text = e.data;
5372
+ if (text && text.length > 0) {
5373
+ emit("channelEvent", ChannelDataType.ActionChinese, new InputData(text));
5374
+ }
5375
+ clearInput();
5376
+ }
5317
5377
  const startListening = () => {
5318
5378
  if (!disabled) {
5319
5379
  return;
5320
5380
  }
5321
- listening.value = true;
5322
- document.addEventListener("keydown", handleKeyDown);
5381
+ if (imeInput.value) {
5382
+ focusIME();
5383
+ } else {
5384
+ document.addEventListener("keydown", handleKeyDown);
5385
+ }
5323
5386
  };
5324
5387
  const stopListening = () => {
5325
5388
  if (!disabled) {
5326
5389
  return;
5327
5390
  }
5328
- listening.value = false;
5329
- document.removeEventListener("keydown", handleKeyDown);
5391
+ if (imeInput.value) {
5392
+ blurIME();
5393
+ } else {
5394
+ document.removeEventListener("keydown", handleKeyDown);
5395
+ }
5396
+ };
5397
+ const onInput = (e) => {
5398
+ if (isComposing.value) return;
5399
+ const text = e.data;
5400
+ if (text && text.length > 0) {
5401
+ emit("channelEvent", ChannelDataType.ActionChinese, new InputData(text));
5402
+ }
5403
+ clearInput();
5404
+ };
5405
+ function onKeyDown(event) {
5406
+ if (isComposing.value) return;
5407
+ if (isFunctionKey(event)) {
5408
+ const data = getKeyEventData(event);
5409
+ if (data.keyCode === 50 && data.meta === 4096) return;
5410
+ emit("channelEvent", ChannelDataType.ActionInput, data);
5411
+ }
5412
+ }
5413
+ const clearInput = () => {
5414
+ if (imeInput.value) {
5415
+ imeInput.value.value = "";
5416
+ }
5417
+ };
5418
+ const focusIME = () => {
5419
+ requestAnimationFrame(() => {
5420
+ var _a;
5421
+ (_a = imeInput.value) == null ? void 0 : _a.focus();
5422
+ });
5423
+ };
5424
+ const blurIME = () => {
5425
+ var _a;
5426
+ (_a = imeInput.value) == null ? void 0 : _a.blur();
5330
5427
  };
5331
5428
  return {
5332
5429
  startListening,
5333
- stopListening
5430
+ stopListening,
5431
+ onCompositionStart,
5432
+ onCompositionEnd,
5433
+ onInput,
5434
+ onKeyDown
5334
5435
  };
5335
5436
  }
5336
5437
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -5342,15 +5443,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5342
5443
  cloudDeviceSize: { default: () => ({ width: 0, height: 0 }) },
5343
5444
  disabled: { type: Boolean, default: true },
5344
5445
  bgColor: { default: "transparent" },
5345
- isGroup: { type: Boolean, default: false }
5446
+ isGroup: { type: Boolean, default: false },
5447
+ isMove: { type: Boolean, default: false },
5448
+ isKeyMapping: { type: Boolean, default: false }
5346
5449
  },
5347
5450
  emits: ["channelEvent", "groupControlEvent", "loadedSuccess"],
5348
5451
  setup(__props, { expose: __expose, emit: __emit }) {
5349
5452
  const emit = __emit;
5350
5453
  const props = __props;
5351
- const { streamAngle, videoAngle, cursorType, cloudDeviceSize, disabled, bgColor, isGroup } = toRefs(props);
5454
+ const { streamAngle, videoAngle, cursorType, cloudDeviceSize, disabled, bgColor, isGroup, isMove, isKeyMapping } = toRefs(props);
5352
5455
  const videoContainer = ref(null);
5353
5456
  const remoteVideoElement = ref(null);
5457
+ const imeInput = ref(null);
5354
5458
  const cursorClass = useCursorStyle(cursorType);
5355
5459
  const {
5356
5460
  videoSize,
@@ -5374,12 +5478,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5374
5478
  videoAngle,
5375
5479
  widthRadio,
5376
5480
  isGroup,
5481
+ isMove,
5377
5482
  emit
5378
5483
  });
5379
5484
  const {
5380
5485
  startListening,
5381
- stopListening
5382
- } = useKeyboardControl(disabled, emit);
5486
+ stopListening,
5487
+ onCompositionStart,
5488
+ onCompositionEnd,
5489
+ onInput,
5490
+ onKeyDown
5491
+ } = useKeyboardControl(imeInput, disabled, emit);
5383
5492
  useResizeObserver(videoContainer, dimensions);
5384
5493
  const handleClick = () => {
5385
5494
  var _a;
@@ -5404,9 +5513,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5404
5513
  }, [
5405
5514
  createElementVNode("div", {
5406
5515
  ref: "keyboardArea",
5407
- onPointerenter: _cache[6] || (_cache[6] = //@ts-ignore
5516
+ onPointerenter: _cache[10] || (_cache[10] = //@ts-ignore
5408
5517
  (...args) => unref(startListening) && unref(startListening)(...args)),
5409
- onPointerleave: _cache[7] || (_cache[7] = //@ts-ignore
5518
+ onPointerleave: _cache[11] || (_cache[11] = //@ts-ignore
5410
5519
  (...args) => unref(stopListening) && unref(stopListening)(...args)),
5411
5520
  class: "vContainer",
5412
5521
  style: normalizeStyle([{ height: unref(videoSize).height + "px", width: unref(videoSize).width + "px", transform: `rotate(${unref(videoAngle)}deg)` }, { "position": "relative", "overflow": "hidden" }])
@@ -5427,12 +5536,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5427
5536
  (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
5428
5537
  onWheel: _cache[5] || (_cache[5] = //@ts-ignore
5429
5538
  (...args) => unref(handleWheel) && unref(handleWheel)(...args)),
5430
- style: normalizeStyle({ backgroundColor: `${unref(bgColor)}` }),
5431
5539
  autoplay: "",
5432
5540
  playsinline: "",
5433
5541
  muted: "",
5434
5542
  disablePictureInPicture: true
5435
- }, null, 38)
5543
+ }, null, 34),
5544
+ unref(isKeyMapping) ? (openBlock(), createElementBlock("textarea", {
5545
+ key: 0,
5546
+ ref_key: "imeInput",
5547
+ ref: imeInput,
5548
+ class: "ime-input",
5549
+ autocomplete: "off",
5550
+ autocapitalize: "off",
5551
+ spellcheck: "false",
5552
+ onCompositionstart: _cache[6] || (_cache[6] = //@ts-ignore
5553
+ (...args) => unref(onCompositionStart) && unref(onCompositionStart)(...args)),
5554
+ onCompositionend: _cache[7] || (_cache[7] = //@ts-ignore
5555
+ (...args) => unref(onCompositionEnd) && unref(onCompositionEnd)(...args)),
5556
+ onInput: _cache[8] || (_cache[8] = //@ts-ignore
5557
+ (...args) => unref(onInput) && unref(onInput)(...args)),
5558
+ onKeydown: _cache[9] || (_cache[9] = //@ts-ignore
5559
+ (...args) => unref(onKeyDown) && unref(onKeyDown)(...args))
5560
+ }, null, 544)) : createCommentVNode("", true)
5436
5561
  ], 36)
5437
5562
  ], 512);
5438
5563
  };
@@ -5445,7 +5570,7 @@ const _export_sfc = (sfc, props) => {
5445
5570
  }
5446
5571
  return target;
5447
5572
  };
5448
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-611728c2"]]);
5573
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ae395fc8"]]);
5449
5574
  class SdkController extends EventEmitter {
5450
5575
  constructor(config) {
5451
5576
  super();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yjz-web-sdk",
3
3
  "private": false,
4
- "version": "1.0.11-beta.1",
4
+ "version": "1.0.11-beta.3",
5
5
  "type": "module",
6
6
  "description": "针对于亚矩阵项目的云手机投屏和屏幕控制",
7
7
  "license": "Apache-2.0",