hanc-webrtc-widgets 2.2.12 → 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,15 +17259,30 @@ 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({ audio: !0, video: !1 }), console.log("Microphone permission granted");
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
  }
17268
17281
  this.updateStatus("connecting"), this.error = null, this.isReady = !1, this.room && (await this.room.disconnect(), this.room = null);
17269
17282
  try {
17270
- const n = new rr();
17283
+ const n = new rr({
17284
+ webAudioMix: !0
17285
+ });
17271
17286
  this.room = n, this.setupRoomEventListeners(n);
17272
17287
  let s;
17273
17288
  try {
@@ -17297,7 +17312,13 @@ class wd extends EventTarget {
17297
17312
  );
17298
17313
  }
17299
17314
  const { token: r, url: a, room_name: o, user_identity: c } = await s.json();
17300
- this.roomName = o, this.userIdentity = c, this.reconnectAttempts = 0, this.wasConnectedBeforeHidden = !1, await this.connectWithTimeout(n, a, r, 2e4), this.updateStatus("connected"), this.isReady = !0, requestAnimationFrame(() => {
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(() => {
17301
17322
  this.scheduleTimer(async () => {
17302
17323
  if (this.isDestroyed || !this.room || this.room.state !== "connected") {
17303
17324
  t && t.getTracks().forEach((l) => l.stop());
@@ -17308,7 +17329,7 @@ class wd extends EventTarget {
17308
17329
  await n.localParticipant.setMicrophoneEnabled(!0, {
17309
17330
  echoCancellation: !0,
17310
17331
  noiseSuppression: !0,
17311
- autoGainControl: !0
17332
+ autoGainControl: !this.isAppleDevice
17312
17333
  }), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")), t.getTracks().forEach((l) => l.stop()), this.scheduleTimer(() => {
17313
17334
  if (!(this.isDestroyed || !this.room || this.room.state !== "connected"))
17314
17335
  try {
@@ -17464,7 +17485,7 @@ class wd extends EventTarget {
17464
17485
  this.microphoneEnabled ? (await this.room.localParticipant.setMicrophoneEnabled(!1), this.microphoneEnabled = !1, this.dispatchEvent(new CustomEvent("microphone-disabled"))) : (await this.room.localParticipant.setMicrophoneEnabled(!0, {
17465
17486
  echoCancellation: !0,
17466
17487
  noiseSuppression: !0,
17467
- autoGainControl: !0
17488
+ autoGainControl: !this.isAppleDevice
17468
17489
  }), this.microphoneEnabled = !0, this.dispatchEvent(new CustomEvent("microphone-enabled")));
17469
17490
  } catch (e) {
17470
17491
  this.error = `Failed to toggle microphone: ${e instanceof Error ? e.message : String(e)}`, this.dispatchEvent(