hanc-webrtc-widgets 2.1.9 → 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
|
-
|
|
17107
|
-
|
|
17108
|
-
|
|
17109
|
-
|
|
17110
|
-
|
|
17111
|
-
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
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
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
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
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
|
|
17260
|
-
|
|
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
|
/**
|
|
@@ -38188,95 +38192,44 @@ class zd {
|
|
|
38188
38192
|
return o.gain.setValueAtTime(0, n), o.gain.linearRampToValueAtTime(this.config.volume, n + c), o.gain.linearRampToValueAtTime(this.config.volume * d, n + c + l), o.gain.setValueAtTime(this.config.volume * d, n + s - u), o.gain.linearRampToValueAtTime(0, n + s), a.connect(o), { oscillator: a, gain: o };
|
|
38189
38193
|
}
|
|
38190
38194
|
/**
|
|
38191
|
-
* Play
|
|
38192
|
-
*
|
|
38195
|
+
* Play pleasant notification sound for call start
|
|
38196
|
+
* Two-tone ascending melody like messenger notifications
|
|
38193
38197
|
*/
|
|
38194
38198
|
async playCallStartSound() {
|
|
38195
38199
|
const e = await this.ensureContext();
|
|
38196
38200
|
if (!e || typeof e.createGain != "function") return;
|
|
38197
38201
|
const t = e.currentTime, n = e.createGain();
|
|
38198
38202
|
n.gain.setValueAtTime(1, t), n.connect(e.destination);
|
|
38199
|
-
const s =
|
|
38200
|
-
|
|
38201
|
-
|
|
38202
|
-
|
|
38203
|
-
|
|
38204
|
-
|
|
38205
|
-
|
|
38206
|
-
|
|
38207
|
-
|
|
38208
|
-
|
|
38209
|
-
|
|
38210
|
-
|
|
38211
|
-
|
|
38212
|
-
a.freq,
|
|
38213
|
-
t + a.start,
|
|
38214
|
-
a.duration,
|
|
38215
|
-
"sine"
|
|
38216
|
-
);
|
|
38217
|
-
c.connect(n), o.start(t + a.start), o.stop(t + a.start + a.duration), r.push(o);
|
|
38218
|
-
const { oscillator: l, gain: d } = this.createTone(
|
|
38219
|
-
e,
|
|
38220
|
-
a.freq * 2,
|
|
38221
|
-
// Octave up
|
|
38222
|
-
t + a.start,
|
|
38223
|
-
a.duration,
|
|
38224
|
-
"triangle"
|
|
38225
|
-
);
|
|
38226
|
-
d.gain.setValueAtTime(d.gain.value * 0.3, t), d.connect(n), l.start(t + a.start), l.stop(t + a.start + a.duration), r.push(l);
|
|
38227
|
-
}), setTimeout(() => {
|
|
38228
|
-
r.forEach((a) => {
|
|
38229
|
-
try {
|
|
38230
|
-
a.disconnect();
|
|
38231
|
-
} catch {
|
|
38232
|
-
}
|
|
38233
|
-
});
|
|
38234
|
-
}, 2e3);
|
|
38203
|
+
const { oscillator: s, gain: r } = this.createTone(e, 880, t, 0.12, "sine");
|
|
38204
|
+
r.connect(n), s.start(t), s.stop(t + 0.12);
|
|
38205
|
+
const { oscillator: a, gain: o } = this.createTone(e, 1046, t + 0.08, 0.15, "sine");
|
|
38206
|
+
o.connect(n), a.start(t + 0.08), a.stop(t + 0.23), setTimeout(() => {
|
|
38207
|
+
try {
|
|
38208
|
+
s.disconnect();
|
|
38209
|
+
} catch {
|
|
38210
|
+
}
|
|
38211
|
+
try {
|
|
38212
|
+
a.disconnect();
|
|
38213
|
+
} catch {
|
|
38214
|
+
}
|
|
38215
|
+
}, 300);
|
|
38235
38216
|
}
|
|
38236
38217
|
/**
|
|
38237
|
-
* Play descending
|
|
38238
|
-
*
|
|
38218
|
+
* Play gentle descending sound for call end
|
|
38219
|
+
* Single soft tone
|
|
38239
38220
|
*/
|
|
38240
38221
|
async playCallEndSound() {
|
|
38241
38222
|
const e = await this.ensureContext();
|
|
38242
38223
|
if (!e || typeof e.createGain != "function") return;
|
|
38243
38224
|
const t = e.currentTime, n = e.createGain();
|
|
38244
38225
|
n.gain.setValueAtTime(1, t), n.connect(e.destination);
|
|
38245
|
-
const s =
|
|
38246
|
-
|
|
38247
|
-
|
|
38248
|
-
|
|
38249
|
-
|
|
38250
|
-
|
|
38251
|
-
|
|
38252
|
-
{ freq: 261.63, start: 0.4, duration: 0.7 }
|
|
38253
|
-
// C4
|
|
38254
|
-
], r = [];
|
|
38255
|
-
s.forEach((a) => {
|
|
38256
|
-
const { oscillator: o, gain: c } = this.createTone(
|
|
38257
|
-
e,
|
|
38258
|
-
a.freq,
|
|
38259
|
-
t + a.start,
|
|
38260
|
-
a.duration,
|
|
38261
|
-
"sine"
|
|
38262
|
-
);
|
|
38263
|
-
c.connect(n), o.start(t + a.start), o.stop(t + a.start + a.duration), r.push(o);
|
|
38264
|
-
const { oscillator: l, gain: d } = this.createTone(
|
|
38265
|
-
e,
|
|
38266
|
-
a.freq * 2,
|
|
38267
|
-
t + a.start,
|
|
38268
|
-
a.duration,
|
|
38269
|
-
"triangle"
|
|
38270
|
-
);
|
|
38271
|
-
d.gain.setValueAtTime(d.gain.value * 0.25, t), d.connect(n), l.start(t + a.start), l.stop(t + a.start + a.duration), r.push(l);
|
|
38272
|
-
}), setTimeout(() => {
|
|
38273
|
-
r.forEach((a) => {
|
|
38274
|
-
try {
|
|
38275
|
-
a.disconnect();
|
|
38276
|
-
} catch {
|
|
38277
|
-
}
|
|
38278
|
-
});
|
|
38279
|
-
}, 1500);
|
|
38226
|
+
const { oscillator: s, gain: r } = this.createTone(e, 660, t, 0.2, "sine");
|
|
38227
|
+
r.connect(n), s.start(t), s.stop(t + 0.2), setTimeout(() => {
|
|
38228
|
+
try {
|
|
38229
|
+
s.disconnect();
|
|
38230
|
+
} catch {
|
|
38231
|
+
}
|
|
38232
|
+
}, 250);
|
|
38280
38233
|
}
|
|
38281
38234
|
/**
|
|
38282
38235
|
* Update configuration
|
|
@@ -38614,23 +38567,29 @@ let gt = class extends ps {
|
|
|
38614
38567
|
}, this.handleMicrophoneDisabled = () => {
|
|
38615
38568
|
this.microphoneEnabled = !1;
|
|
38616
38569
|
}, this.handleStatusChange = (i) => {
|
|
38617
|
-
var t, n, s, r, a
|
|
38570
|
+
var t, n, s, r, a;
|
|
38618
38571
|
switch (i.detail) {
|
|
38619
38572
|
case "connecting":
|
|
38620
38573
|
this.callStatus = "connecting";
|
|
38621
38574
|
break;
|
|
38622
38575
|
case "connected":
|
|
38623
|
-
this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), (
|
|
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(
|
|
38624
38580
|
new Event("call-start", { bubbles: !0, composed: !0 })
|
|
38625
38581
|
);
|
|
38626
38582
|
break;
|
|
38627
38583
|
case "disconnected":
|
|
38628
|
-
this.callStatus = "idle", (
|
|
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(
|
|
38629
38588
|
new Event("call-end", { bubbles: !0, composed: !0 })
|
|
38630
38589
|
);
|
|
38631
38590
|
break;
|
|
38632
38591
|
case "error":
|
|
38633
|
-
this.callStatus = "error", (
|
|
38592
|
+
this.callStatus = "error", (r = this.orbRenderer) == null || r.setActive(!1), (a = this.audioAnalyzer) == null || a.disconnect(), setTimeout(() => {
|
|
38634
38593
|
this.callStatus === "error" && (this.callStatus = "idle", this.startIdleAnimation());
|
|
38635
38594
|
}, 3e3);
|
|
38636
38595
|
break;
|
|
@@ -39120,23 +39079,29 @@ let vt = class extends ps {
|
|
|
39120
39079
|
}, this.handleMicrophoneDisabled = () => {
|
|
39121
39080
|
this.microphoneEnabled = !1;
|
|
39122
39081
|
}, this.handleStatusChange = (i) => {
|
|
39123
|
-
var t, n, s, r, a
|
|
39082
|
+
var t, n, s, r, a;
|
|
39124
39083
|
switch (i.detail) {
|
|
39125
39084
|
case "connecting":
|
|
39126
39085
|
this.callStatus = "connecting";
|
|
39127
39086
|
break;
|
|
39128
39087
|
case "connected":
|
|
39129
|
-
this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), (
|
|
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(
|
|
39130
39092
|
new Event("call-start", { bubbles: !0, composed: !0 })
|
|
39131
39093
|
);
|
|
39132
39094
|
break;
|
|
39133
39095
|
case "disconnected":
|
|
39134
|
-
this.callStatus = "idle", (
|
|
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(
|
|
39135
39100
|
new Event("call-end", { bubbles: !0, composed: !0 })
|
|
39136
39101
|
);
|
|
39137
39102
|
break;
|
|
39138
39103
|
case "error":
|
|
39139
|
-
this.callStatus = "error", (
|
|
39104
|
+
this.callStatus = "error", (r = this.orbRenderer) == null || r.setActive(!1), (a = this.audioAnalyzer) == null || a.disconnect(), setTimeout(() => {
|
|
39140
39105
|
this.callStatus === "error" && (this.callStatus = "idle", this.startIdleAnimation());
|
|
39141
39106
|
}, 3e3);
|
|
39142
39107
|
break;
|
|
@@ -39610,23 +39575,29 @@ let _t = class extends ps {
|
|
|
39610
39575
|
}, this.handleMicrophoneDisabled = () => {
|
|
39611
39576
|
this.microphoneEnabled = !1;
|
|
39612
39577
|
}, this.handleStatusChange = (i) => {
|
|
39613
|
-
var t, n, s, r, a
|
|
39578
|
+
var t, n, s, r, a;
|
|
39614
39579
|
switch (i.detail) {
|
|
39615
39580
|
case "connecting":
|
|
39616
39581
|
this.callStatus = "connecting";
|
|
39617
39582
|
break;
|
|
39618
39583
|
case "connected":
|
|
39619
|
-
this.callStatus = "connected", (t = this.orbRenderer) == null || t.setActive(!0), this.startRealAudioLoop(), (
|
|
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(
|
|
39620
39588
|
new Event("call-start", { bubbles: !0, composed: !0 })
|
|
39621
39589
|
);
|
|
39622
39590
|
break;
|
|
39623
39591
|
case "disconnected":
|
|
39624
|
-
this.callStatus = "idle", (
|
|
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(
|
|
39625
39596
|
new Event("call-end", { bubbles: !0, composed: !0 })
|
|
39626
39597
|
);
|
|
39627
39598
|
break;
|
|
39628
39599
|
case "error":
|
|
39629
|
-
this.callStatus = "error", (
|
|
39600
|
+
this.callStatus = "error", (r = this.orbRenderer) == null || r.setActive(!1), (a = this.audioAnalyzer) == null || a.disconnect(), setTimeout(() => {
|
|
39630
39601
|
this.callStatus === "error" && (this.callStatus = "idle", this.startIdleAnimation());
|
|
39631
39602
|
}, 3e3);
|
|
39632
39603
|
break;
|
|
@@ -39837,23 +39808,22 @@ let _t = class extends ps {
|
|
|
39837
39808
|
}
|
|
39838
39809
|
|
|
39839
39810
|
.microphone-indicator {
|
|
39840
|
-
position: absolute;
|
|
39841
|
-
top: -4px;
|
|
39842
|
-
right: -4px;
|
|
39843
|
-
width: 20px;
|
|
39844
|
-
height: 20px;
|
|
39845
|
-
background: rgba(220, 38, 38, 0.95);
|
|
39846
|
-
border-radius: 50%;
|
|
39847
39811
|
display: flex;
|
|
39848
39812
|
align-items: center;
|
|
39849
39813
|
justify-content: center;
|
|
39814
|
+
width: 24px;
|
|
39815
|
+
height: 24px;
|
|
39816
|
+
background: rgba(220, 38, 38, 0.95);
|
|
39817
|
+
border-radius: 50%;
|
|
39850
39818
|
box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
|
|
39851
|
-
border: 2px solid rgba(255, 255, 255, 0.95);
|
|
39852
39819
|
pointer-events: none;
|
|
39853
39820
|
opacity: 0;
|
|
39854
|
-
transform: scale(
|
|
39821
|
+
transform: scale(0.8);
|
|
39855
39822
|
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
39856
39823
|
will-change: opacity, transform;
|
|
39824
|
+
margin-left: -8px;
|
|
39825
|
+
margin-right: 8px;
|
|
39826
|
+
flex-shrink: 0;
|
|
39857
39827
|
}
|
|
39858
39828
|
|
|
39859
39829
|
.microphone-indicator.visible {
|
|
@@ -39862,8 +39832,8 @@ let _t = class extends ps {
|
|
|
39862
39832
|
}
|
|
39863
39833
|
|
|
39864
39834
|
.microphone-indicator svg {
|
|
39865
|
-
width:
|
|
39866
|
-
height:
|
|
39835
|
+
width: 14px;
|
|
39836
|
+
height: 14px;
|
|
39867
39837
|
color: white;
|
|
39868
39838
|
}
|
|
39869
39839
|
</style>
|
|
@@ -39879,34 +39849,33 @@ let _t = class extends ps {
|
|
|
39879
39849
|
class="orb-container"
|
|
39880
39850
|
part="orb-container"
|
|
39881
39851
|
${sd(this.orbContainerRef)}
|
|
39882
|
-
>
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
|
|
39887
|
-
|
|
39888
|
-
|
|
39889
|
-
|
|
39890
|
-
|
|
39891
|
-
|
|
39892
|
-
|
|
39893
|
-
|
|
39894
|
-
|
|
39895
|
-
|
|
39896
|
-
|
|
39897
|
-
|
|
39898
|
-
|
|
39899
|
-
|
|
39900
|
-
|
|
39901
|
-
|
|
39902
|
-
|
|
39903
|
-
|
|
39904
|
-
|
|
39905
|
-
|
|
39906
|
-
|
|
39907
|
-
|
|
39908
|
-
|
|
39909
|
-
</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
|
+
` : ""}
|
|
39910
39879
|
<span class="pill-text">${this.buttonText}</span>
|
|
39911
39880
|
${this.callStatus !== "idle" ? Zt`<span class="icon-wrapper">${this.getButtonIcon()}</span>` : ""}
|
|
39912
39881
|
</button>
|