@voxevolv/client 0.3.8 → 0.3.9
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.
- package/CHANGELOG.md +15 -1
- package/README.md +8 -2
- package/dist/browser/index.js +6 -6
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/index.js.sha384 +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
sha384-
|
|
1
|
+
sha384-YJPEzRjEvJoelZ3d8GASAE50gNnBP++VY44ngX0TUMrlOILX82q+TNHt+ARYud2r
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface SessionCredentials {
|
|
|
19
19
|
access_token: string;
|
|
20
20
|
access_token_expires_at: string;
|
|
21
21
|
}
|
|
22
|
-
export declare const SDK_VERSION = "0.3.
|
|
22
|
+
export declare const SDK_VERSION = "0.3.9";
|
|
23
23
|
type Listener = (event: RealtimeEvent) => void;
|
|
24
24
|
type StateListener = (state: ConnectionState) => void;
|
|
25
25
|
type GapListener = (gap: EventGap) => void;
|
|
@@ -183,9 +183,12 @@ export declare class RealtimeSession {
|
|
|
183
183
|
private startupConnectController;
|
|
184
184
|
private startupAttemptController;
|
|
185
185
|
private useManagedMicrophone;
|
|
186
|
-
private
|
|
186
|
+
private microphoneEnabled;
|
|
187
187
|
private applicationAudioTrack;
|
|
188
|
+
private localApplicationAudioTrack;
|
|
188
189
|
private readonly connectDefaults;
|
|
190
|
+
private recoveryReadiness;
|
|
191
|
+
private credentialRefreshGeneration;
|
|
189
192
|
private readonly fetcher;
|
|
190
193
|
private readonly endEndpoint;
|
|
191
194
|
private readonly refreshCredentialsCallback;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAIL,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAUL,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAElB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,QAAQ,EACR,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,YAAY,GACZ,qBAAqB,GACrB,WAAW,GACX,cAAc,GACd,UAAU,GACV,cAAc,GACd,QAAQ,CAAC;AAEb,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,WAAW,GACX,MAAM,GACN,MAAM,GACN,MAAM,CAAC;AAEX,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,M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B,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,eAAe;YA+BT,aAAa;IAuC3B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,oBAAoB;YAgBd,cAAc;YAmBd,kBAAkB;YAqBlB,oBAAoB;IAgBlC,OAAO,CAAC,wBAAwB;IAiEhC,OAAO,CAAC,mBAAmB;YAMb,4BAA4B;YAwB5B,SAAS;YAkBT,kBAAkB;IAiFhC,OAAO,CAAC,oBAAoB;YAWd,YAAY;IAyB1B,OAAO,CAAC,qBAAqB;YAiBf,wBAAwB;YA2DxB,cAAc;IAO5B,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,gCAAgC;IASxC,OAAO,CAAC,gBAAgB;YAIV,eAAe;IAiD7B,OAAO,CAAC,uBAAuB;IA4B/B,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,oBAAoB;IA+C5B,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,mBAAmB;YAuBb,WAAW;CAkE1B"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectionState as LiveKitConnectionState, DataPacket_Kind, DisconnectReason, Room, RoomEvent, RpcError, Track, } from "livekit-client";
|
|
1
|
+
import { ConnectionState as LiveKitConnectionState, DataPacket_Kind, DisconnectReason, LocalAudioTrack, Room, RoomEvent, RpcError, Track, } from "livekit-client";
|
|
2
2
|
import { createClientMessage, CommandError, EventCursor, isCommandAckPayload, isCommandErrorPayload, isContextRejectedPayload, isContextUpdatePayload, isContextUpdatedPayload, isRealtimeEvent, } from "./protocol.js";
|
|
3
3
|
import { ContextDeliveryError, contextRetryDelay, ReplacementContextQueue } from "./context-queue.js";
|
|
4
4
|
import { ClientDiagnosticBuffer, DiagnosticDeliveryError, } from "./diagnostics.js";
|
|
@@ -6,7 +6,7 @@ import { TranscriptStore } from "./transcripts.js";
|
|
|
6
6
|
export { TranscriptStore } from "./transcripts.js";
|
|
7
7
|
export { CommandError, EventCursor, createClientMessage, isCommandAckPayload, isCommandErrorPayload, isContextRejectedPayload, isContextUpdatePayload, isContextUpdatedPayload, isRealtimeEvent, } from "./protocol.js";
|
|
8
8
|
export { decodeAgentSnapshotPayload, decodeClientHelloPayload, decodeClientMessage, decodeCommandAckPayload, decodeCommandErrorPayload, decodeContextRejectedPayload, decodeContextUpdatePayload, decodeContextUpdatedPayload, decodeRealtimeEvent, } from "./generated/protocol-codecs.js";
|
|
9
|
-
export const SDK_VERSION = "0.3.
|
|
9
|
+
export const SDK_VERSION = "0.3.9";
|
|
10
10
|
const CLIENT_HELLO_TIMEOUT_MS = 30_000;
|
|
11
11
|
const DIAGNOSTIC_REPORT_TIMEOUT_MS = 5_000;
|
|
12
12
|
const DEFAULT_STARTUP_ATTEMPTS = [
|
|
@@ -99,9 +99,12 @@ export class RealtimeSession {
|
|
|
99
99
|
startupConnectController = null;
|
|
100
100
|
startupAttemptController = null;
|
|
101
101
|
useManagedMicrophone = true;
|
|
102
|
-
|
|
102
|
+
microphoneEnabled = true;
|
|
103
103
|
applicationAudioTrack = null;
|
|
104
|
+
localApplicationAudioTrack = null;
|
|
104
105
|
connectDefaults;
|
|
106
|
+
recoveryReadiness;
|
|
107
|
+
credentialRefreshGeneration = 0;
|
|
105
108
|
fetcher;
|
|
106
109
|
endEndpoint;
|
|
107
110
|
refreshCredentialsCallback;
|
|
@@ -123,6 +126,10 @@ export class RealtimeSession {
|
|
|
123
126
|
? (options.connect ?? {})
|
|
124
127
|
: { ...options.connect, apiBase: normalizeApiBase(options.connect.apiBase) };
|
|
125
128
|
this.apiBase = this.connectDefaults.apiBase ?? this.apiBase;
|
|
129
|
+
this.recoveryReadiness = {
|
|
130
|
+
readyTimeoutMs: this.connectDefaults.readyTimeoutMs ?? 15_000,
|
|
131
|
+
waitForRemoteAudio: this.connectDefaults.waitForRemoteAudio ?? true,
|
|
132
|
+
};
|
|
126
133
|
this.fetcher = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
127
134
|
this.endEndpoint = options.endEndpoint ?? null;
|
|
128
135
|
this.refreshCredentialsCallback = options.refreshCredentials ?? null;
|
|
@@ -334,6 +341,9 @@ export class RealtimeSession {
|
|
|
334
341
|
};
|
|
335
342
|
}
|
|
336
343
|
async connect(options = {}) {
|
|
344
|
+
if (this.startupConnectController || this.manualRejoinController) {
|
|
345
|
+
throw new Error("A session connection attempt is already in progress");
|
|
346
|
+
}
|
|
337
347
|
if (["connecting", "connected_not_ready", "connected", "reconnecting", "resuming"]
|
|
338
348
|
.includes(this.stateValue)) {
|
|
339
349
|
throw new Error(`Cannot connect while session is ${this.stateValue}`);
|
|
@@ -341,6 +351,17 @@ export class RealtimeSession {
|
|
|
341
351
|
this.cancelRecovery();
|
|
342
352
|
const controller = new AbortController();
|
|
343
353
|
this.startupConnectController = controller;
|
|
354
|
+
this.credentialRefreshGeneration += 1;
|
|
355
|
+
const resolved = { ...this.connectDefaults, ...options };
|
|
356
|
+
// Keep caller preferences separate from temporary startup-attempt budgets.
|
|
357
|
+
this.recoveryReadiness = {
|
|
358
|
+
readyTimeoutMs: resolved.readyTimeoutMs ?? 15_000,
|
|
359
|
+
waitForRemoteAudio: resolved.waitForRemoteAudio ?? true,
|
|
360
|
+
};
|
|
361
|
+
this.microphoneEnabled = resolved.audioTrack
|
|
362
|
+
? resolved.audioTrack.enabled !== false
|
|
363
|
+
: resolved.microphone ?? true;
|
|
364
|
+
this.setState("connecting");
|
|
344
365
|
try {
|
|
345
366
|
if (this.startupRetryOptions) {
|
|
346
367
|
await this.connectWithStartupRetry(options, controller);
|
|
@@ -397,6 +418,7 @@ export class RealtimeSession {
|
|
|
397
418
|
await this.registerStartupRecovery(remainingMs, attemptController.signal);
|
|
398
419
|
startupRegistered = true;
|
|
399
420
|
}
|
|
421
|
+
throwIfAborted(attemptController.signal);
|
|
400
422
|
if (index === 0) {
|
|
401
423
|
await this.connectWithMode({ ...options, readyTimeoutMs: attempt.readyTimeoutMs }, false, attemptController.signal, false);
|
|
402
424
|
}
|
|
@@ -439,7 +461,7 @@ export class RealtimeSession {
|
|
|
439
461
|
const controller = createLinkedAbortController(signal);
|
|
440
462
|
const requestTimeout = globalThis.setTimeout(() => {
|
|
441
463
|
controller.abort(new Error("Startup registration timed out"));
|
|
442
|
-
}, Math.max(1,
|
|
464
|
+
}, Math.max(1, reserveMs));
|
|
443
465
|
try {
|
|
444
466
|
// Leave room for registration latency and final readiness before the
|
|
445
467
|
// browser's existing overall deadline. Rejoins never renew this window.
|
|
@@ -452,7 +474,7 @@ export class RealtimeSession {
|
|
|
452
474
|
}), controller.signal);
|
|
453
475
|
let response = await send();
|
|
454
476
|
if (response.status === 401 && this.refreshCredentialsCallback) {
|
|
455
|
-
await
|
|
477
|
+
await this.refreshCredentials(controller.signal);
|
|
456
478
|
response = await send();
|
|
457
479
|
}
|
|
458
480
|
if (!response.ok)
|
|
@@ -477,6 +499,7 @@ export class RealtimeSession {
|
|
|
477
499
|
});
|
|
478
500
|
}
|
|
479
501
|
async connectWithMode(options, recovering, signal, markFailureTerminal = true) {
|
|
502
|
+
throwIfAborted(signal);
|
|
480
503
|
const blockedStates = recovering
|
|
481
504
|
? ["connecting", "connected_not_ready", "connected", "reconnecting"]
|
|
482
505
|
: ["connecting", "connected_not_ready", "connected", "reconnecting", "resuming"];
|
|
@@ -495,8 +518,6 @@ export class RealtimeSession {
|
|
|
495
518
|
const apiBase = normalizeApiBase(resolved.apiBase ?? this.apiBase);
|
|
496
519
|
this.validateAudioOptions(microphone, audioTrack);
|
|
497
520
|
this.useManagedMicrophone = microphone;
|
|
498
|
-
if (!recovering)
|
|
499
|
-
this.managedMicrophoneEnabled = microphone;
|
|
500
521
|
this.applicationAudioTrack = audioTrack;
|
|
501
522
|
if (!recovering) {
|
|
502
523
|
this.sessionEnded = false;
|
|
@@ -520,7 +541,7 @@ export class RealtimeSession {
|
|
|
520
541
|
await raceWithAbort(this.publishApplicationAudioTrack(audioTrack), signal);
|
|
521
542
|
}
|
|
522
543
|
else if (microphone) {
|
|
523
|
-
await raceWithAbort(this.room.localParticipant.setMicrophoneEnabled(this.
|
|
544
|
+
await raceWithAbort(this.room.localParticipant.setMicrophoneEnabled(this.microphoneEnabled), signal);
|
|
524
545
|
}
|
|
525
546
|
throwIfAborted(signal);
|
|
526
547
|
this.setState(recovering ? "resuming" : "connected_not_ready");
|
|
@@ -595,10 +616,13 @@ export class RealtimeSession {
|
|
|
595
616
|
});
|
|
596
617
|
}
|
|
597
618
|
async rejoin(apiBase = this.apiBase) {
|
|
619
|
+
if (this.startupConnectController || this.manualRejoinController) {
|
|
620
|
+
throw new Error("A session connection attempt is already in progress");
|
|
621
|
+
}
|
|
598
622
|
if (this.sessionEnded) {
|
|
599
623
|
throw this.terminalSessionError ?? new Error("Cannot rejoin a session that has ended");
|
|
600
624
|
}
|
|
601
|
-
if (["connecting", "reconnecting", "resuming"].includes(this.stateValue)) {
|
|
625
|
+
if (["connecting", "connected_not_ready", "reconnecting", "resuming"].includes(this.stateValue)) {
|
|
602
626
|
throw new Error(`Cannot rejoin while session is ${this.stateValue}`);
|
|
603
627
|
}
|
|
604
628
|
this.cancelRecovery();
|
|
@@ -633,13 +657,13 @@ export class RealtimeSession {
|
|
|
633
657
|
}
|
|
634
658
|
}
|
|
635
659
|
async performRejoin(apiBase, options = {}) {
|
|
636
|
-
const { signal, recovering = true, connect
|
|
660
|
+
const { signal, recovering = true, connect, markFailureTerminal = true, } = options;
|
|
637
661
|
this.contextGeneration += 1;
|
|
638
662
|
this.replacementContext.pause();
|
|
639
663
|
this.rejectPendingCommands(new Error("Restoring the session"));
|
|
640
664
|
let response = await this.fetchRoomToken(apiBase, signal);
|
|
641
665
|
if (response.status === 401 && this.refreshCredentialsCallback) {
|
|
642
|
-
await
|
|
666
|
+
await this.refreshCredentials(signal);
|
|
643
667
|
throwIfAborted(signal);
|
|
644
668
|
response = await this.fetchRoomToken(apiBase, signal);
|
|
645
669
|
}
|
|
@@ -655,6 +679,7 @@ export class RealtimeSession {
|
|
|
655
679
|
throw await raceWithAbort(httpError(response, "Could not renew room token"), signal);
|
|
656
680
|
}
|
|
657
681
|
const payload = (await raceWithAbort(response.json(), signal));
|
|
682
|
+
throwIfAborted(signal);
|
|
658
683
|
this.credentials = payload.connection;
|
|
659
684
|
if (this.room.state !== LiveKitConnectionState.Disconnected) {
|
|
660
685
|
this.disconnectMode = "rejoin";
|
|
@@ -673,16 +698,28 @@ export class RealtimeSession {
|
|
|
673
698
|
duration_ms: Date.now() - this.reconnectStartedAt,
|
|
674
699
|
};
|
|
675
700
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
701
|
+
// Startup retries resolve the original caller options with constructor defaults.
|
|
702
|
+
// A later rejoin restores the audio settings saved by the previous connection.
|
|
703
|
+
const connectionOptions = connect ?? {
|
|
704
|
+
...this.recoveryReadiness,
|
|
679
705
|
microphone: this.useManagedMicrophone,
|
|
680
706
|
...(this.applicationAudioTrack ? { audioTrack: this.applicationAudioTrack } : {}),
|
|
681
|
-
}
|
|
707
|
+
};
|
|
708
|
+
await this.connectWithMode({ ...connectionOptions, apiBase }, recovering, signal, markFailureTerminal);
|
|
682
709
|
}
|
|
683
710
|
async setMicrophoneEnabled(enabled) {
|
|
711
|
+
// Recovery must see the user's latest intent while the media operation waits.
|
|
712
|
+
this.microphoneEnabled = enabled;
|
|
713
|
+
if (this.applicationAudioTrack) {
|
|
714
|
+
// The room may not know this track yet while publication is pending.
|
|
715
|
+
const track = this.localApplicationAudioTrack;
|
|
716
|
+
if (enabled)
|
|
717
|
+
await track?.unmute();
|
|
718
|
+
else
|
|
719
|
+
await track?.mute();
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
684
722
|
await this.room.localParticipant.setMicrophoneEnabled(enabled);
|
|
685
|
-
this.managedMicrophoneEnabled = enabled;
|
|
686
723
|
}
|
|
687
724
|
async sendCommand(type, payload, timeoutMs = 10_000) {
|
|
688
725
|
const message = createClientMessage(this.connectionId, ++this.clientSeq, type, payload);
|
|
@@ -866,6 +903,7 @@ export class RealtimeSession {
|
|
|
866
903
|
this.failRecovery(new Error("Session disconnected during recovery"));
|
|
867
904
|
this.cancelRecovery();
|
|
868
905
|
this.contextGeneration += 1;
|
|
906
|
+
this.localApplicationAudioTrack = null;
|
|
869
907
|
this.replacementContext.clear(new Error("Session disconnected"));
|
|
870
908
|
if (this.stateValue === "disconnected")
|
|
871
909
|
return;
|
|
@@ -881,6 +919,7 @@ export class RealtimeSession {
|
|
|
881
919
|
}
|
|
882
920
|
}
|
|
883
921
|
async end(options = {}) {
|
|
922
|
+
this.credentialRefreshGeneration += 1;
|
|
884
923
|
this.abortStartupConnect(new Error("Session ended"));
|
|
885
924
|
this.startupConnectController = null;
|
|
886
925
|
this.failRecovery(new Error("Session ended during recovery"));
|
|
@@ -900,7 +939,7 @@ export class RealtimeSession {
|
|
|
900
939
|
credentials: request.credentials ?? this.lifecycleCredentials,
|
|
901
940
|
});
|
|
902
941
|
if (response.status === 401 && usesScopedSessionEndpoint && this.refreshCredentialsCallback) {
|
|
903
|
-
await this.refreshCredentials();
|
|
942
|
+
await this.refreshCredentials(request.signal ?? undefined);
|
|
904
943
|
headers.set("Authorization", `Bearer ${this.accessToken}`);
|
|
905
944
|
response = await this.fetcher(endpoint, {
|
|
906
945
|
...request,
|
|
@@ -1086,9 +1125,9 @@ export class RealtimeSession {
|
|
|
1086
1125
|
this.setState(this.hasConnectedValue ? "resuming" : "connected_not_ready");
|
|
1087
1126
|
try {
|
|
1088
1127
|
await this.sendHello();
|
|
1089
|
-
const deadline = Date.now() +
|
|
1128
|
+
const deadline = Date.now() + this.recoveryReadiness.readyTimeoutMs;
|
|
1090
1129
|
await this.waitForAgentReady(Math.max(deadline - Date.now(), 0));
|
|
1091
|
-
if (this.
|
|
1130
|
+
if (this.recoveryReadiness.waitForRemoteAudio)
|
|
1092
1131
|
await this.waitForRemoteAudioTrack(deadline);
|
|
1093
1132
|
if (this.sessionEnded || generation !== this.contextGeneration)
|
|
1094
1133
|
return;
|
|
@@ -1371,10 +1410,18 @@ export class RealtimeSession {
|
|
|
1371
1410
|
signal?.removeEventListener("abort", cancel);
|
|
1372
1411
|
}
|
|
1373
1412
|
}
|
|
1374
|
-
async refreshCredentials() {
|
|
1413
|
+
async refreshCredentials(signal) {
|
|
1375
1414
|
if (!this.refreshCredentialsCallback)
|
|
1376
1415
|
return;
|
|
1377
|
-
|
|
1416
|
+
throwIfAborted(signal);
|
|
1417
|
+
const connectionGeneration = this.contextGeneration;
|
|
1418
|
+
const refreshGeneration = ++this.credentialRefreshGeneration;
|
|
1419
|
+
const refreshed = await raceWithAbort(this.refreshCredentialsCallback(), signal);
|
|
1420
|
+
throwIfAborted(signal);
|
|
1421
|
+
if (connectionGeneration !== this.contextGeneration
|
|
1422
|
+
|| refreshGeneration !== this.credentialRefreshGeneration) {
|
|
1423
|
+
throw new Error("Credential refresh was superseded");
|
|
1424
|
+
}
|
|
1378
1425
|
validateSessionCredentials(refreshed);
|
|
1379
1426
|
if (refreshed.id !== this.id) {
|
|
1380
1427
|
throw new Error("Refreshed credentials belong to a different session");
|
|
@@ -1469,15 +1516,26 @@ export class RealtimeSession {
|
|
|
1469
1516
|
}
|
|
1470
1517
|
}
|
|
1471
1518
|
async publishApplicationAudioTrack(audioTrack) {
|
|
1472
|
-
const
|
|
1519
|
+
const clonedTrack = audioTrack.clone();
|
|
1520
|
+
let publishedTrack = null;
|
|
1473
1521
|
try {
|
|
1522
|
+
publishedTrack = new LocalAudioTrack(clonedTrack, undefined, true);
|
|
1523
|
+
this.localApplicationAudioTrack = publishedTrack;
|
|
1524
|
+
if (!this.microphoneEnabled) {
|
|
1525
|
+
// LiveKit can re-enable a raw track when wrapping it. Mute the wrapper
|
|
1526
|
+
// before publication so recovery cannot briefly transmit muted input.
|
|
1527
|
+
await publishedTrack.mute();
|
|
1528
|
+
}
|
|
1474
1529
|
await this.room.localParticipant.publishTrack(publishedTrack, {
|
|
1475
1530
|
source: Track.Source.Microphone,
|
|
1476
1531
|
name: "voxevolv-application-audio",
|
|
1477
1532
|
});
|
|
1478
1533
|
}
|
|
1479
1534
|
catch (error) {
|
|
1480
|
-
publishedTrack
|
|
1535
|
+
if (this.localApplicationAudioTrack === publishedTrack) {
|
|
1536
|
+
this.localApplicationAudioTrack = null;
|
|
1537
|
+
}
|
|
1538
|
+
clonedTrack.stop();
|
|
1481
1539
|
throw error;
|
|
1482
1540
|
}
|
|
1483
1541
|
}
|
|
@@ -1911,7 +1969,7 @@ export class RealtimeSession {
|
|
|
1911
1969
|
signal,
|
|
1912
1970
|
}), signal);
|
|
1913
1971
|
if (response.status === 401 && this.refreshCredentialsCallback) {
|
|
1914
|
-
await
|
|
1972
|
+
await this.refreshCredentials(signal);
|
|
1915
1973
|
response = await raceWithAbort(this.fetcher(url, {
|
|
1916
1974
|
headers: { Authorization: `Bearer ${this.accessToken}` },
|
|
1917
1975
|
credentials: this.lifecycleCredentials,
|