hanc-webrtc-widgets 2.2.13 → 2.2.14
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.
|
@@ -17259,9 +17259,22 @@ class wd extends EventTarget {
|
|
|
17259
17259
|
}
|
|
17260
17260
|
async makeCall({ agentId: e }) {
|
|
17261
17261
|
if (this.room && this.room.state === "connected") return;
|
|
17262
|
+
if (this.isAppleDevice)
|
|
17263
|
+
try {
|
|
17264
|
+
const n = new Audio(
|
|
17265
|
+
"data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA="
|
|
17266
|
+
);
|
|
17267
|
+
n.volume = 1e-3, await n.play().catch(() => {
|
|
17268
|
+
}), n.pause(), n.remove(), console.log("[LiveKit] iOS audio playback unlocked");
|
|
17269
|
+
} catch (n) {
|
|
17270
|
+
console.warn("[LiveKit] Failed to unlock iOS audio:", n);
|
|
17271
|
+
}
|
|
17262
17272
|
let t = null;
|
|
17263
17273
|
try {
|
|
17264
|
-
t = await navigator.mediaDevices.getUserMedia({
|
|
17274
|
+
t = await navigator.mediaDevices.getUserMedia({
|
|
17275
|
+
audio: !0,
|
|
17276
|
+
video: !1
|
|
17277
|
+
}), console.log("Microphone permission granted");
|
|
17265
17278
|
} catch (n) {
|
|
17266
17279
|
console.warn("Microphone permission denied or not available:", n);
|
|
17267
17280
|
}
|
|
@@ -17299,7 +17312,13 @@ class wd extends EventTarget {
|
|
|
17299
17312
|
);
|
|
17300
17313
|
}
|
|
17301
17314
|
const { token: r, url: a, room_name: o, user_identity: c } = await s.json();
|
|
17302
|
-
this.roomName = o, this.userIdentity = c, this.reconnectAttempts = 0, this.wasConnectedBeforeHidden = !1, await this.connectWithTimeout(n, a, r, 2e4)
|
|
17315
|
+
this.roomName = o, this.userIdentity = c, this.reconnectAttempts = 0, this.wasConnectedBeforeHidden = !1, await this.connectWithTimeout(n, a, r, 2e4);
|
|
17316
|
+
try {
|
|
17317
|
+
await n.startAudio(), console.log("[LiveKit] Audio playback started");
|
|
17318
|
+
} catch (l) {
|
|
17319
|
+
console.warn("[LiveKit] Failed to start audio:", l);
|
|
17320
|
+
}
|
|
17321
|
+
this.updateStatus("connected"), this.isReady = !0, requestAnimationFrame(() => {
|
|
17303
17322
|
this.scheduleTimer(async () => {
|
|
17304
17323
|
if (this.isDestroyed || !this.room || this.room.state !== "connected") {
|
|
17305
17324
|
t && t.getTracks().forEach((l) => l.stop());
|
|
@@ -17307,25 +17326,24 @@ class wd extends EventTarget {
|
|
|
17307
17326
|
}
|
|
17308
17327
|
if (t)
|
|
17309
17328
|
try {
|
|
17310
|
-
const l = !this.isAppleDevice;
|
|
17311
17329
|
await n.localParticipant.setMicrophoneEnabled(!0, {
|
|
17312
|
-
echoCancellation:
|
|
17313
|
-
noiseSuppression:
|
|
17314
|
-
autoGainControl:
|
|
17315
|
-
}), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")), t.getTracks().forEach((
|
|
17330
|
+
echoCancellation: !0,
|
|
17331
|
+
noiseSuppression: !0,
|
|
17332
|
+
autoGainControl: !this.isAppleDevice
|
|
17333
|
+
}), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")), t.getTracks().forEach((l) => l.stop()), this.scheduleTimer(() => {
|
|
17316
17334
|
if (!(this.isDestroyed || !this.room || this.room.state !== "connected"))
|
|
17317
17335
|
try {
|
|
17318
|
-
const
|
|
17319
|
-
if (
|
|
17320
|
-
const
|
|
17321
|
-
|
|
17336
|
+
const l = Array.from(n.localParticipant.audioTrackPublications.values()).find((d) => d.kind === "audio");
|
|
17337
|
+
if (l != null && l.track) {
|
|
17338
|
+
const d = l.track.mediaStreamTrack;
|
|
17339
|
+
d && this.dispatchEvent(
|
|
17322
17340
|
new CustomEvent("local-audio-track", {
|
|
17323
|
-
detail:
|
|
17341
|
+
detail: d
|
|
17324
17342
|
})
|
|
17325
17343
|
);
|
|
17326
17344
|
}
|
|
17327
|
-
} catch (
|
|
17328
|
-
console.warn("[LiveKit] Error getting local audio track:",
|
|
17345
|
+
} catch (l) {
|
|
17346
|
+
console.warn("[LiveKit] Error getting local audio track:", l);
|
|
17329
17347
|
}
|
|
17330
17348
|
}, 100);
|
|
17331
17349
|
} catch (l) {
|
|
@@ -17464,16 +17482,11 @@ class wd extends EventTarget {
|
|
|
17464
17482
|
async toggleMicrophone() {
|
|
17465
17483
|
if (this.room)
|
|
17466
17484
|
try {
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
echoCancellation: e,
|
|
17473
|
-
noiseSuppression: e,
|
|
17474
|
-
autoGainControl: e
|
|
17475
|
-
}), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled"));
|
|
17476
|
-
}
|
|
17485
|
+
this.microphoneEnabled ? (await this.room.localParticipant.setMicrophoneEnabled(!1), this.microphoneEnabled = !1, this.dispatchEvent(new CustomEvent("microphone-disabled"))) : (await this.room.localParticipant.setMicrophoneEnabled(!0, {
|
|
17486
|
+
echoCancellation: !0,
|
|
17487
|
+
noiseSuppression: !0,
|
|
17488
|
+
autoGainControl: !this.isAppleDevice
|
|
17489
|
+
}), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")));
|
|
17477
17490
|
} catch (e) {
|
|
17478
17491
|
this.error = `Failed to toggle microphone: ${e instanceof Error ? e.message : String(e)}`, this.dispatchEvent(
|
|
17479
17492
|
new CustomEvent("error", {
|