hanc-webrtc-widgets 2.1.10 → 2.1.11

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.
@@ -17103,25 +17103,28 @@ class Ed extends EventTarget {
17103
17103
  );
17104
17104
  }
17105
17105
  const { token: r, url: a, room_name: o, user_identity: c } = await s.json();
17106
- if (this.roomName = o, this.userIdentity = c, await n.connect(a, r), t)
17107
- try {
17108
- await n.localParticipant.setMicrophoneEnabled(!0), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")), t.getTracks().forEach((l) => l.stop()), setTimeout(() => {
17109
- const l = Array.from(n.localParticipant.audioTrackPublications.values()).find((d) => d.kind === "audio");
17110
- if (l != null && l.track) {
17111
- const d = l.track.mediaStreamTrack;
17112
- d && this.dispatchEvent(
17113
- new CustomEvent("local-audio-track", {
17114
- detail: d
17115
- })
17116
- );
17106
+ this.roomName = o, this.userIdentity = c, await n.connect(a, r), this.updateStatus("connected"), this.isReady = !0, requestAnimationFrame(() => {
17107
+ setTimeout(async () => {
17108
+ if (t)
17109
+ try {
17110
+ await n.localParticipant.setMicrophoneEnabled(!0), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")), t.getTracks().forEach((l) => l.stop()), setTimeout(() => {
17111
+ const l = Array.from(n.localParticipant.audioTrackPublications.values()).find((d) => d.kind === "audio");
17112
+ if (l != null && l.track) {
17113
+ const d = l.track.mediaStreamTrack;
17114
+ d && this.dispatchEvent(
17115
+ new CustomEvent("local-audio-track", {
17116
+ detail: d
17117
+ })
17118
+ );
17119
+ }
17120
+ }, 100);
17121
+ } catch (l) {
17122
+ console.warn("Could not enable microphone on connect:", l), this.microphoneEnabled = !1, this.dispatchEvent(new CustomEvent("microphone-disabled"));
17117
17123
  }
17118
- }, 100);
17119
- } catch (l) {
17120
- console.warn("Could not enable microphone on connect:", l), this.microphoneEnabled = !1, this.dispatchEvent(new CustomEvent("microphone-disabled"));
17121
- }
17122
- else
17123
- this.microphoneEnabled = !1, this.dispatchEvent(new CustomEvent("microphone-disabled"));
17124
- this.updateStatus("connected"), this.isReady = !0, this.dispatchEvent(
17124
+ else
17125
+ this.microphoneEnabled = !1, this.dispatchEvent(new CustomEvent("microphone-disabled"));
17126
+ }, 50);
17127
+ }), this.dispatchEvent(
17125
17128
  new CustomEvent("room-connected", {
17126
17129
  detail: { roomName: o, identity: c }
17127
17130
  })
@@ -17252,15 +17255,16 @@ class Ed extends EventTarget {
17252
17255
  return;
17253
17256
  }
17254
17257
  this.updateStatus("disconnecting");
17255
- try {
17256
- await this.room.disconnect(), this.room = null, this.updateStatus("disconnected"), this.connectedParticipants = [], this.microphoneEnabled = !1, this.audioPlaybackPrompt = !1, this.isReady = !1, this.dispatchEvent(new CustomEvent("call-ended"));
17257
- } catch (e) {
17258
- this.error = `Error ending call: ${e instanceof Error ? e.message : String(e)}`, this.updateStatus("error"), this.dispatchEvent(
17259
- new CustomEvent("error", {
17260
- detail: { error: this.error }
17261
- })
17262
- );
17263
- }
17258
+ const e = this.room;
17259
+ this.room = null, this.connectedParticipants = [], this.microphoneEnabled = !1, this.audioPlaybackPrompt = !1, this.isReady = !1, this.updateStatus("disconnected"), this.dispatchEvent(new CustomEvent("call-ended")), requestAnimationFrame(() => {
17260
+ setTimeout(async () => {
17261
+ try {
17262
+ await e.disconnect();
17263
+ } catch (t) {
17264
+ console.warn("Error during room disconnect:", t);
17265
+ }
17266
+ }, 0);
17267
+ });
17264
17268
  }
17265
17269
  }
17266
17270
  /**
@@ -38563,23 +38567,29 @@ let gt = class extends ps {
38563
38567
  }, this.handleMicrophoneDisabled = () => {
38564
38568
  this.microphoneEnabled = !1;
38565
38569
  }, this.handleStatusChange = (i) => {
38566
- var t, n, s, r, a, o, c;
38570
+ var t, n, s, r, a;
38567
38571
  switch (i.detail) {
38568
38572
  case "connecting":
38569
38573
  this.callStatus = "connecting";
38570
38574
  break;
38571
38575
  case "connected":
38572
- this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), (n = this.soundManager) == null || n.playCallStartSound(), this.dispatchEvent(
38576
+ this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), setTimeout(() => {
38577
+ var o;
38578
+ (o = this.soundManager) == null || o.playCallStartSound();
38579
+ }, 300), this.dispatchEvent(
38573
38580
  new Event("call-start", { bubbles: !0, composed: !0 })
38574
38581
  );
38575
38582
  break;
38576
38583
  case "disconnected":
38577
- this.callStatus = "idle", (s = this.orbRenderer) == null || s.setActive(!1), (r = this.audioAnalyzer) == null || r.disconnect(), this.startIdleAnimation(), (a = this.soundManager) == null || a.playCallEndSound(), this.dispatchEvent(
38584
+ this.callStatus = "idle", (n = this.orbRenderer) == null || n.setActive(!1), (s = this.audioAnalyzer) == null || s.disconnect(), this.startIdleAnimation(), setTimeout(() => {
38585
+ var o;
38586
+ (o = this.soundManager) == null || o.playCallEndSound();
38587
+ }, 150), this.dispatchEvent(
38578
38588
  new Event("call-end", { bubbles: !0, composed: !0 })
38579
38589
  );
38580
38590
  break;
38581
38591
  case "error":
38582
- this.callStatus = "error", (o = this.orbRenderer) == null || o.setActive(!1), (c = this.audioAnalyzer) == null || c.disconnect(), setTimeout(() => {
38592
+ this.callStatus = "error", (r = this.orbRenderer) == null || r.setActive(!1), (a = this.audioAnalyzer) == null || a.disconnect(), setTimeout(() => {
38583
38593
  this.callStatus === "error" && (this.callStatus = "idle", this.startIdleAnimation());
38584
38594
  }, 3e3);
38585
38595
  break;
@@ -39069,23 +39079,29 @@ let vt = class extends ps {
39069
39079
  }, this.handleMicrophoneDisabled = () => {
39070
39080
  this.microphoneEnabled = !1;
39071
39081
  }, this.handleStatusChange = (i) => {
39072
- var t, n, s, r, a, o, c;
39082
+ var t, n, s, r, a;
39073
39083
  switch (i.detail) {
39074
39084
  case "connecting":
39075
39085
  this.callStatus = "connecting";
39076
39086
  break;
39077
39087
  case "connected":
39078
- this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), (n = this.soundManager) == null || n.playCallStartSound(), this.dispatchEvent(
39088
+ this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), setTimeout(() => {
39089
+ var o;
39090
+ (o = this.soundManager) == null || o.playCallStartSound();
39091
+ }, 300), this.dispatchEvent(
39079
39092
  new Event("call-start", { bubbles: !0, composed: !0 })
39080
39093
  );
39081
39094
  break;
39082
39095
  case "disconnected":
39083
- this.callStatus = "idle", (s = this.orbRenderer) == null || s.setActive(!1), (r = this.audioAnalyzer) == null || r.disconnect(), this.startIdleAnimation(), (a = this.soundManager) == null || a.playCallEndSound(), this.dispatchEvent(
39096
+ this.callStatus = "idle", (n = this.orbRenderer) == null || n.setActive(!1), (s = this.audioAnalyzer) == null || s.disconnect(), this.startIdleAnimation(), setTimeout(() => {
39097
+ var o;
39098
+ (o = this.soundManager) == null || o.playCallEndSound();
39099
+ }, 150), this.dispatchEvent(
39084
39100
  new Event("call-end", { bubbles: !0, composed: !0 })
39085
39101
  );
39086
39102
  break;
39087
39103
  case "error":
39088
- this.callStatus = "error", (o = this.orbRenderer) == null || o.setActive(!1), (c = this.audioAnalyzer) == null || c.disconnect(), setTimeout(() => {
39104
+ this.callStatus = "error", (r = this.orbRenderer) == null || r.setActive(!1), (a = this.audioAnalyzer) == null || a.disconnect(), setTimeout(() => {
39089
39105
  this.callStatus === "error" && (this.callStatus = "idle", this.startIdleAnimation());
39090
39106
  }, 3e3);
39091
39107
  break;
@@ -39559,23 +39575,29 @@ let _t = class extends ps {
39559
39575
  }, this.handleMicrophoneDisabled = () => {
39560
39576
  this.microphoneEnabled = !1;
39561
39577
  }, this.handleStatusChange = (i) => {
39562
- var t, n, s, r, a, o, c;
39578
+ var t, n, s, r, a;
39563
39579
  switch (i.detail) {
39564
39580
  case "connecting":
39565
39581
  this.callStatus = "connecting";
39566
39582
  break;
39567
39583
  case "connected":
39568
- this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), (n = this.soundManager) == null || n.playCallStartSound(), this.dispatchEvent(
39584
+ this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), setTimeout(() => {
39585
+ var o;
39586
+ (o = this.soundManager) == null || o.playCallStartSound();
39587
+ }, 300), this.dispatchEvent(
39569
39588
  new Event("call-start", { bubbles: !0, composed: !0 })
39570
39589
  );
39571
39590
  break;
39572
39591
  case "disconnected":
39573
- this.callStatus = "idle", (s = this.orbRenderer) == null || s.setActive(!1), (r = this.audioAnalyzer) == null || r.disconnect(), this.startIdleAnimation(), (a = this.soundManager) == null || a.playCallEndSound(), this.dispatchEvent(
39592
+ this.callStatus = "idle", (n = this.orbRenderer) == null || n.setActive(!1), (s = this.audioAnalyzer) == null || s.disconnect(), this.startIdleAnimation(), setTimeout(() => {
39593
+ var o;
39594
+ (o = this.soundManager) == null || o.playCallEndSound();
39595
+ }, 150), this.dispatchEvent(
39574
39596
  new Event("call-end", { bubbles: !0, composed: !0 })
39575
39597
  );
39576
39598
  break;
39577
39599
  case "error":
39578
- this.callStatus = "error", (o = this.orbRenderer) == null || o.setActive(!1), (c = this.audioAnalyzer) == null || c.disconnect(), setTimeout(() => {
39600
+ this.callStatus = "error", (r = this.orbRenderer) == null || r.setActive(!1), (a = this.audioAnalyzer) == null || a.disconnect(), setTimeout(() => {
39579
39601
  this.callStatus === "error" && (this.callStatus = "idle", this.startIdleAnimation());
39580
39602
  }, 3e3);
39581
39603
  break;
@@ -39786,23 +39808,22 @@ let _t = class extends ps {
39786
39808
  }
39787
39809
 
39788
39810
  .microphone-indicator {
39789
- position: absolute;
39790
- top: -4px;
39791
- right: -4px;
39792
- width: 20px;
39793
- height: 20px;
39794
- background: rgba(220, 38, 38, 0.95);
39795
- border-radius: 50%;
39796
39811
  display: flex;
39797
39812
  align-items: center;
39798
39813
  justify-content: center;
39814
+ width: 24px;
39815
+ height: 24px;
39816
+ background: rgba(220, 38, 38, 0.95);
39817
+ border-radius: 50%;
39799
39818
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
39800
- border: 2px solid rgba(255, 255, 255, 0.95);
39801
39819
  pointer-events: none;
39802
39820
  opacity: 0;
39803
- transform: scale(1);
39821
+ transform: scale(0.8);
39804
39822
  transition: opacity 0.3s ease, transform 0.3s ease;
39805
39823
  will-change: opacity, transform;
39824
+ margin-left: -8px;
39825
+ margin-right: 8px;
39826
+ flex-shrink: 0;
39806
39827
  }
39807
39828
 
39808
39829
  .microphone-indicator.visible {
@@ -39811,8 +39832,8 @@ let _t = class extends ps {
39811
39832
  }
39812
39833
 
39813
39834
  .microphone-indicator svg {
39814
- width: 12px;
39815
- height: 12px;
39835
+ width: 14px;
39836
+ height: 14px;
39816
39837
  color: white;
39817
39838
  }
39818
39839
  </style>
@@ -39828,34 +39849,33 @@ let _t = class extends ps {
39828
39849
  class="orb-container"
39829
39850
  part="orb-container"
39830
39851
  ${sd(this.orbContainerRef)}
39831
- >
39832
- ${this.callStatus === "connected" && !this.microphoneEnabled ? Zt`
39833
- <div class="microphone-indicator visible">
39834
- <svg viewBox="0 0 24 24" fill="none">
39835
- <path
39836
- d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"
39837
- fill="currentColor"
39838
- />
39839
- <path
39840
- d="M19 10v2a7 7 0 0 1-14 0v-2"
39841
- stroke="currentColor"
39842
- stroke-width="2"
39843
- stroke-linecap="round"
39844
- stroke-linejoin="round"
39845
- />
39846
- <line
39847
- x1="1"
39848
- y1="1"
39849
- x2="23"
39850
- y2="23"
39851
- stroke="currentColor"
39852
- stroke-width="2"
39853
- stroke-linecap="round"
39854
- />
39855
- </svg>
39856
- </div>
39857
- ` : ""}
39858
- </div>
39852
+ ></div>
39853
+ ${this.callStatus === "connected" && !this.microphoneEnabled ? Zt`
39854
+ <div class="microphone-indicator visible">
39855
+ <svg viewBox="0 0 24 24" fill="none">
39856
+ <path
39857
+ d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"
39858
+ fill="currentColor"
39859
+ />
39860
+ <path
39861
+ d="M19 10v2a7 7 0 0 1-14 0v-2"
39862
+ stroke="currentColor"
39863
+ stroke-width="2"
39864
+ stroke-linecap="round"
39865
+ stroke-linejoin="round"
39866
+ />
39867
+ <line
39868
+ x1="1"
39869
+ y1="1"
39870
+ x2="23"
39871
+ y2="23"
39872
+ stroke="currentColor"
39873
+ stroke-width="2"
39874
+ stroke-linecap="round"
39875
+ />
39876
+ </svg>
39877
+ </div>
39878
+ ` : ""}
39859
39879
  <span class="pill-text">${this.buttonText}</span>
39860
39880
  ${this.callStatus !== "idle" ? Zt`<span class="icon-wrapper">${this.getButtonIcon()}</span>` : ""}
39861
39881
  </button>