realtime-avatar 0.14.0 → 0.16.0
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/README.md +114 -11
- package/dist/{chunk-B3AHTJ3J.js → chunk-2TNFET3Q.js} +1 -1
- package/dist/{chunk-UZQXZH2Z.js → chunk-V26PE2M3.js} +394 -12
- package/dist/express.d.ts +3 -2
- package/dist/express.js +2 -2
- package/dist/hono.d.ts +3 -2
- package/dist/hono.js +2 -2
- package/dist/index.d.ts +9 -3
- package/dist/index.js +1 -1
- package/dist/nextjs.d.ts +3 -2
- package/dist/nextjs.js +2 -2
- package/dist/{proxy-client-DhVdbfQX.d.ts → proxy-client-Bu-5QFhA.d.ts} +72 -7
- package/dist/react-native.d.ts +2 -2
- package/dist/react-native.js +126 -1
- package/dist/react.d.ts +4 -4
- package/dist/react.js +131 -2
- package/dist/recording.d.ts +135 -0
- package/dist/recording.js +43 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tanstack-start.d.ts +3 -2
- package/dist/tanstack-start.js +2 -2
- package/dist/{types-CJcTowDB.d.ts → types-Bphj69NC.d.ts} +1 -1
- package/dist/{types-B9GTrpx0.d.ts → types-VOv0vsFs.d.ts} +279 -5
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as AvatarUpdate, c as AvatarSourceSwap, d as ClipLibraryDeclaration, e as ClipLibraryUpdate, L as LoopRedirect, f as ClipLibrary, g as AssetKind, h as Asset, i as ListSessionsOptions, U as UsageSessionPage, j as UsageSession, k as CreditBalance, T as TranscriptPayload } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as AvatarUpdate, c as AvatarSourceSwap, d as ClipLibraryDeclaration, e as ClipLibraryUpdate, L as LoopRedirect, f as ClipLibrary, g as AssetKind, h as Asset, i as ListSessionsOptions, U as UsageSessionPage, j as UsageSession, k as ListRecordingsQuery, l as ListRecordingsResponse, R as RecordingArtifact, m as RecordingAccessResponse, n as CreditBalance, T as TranscriptPayload } from './types-VOv0vsFs.js';
|
|
2
|
+
export { o as AvatarClip, p as CallConnection, q as CallQueued, r as ClipDeclaration, s as ClipLibraryPlan, t as ClipSource, u as ContextMessage, v as EndCallReason, w as RecordingArtifactStatus, x as RecordingMode, V as VideoPolicy, y as isQueued, z as listRecordingsResponseSchema, B as recordingAccessResponseSchema, D as recordingArtifactSchema, F as recordingModeSchema } from './types-VOv0vsFs.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface RealtimeAvatarOptions {
|
|
@@ -265,6 +265,12 @@ declare class RealtimeAvatar {
|
|
|
265
265
|
* caller writing a monthly report should not have to hold all of them to start writing.
|
|
266
266
|
*/
|
|
267
267
|
iterateSessions(options?: ListSessionsOptions): AsyncGenerator<UsageSession>;
|
|
268
|
+
/** Recording metadata for this account, optionally limited to one call. Requires recordings:read. */
|
|
269
|
+
listRecordings(options?: ListRecordingsQuery): Promise<ListRecordingsResponse>;
|
|
270
|
+
/** Current recording status. Final media can become ready after the call has ended. */
|
|
271
|
+
getRecording(recordingId: string): Promise<RecordingArtifact>;
|
|
272
|
+
/** Renewable playback access. Keep recordingId in storage; URLs expire at expiresAt. */
|
|
273
|
+
getRecordingAccess(recordingId: string): Promise<RecordingAccessResponse>;
|
|
268
274
|
creditBalance(): Promise<CreditBalance>;
|
|
269
275
|
}
|
|
270
276
|
|
|
@@ -356,4 +362,4 @@ declare const clipLibraryDeclarationSchema: z.ZodObject<{
|
|
|
356
362
|
}, z.core.$strict>>>>;
|
|
357
363
|
}, z.core.$strict>;
|
|
358
364
|
|
|
359
|
-
export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreditBalance, EndCallOptions, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, clipLibraryDeclarationSchema, verifyTranscript };
|
|
365
|
+
export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreditBalance, EndCallOptions, ListRecordingsQuery, ListRecordingsResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RecordingAccessResponse, RecordingArtifact, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, clipLibraryDeclarationSchema, verifyTranscript };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, verifyTranscript } from './chunk-
|
|
1
|
+
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript } from './chunk-V26PE2M3.js';
|
package/dist/nextjs.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { P as ProxyConfig } from './types-
|
|
2
|
-
import './types-
|
|
1
|
+
import { P as ProxyConfig } from './types-Bphj69NC.js';
|
|
2
|
+
import './types-VOv0vsFs.js';
|
|
3
|
+
import 'zod';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* App Router. Mount at `app/api/realtime-avatar/[...path]/route.ts`:
|
package/dist/nextjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TrackReferenceOrPlaceholder, useTranscriptions, useConnectionState, LiveKitRoomProps } from '@livekit/components-react';
|
|
2
2
|
import { CSSProperties, ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { ConnectionQuality, DisconnectReason, SendTextOptions } from 'livekit-client';
|
|
3
|
+
import { ConnectionQuality, Room, Participant, Track, DisconnectReason, SendTextOptions } from 'livekit-client';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -141,8 +141,8 @@ declare const liveKitSessionRequestSchema: z.ZodObject<{
|
|
|
141
141
|
queueTicketId: z.ZodOptional<z.ZodString>;
|
|
142
142
|
roomName: z.ZodOptional<z.ZodString>;
|
|
143
143
|
sttMode: z.ZodDefault<z.ZodEnum<{
|
|
144
|
-
server: "server";
|
|
145
144
|
off: "off";
|
|
145
|
+
server: "server";
|
|
146
146
|
}>>;
|
|
147
147
|
voice: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
148
148
|
provider: z.ZodLiteral<"cartesia">;
|
|
@@ -222,6 +222,55 @@ declare const liveKitSessionRequestSchema: z.ZodObject<{
|
|
|
222
222
|
clientMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
223
223
|
}, z.core.$strict>;
|
|
224
224
|
declare const liveKitSessionGrantSchema: z.ZodObject<{
|
|
225
|
+
recording: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
226
|
+
sessionId: z.ZodString;
|
|
227
|
+
recordingId: z.ZodString;
|
|
228
|
+
mode: z.ZodEnum<{
|
|
229
|
+
audio: "audio";
|
|
230
|
+
video: "video";
|
|
231
|
+
audio_video: "audio_video";
|
|
232
|
+
}>;
|
|
233
|
+
createdAt: z.ZodString;
|
|
234
|
+
retainedUntil: z.ZodString;
|
|
235
|
+
status: z.ZodEnum<{
|
|
236
|
+
pending: "pending";
|
|
237
|
+
recording: "recording";
|
|
238
|
+
processing: "processing";
|
|
239
|
+
expired: "expired";
|
|
240
|
+
}>;
|
|
241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
+
sessionId: z.ZodString;
|
|
243
|
+
recordingId: z.ZodString;
|
|
244
|
+
mode: z.ZodEnum<{
|
|
245
|
+
audio: "audio";
|
|
246
|
+
video: "video";
|
|
247
|
+
audio_video: "audio_video";
|
|
248
|
+
}>;
|
|
249
|
+
createdAt: z.ZodString;
|
|
250
|
+
retainedUntil: z.ZodString;
|
|
251
|
+
status: z.ZodLiteral<"ready">;
|
|
252
|
+
mediaType: z.ZodEnum<{
|
|
253
|
+
"audio/mp4": "audio/mp4";
|
|
254
|
+
"video/mp4": "video/mp4";
|
|
255
|
+
}>;
|
|
256
|
+
sizeBytes: z.ZodNumber;
|
|
257
|
+
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
258
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
259
|
+
sessionId: z.ZodString;
|
|
260
|
+
recordingId: z.ZodString;
|
|
261
|
+
mode: z.ZodEnum<{
|
|
262
|
+
audio: "audio";
|
|
263
|
+
video: "video";
|
|
264
|
+
audio_video: "audio_video";
|
|
265
|
+
}>;
|
|
266
|
+
createdAt: z.ZodString;
|
|
267
|
+
retainedUntil: z.ZodString;
|
|
268
|
+
status: z.ZodLiteral<"failed">;
|
|
269
|
+
errorCode: z.ZodEnum<{
|
|
270
|
+
recording_failed: "recording_failed";
|
|
271
|
+
recording_unavailable: "recording_unavailable";
|
|
272
|
+
}>;
|
|
273
|
+
}, z.core.$strict>], "status">>;
|
|
225
274
|
status: z.ZodDefault<z.ZodLiteral<"ready">>;
|
|
226
275
|
session_id: z.ZodString;
|
|
227
276
|
room_name: z.ZodString;
|
|
@@ -230,8 +279,8 @@ declare const liveKitSessionGrantSchema: z.ZodObject<{
|
|
|
230
279
|
participant_identity: z.ZodString;
|
|
231
280
|
reservation_expires_at: z.ZodString;
|
|
232
281
|
stt_mode: z.ZodDefault<z.ZodEnum<{
|
|
233
|
-
server: "server";
|
|
234
282
|
off: "off";
|
|
283
|
+
server: "server";
|
|
235
284
|
}>>;
|
|
236
285
|
room_created: z.ZodDefault<z.ZodBoolean>;
|
|
237
286
|
dispatch_created: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -241,12 +290,12 @@ declare const liveKitSessionGrantSchema: z.ZodObject<{
|
|
|
241
290
|
}, z.core.$loose>;
|
|
242
291
|
declare const sessionEndReasonSchema: z.ZodEnum<{
|
|
243
292
|
idle: "idle";
|
|
293
|
+
failed: "failed";
|
|
244
294
|
user_ended: "user_ended";
|
|
245
295
|
session_cap: "session_cap";
|
|
246
296
|
disconnected: "disconnected";
|
|
247
297
|
out_of_credits: "out_of_credits";
|
|
248
298
|
agent_ended: "agent_ended";
|
|
249
|
-
failed: "failed";
|
|
250
299
|
}>;
|
|
251
300
|
type SessionEndReasonLabel = z.infer<typeof sessionEndReasonSchema>;
|
|
252
301
|
declare const approachingEndReasonSchema: z.ZodEnum<{
|
|
@@ -1291,8 +1340,24 @@ type RealtimeSessionRoomSinks = Partial<{
|
|
|
1291
1340
|
audio: "flowing" | "silent";
|
|
1292
1341
|
}) => void;
|
|
1293
1342
|
}>;
|
|
1343
|
+
type PublisherConnectionDetails = Readonly<{
|
|
1344
|
+
publisherQuality: Participant["connectionQuality"];
|
|
1345
|
+
streamState: Track["streamState"] | null;
|
|
1346
|
+
}>;
|
|
1347
|
+
/** Current native connection facts. Track activity does not prove rendered or audible media. */
|
|
1348
|
+
type AvatarConnectionDetails = Readonly<{
|
|
1349
|
+
connectionState: Room["state"];
|
|
1350
|
+
localQuality: Participant["connectionQuality"];
|
|
1351
|
+
audio: PublisherConnectionDetails | null;
|
|
1352
|
+
video: PublisherConnectionDetails | null;
|
|
1353
|
+
}>;
|
|
1294
1354
|
type SessionLifecycleRoomBridgeProps = {
|
|
1295
|
-
|
|
1355
|
+
/**
|
|
1356
|
+
* Opt in to an initial snapshot and changed facts. Null clears a retired binding.
|
|
1357
|
+
* Callback failures never affect the call; no stats polling or uploads are added.
|
|
1358
|
+
*/
|
|
1359
|
+
onConnectionDetailsChange?: (details: AvatarConnectionDetails | null) => void;
|
|
1360
|
+
lifecycle: Pick<SessionLifecycleApi, "onConnectionStateChange" | "setAgentPresent" | "registerLeaveRoom" | "markActivity"> & Partial<Pick<SessionLifecycleApi, "grant">> & RealtimeSessionRoomSinks;
|
|
1296
1361
|
};
|
|
1297
1362
|
/**
|
|
1298
1363
|
* Wire the in-room LiveKit facts into a {@link useSessionLifecycle} instance:
|
|
@@ -1311,7 +1376,7 @@ type SessionLifecycleRoomBridgeProps = {
|
|
|
1311
1376
|
*
|
|
1312
1377
|
* Renders nothing. Mount it once inside RealtimeAvatarLiveKitRoom.
|
|
1313
1378
|
*/
|
|
1314
|
-
declare function SessionLifecycleRoomBridge({ lifecycle }: SessionLifecycleRoomBridgeProps): null;
|
|
1379
|
+
declare function SessionLifecycleRoomBridge({ lifecycle, onConnectionDetailsChange, }: SessionLifecycleRoomBridgeProps): null;
|
|
1315
1380
|
|
|
1316
1381
|
/**
|
|
1317
1382
|
* The terminal, LABELED end reason surfaced to the app via `onEnded`. This is the
|
|
@@ -1646,4 +1711,4 @@ interface ProxyClientOptions {
|
|
|
1646
1711
|
}
|
|
1647
1712
|
declare function createProxyClient(options: ProxyClientOptions): AvatarSessionClient;
|
|
1648
1713
|
|
|
1649
|
-
export {
|
|
1714
|
+
export { type QualityCap as $, type AvatarVideoFit as A, type BehaviorSnapshot as B, type CallTranscript as C, DEFAULT_APPROACHING_END_LEAD_SECONDS as D, type EndReason as E, type FishTtsModel as F, type Governor as G, type GovernorState as H, type GraceWindowClosedEvent as I, type GraceWindowOpenEvent as J, type GraceWindowState as K, type LiveKitSessionGrant as L, type IdleWarningEvent as M, type InboundRtpCursor as N, type InboundRtpReading as O, type KnownBehaviorState as P, type LLMProvider as Q, type LLMSelection as R, type LiveKitAvatarGrantState as S, type LiveKitAvatarGrantStatus as T, type LiveKitCapacityState as U, type LiveKitConnectionStatus as V, type LiveKitSessionRequest as W, type LiveKitSessionStartResult as X, MAX_RECONNECT_ATTEMPTS as Y, MAX_SESSION_INSTRUCTIONS_CHARS as Z, type ProxyClientOptions as _, AdaptivePlayoutController as a, RECONNECT_BACKOFF_MS as a0, type RealtimeAvatarRequestOptions as a1, type RealtimeSessionApi as a2, type RealtimeSessionMedia as a3, type RealtimeSessionRoomSinks as a4, type ReconnectPolicy as a5, type ReconnectingEvent as a6, type RecoveryState as a7, type RetryStep as a8, type SessionBehavior as a9, splitCallTranscript as aA, useAvatarAdaptivePlayoutDelay as aB, useAvatarPlayoutDelay as aC, useAvatarQualityGovernor as aD, useCallTranscript as aE, useLiveKitAvatarGrant as aF, useLiveTrackProducing as aG, useMicLease as aH, useRealtimeSession as aI, useReleaseMicLeaseOnTrackEnded as aJ, useSessionLifecycle as aK, AvatarVideoSurface as aL, type AvatarVideoSurfaceProps as aM, type LivePlaybackKeeper as aN, MIC_LEASE_ENDED_TIMEOUT_MS as aO, type MicLease as aP, NETWORK_QUALITY_POLICY as aQ, type NetworkQualityStatus as aR, type PlayableVideoElement as aS, RealtimeAvatarCapacityError as aT, RealtimeAvatarLiveKitRoom as aU, type RealtimeAvatarLiveKitRoomProps as aV, shouldReplayPendingTurn as aW, type SessionClip as aa, type SessionClocks as ab, type SessionEndReason as ac, type SessionLifecycleApi as ad, type SessionLifecyclePhase as ae, type SessionLifecyclePhaseKind as af, SessionLifecycleRoomBridge as ag, type SessionLifecycleRoomBridgeProps as ah, type SurfaceLayers as ai, type TurnState as aj, type TurnTimeoutEvent as ak, type UseAvatarQualityGovernorInput as al, type UseLiveKitAvatarGrantInput as am, type UseRealtimeSessionInput as an, type UseSessionLifecycleInput as ao, type VoiceSpec as ap, type VoiceSpecInput as aq, capacityErrorFromBusy as ar, capacityStateFromGrant as as, createProxyClient as at, isNativeLiveTrackSubscribed as au, knownBehaviorStates as av, mapTurnState as aw, readInboundRtp as ax, sessionBehaviorSchema as ay, sessionClipSchema as az, type AdaptivePlayoutDecision as b, type AdaptivePlayoutOptions as c, type AdaptivePlayoutSample as d, type ApproachingEndEvent as e, type ApproachingEndReason as f, type AvatarConnectionDetails as g, type AvatarSessionClient as h, type CallTranscriptSegment as i, type CartesiaTtsModel as j, type ClipResult as k, type ClosingTurnResult as l, type CreditsLowEvent as m, DEFAULT_CREDITS_LOW_LEAD_SECONDS as n, DEFAULT_GOVERNOR_CONFIG as o, DEFAULT_GRACE_CEILING_SECONDS as p, DEFAULT_GRACE_WINDOW_LEAD_SECONDS as q, DEFAULT_IDLE_SECONDS as r, DEFAULT_IDLE_WARN_LEAD_SECONDS as s, DEFAULT_TURN_TIMEOUT_SECONDS as t, type EndedEvent as u, type ExtendResult as v, type FreezeReadingFn as w, type GovernorAction as x, type GovernorConfig as y, type GovernorSignal as z };
|
package/dist/react-native.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LiveKitRoomProps } from '@livekit/react-native';
|
|
2
2
|
export { AudioSession, VideoTrack, VideoTrackProps, registerGlobals } from '@livekit/react-native';
|
|
3
3
|
import { ReactNode, ReactElement } from 'react';
|
|
4
|
-
import { L as LiveKitSessionGrant, A as AvatarVideoFit } from './proxy-client-
|
|
5
|
-
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarSessionClient, B as BehaviorSnapshot, C as CallTranscript,
|
|
4
|
+
import { L as LiveKitSessionGrant, A as AvatarVideoFit } from './proxy-client-Bu-5QFhA.js';
|
|
5
|
+
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, h as AvatarSessionClient, B as BehaviorSnapshot, C as CallTranscript, i as CallTranscriptSegment, j as CartesiaTtsModel, k as ClipResult, l as ClosingTurnResult, m as CreditsLowEvent, D as DEFAULT_APPROACHING_END_LEAD_SECONDS, n as DEFAULT_CREDITS_LOW_LEAD_SECONDS, o as DEFAULT_GOVERNOR_CONFIG, p as DEFAULT_GRACE_CEILING_SECONDS, q as DEFAULT_GRACE_WINDOW_LEAD_SECONDS, r as DEFAULT_IDLE_SECONDS, s as DEFAULT_IDLE_WARN_LEAD_SECONDS, t as DEFAULT_TURN_TIMEOUT_SECONDS, E as EndReason, u as EndedEvent, v as ExtendResult, F as FishTtsModel, w as FreezeReadingFn, G as Governor, x as GovernorAction, y as GovernorConfig, z as GovernorSignal, H as GovernorState, I as GraceWindowClosedEvent, J as GraceWindowOpenEvent, K as GraceWindowState, M as IdleWarningEvent, N as InboundRtpCursor, O as InboundRtpReading, P as KnownBehaviorState, Q as LLMProvider, R as LLMSelection, S as LiveKitAvatarGrantState, T as LiveKitAvatarGrantStatus, U as LiveKitCapacityState, V as LiveKitConnectionStatus, W as LiveKitSessionRequest, X as LiveKitSessionStartResult, Y as MAX_RECONNECT_ATTEMPTS, Z as MAX_SESSION_INSTRUCTIONS_CHARS, _ as ProxyClientOptions, $ as QualityCap, a0 as RECONNECT_BACKOFF_MS, a1 as RealtimeAvatarRequestOptions, a2 as RealtimeSessionApi, a3 as RealtimeSessionMedia, a4 as RealtimeSessionRoomSinks, a5 as ReconnectPolicy, a6 as ReconnectingEvent, a7 as RecoveryState, a8 as RetryStep, a9 as SessionBehavior, aa as SessionClip, ab as SessionClocks, ac as SessionEndReason, ad as SessionLifecycleApi, ae as SessionLifecyclePhase, af as SessionLifecyclePhaseKind, ag as SessionLifecycleRoomBridge, ah as SessionLifecycleRoomBridgeProps, ai as SurfaceLayers, aj as TurnState, ak as TurnTimeoutEvent, al as UseAvatarQualityGovernorInput, am as UseLiveKitAvatarGrantInput, an as UseRealtimeSessionInput, ao as UseSessionLifecycleInput, ap as VoiceSpec, aq as VoiceSpecInput, ar as capacityErrorFromBusy, as as capacityStateFromGrant, at as createProxyClient, au as isNativeLiveTrackSubscribed, av as knownBehaviorStates, aw as mapTurnState, ax as readInboundRtp, ay as sessionBehaviorSchema, az as sessionClipSchema, aA as splitCallTranscript, aB as useAvatarAdaptivePlayoutDelay, aC as useAvatarPlayoutDelay, aD as useAvatarQualityGovernor, aE as useCallTranscript, aF as useLiveKitAvatarGrant, aG as useLiveTrackProducing, aH as useMicLease, aI as useRealtimeSession, aJ as useReleaseMicLeaseOnTrackEnded, aK as useSessionLifecycle } from './proxy-client-Bu-5QFhA.js';
|
|
6
6
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
7
7
|
export { useChat, useConnectionState, useLocalParticipant, useRoomContext, useTrackToggle, useTranscriptions, useVoiceAssistant } from '@livekit/components-react';
|
|
8
8
|
export { D as DEFAULT_AVATAR_PLAYOUT_DELAY_SECONDS } from './playout-delay-DWOc8iCl.js';
|
package/dist/react-native.js
CHANGED
|
@@ -1388,6 +1388,46 @@ var styles = StyleSheet.create({
|
|
|
1388
1388
|
fontVariant: ["tabular-nums"]
|
|
1389
1389
|
}
|
|
1390
1390
|
});
|
|
1391
|
+
var RECORDED_MEDIA_MODES = ["audio", "video", "audio_video"];
|
|
1392
|
+
var recordingModeSchema = z.enum(["off", ...RECORDED_MEDIA_MODES]).describe("Server-owned recording policy; omitted means off. Audio includes user and avatar audio.");
|
|
1393
|
+
var RECORDING_STATUSES = ["pending", "recording", "processing", "ready", "failed", "expired"];
|
|
1394
|
+
z.enum(RECORDING_STATUSES);
|
|
1395
|
+
var recordingMetadataSchema = z.object({
|
|
1396
|
+
sessionId: z.string().min(1),
|
|
1397
|
+
recordingId: z.string().min(1),
|
|
1398
|
+
mode: recordingModeSchema.exclude(["off"]),
|
|
1399
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
1400
|
+
retainedUntil: z.string().datetime({ offset: true })
|
|
1401
|
+
});
|
|
1402
|
+
var recordingArtifactSchema = z.discriminatedUnion("status", [
|
|
1403
|
+
recordingMetadataSchema.extend({ status: z.enum(["pending", "recording", "processing", "expired"]) }).strict(),
|
|
1404
|
+
recordingMetadataSchema.extend({
|
|
1405
|
+
status: z.literal("ready"),
|
|
1406
|
+
mediaType: z.enum(["audio/mp4", "video/mp4"]),
|
|
1407
|
+
sizeBytes: z.number().int().positive(),
|
|
1408
|
+
durationMs: z.number().int().nonnegative().nullable()
|
|
1409
|
+
}).strict(),
|
|
1410
|
+
recordingMetadataSchema.extend({
|
|
1411
|
+
status: z.literal("failed"),
|
|
1412
|
+
errorCode: z.enum(["recording_failed", "recording_unavailable"])
|
|
1413
|
+
}).strict()
|
|
1414
|
+
]);
|
|
1415
|
+
z.object({
|
|
1416
|
+
sessionId: z.string().min(1).optional(),
|
|
1417
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
1418
|
+
cursor: z.string().min(1).optional()
|
|
1419
|
+
}).strict();
|
|
1420
|
+
z.object({
|
|
1421
|
+
data: z.array(recordingArtifactSchema),
|
|
1422
|
+
nextCursor: z.string().nullable()
|
|
1423
|
+
}).strict();
|
|
1424
|
+
z.object({
|
|
1425
|
+
recordingId: z.string().min(1),
|
|
1426
|
+
url: z.string().url(),
|
|
1427
|
+
expiresAt: z.string().datetime({ offset: true })
|
|
1428
|
+
}).strict();
|
|
1429
|
+
|
|
1430
|
+
// ../client/src/wire.ts
|
|
1391
1431
|
var DEFAULT_AVATAR_ID = "maria";
|
|
1392
1432
|
var DEFAULT_BACKGROUND_ID = "plain_white";
|
|
1393
1433
|
var sessionModeSchema = z.enum(["avatar", "voice"]);
|
|
@@ -1617,6 +1657,7 @@ z.object({
|
|
|
1617
1657
|
clientMetadata: clientMetadataSchema.optional()
|
|
1618
1658
|
}).strict();
|
|
1619
1659
|
z.object({
|
|
1660
|
+
recording: recordingArtifactSchema.optional(),
|
|
1620
1661
|
status: z.literal("ready").default("ready"),
|
|
1621
1662
|
session_id: z.string().min(1),
|
|
1622
1663
|
room_name: z.string().min(1),
|
|
@@ -2175,7 +2216,10 @@ function useSessionLifecycle(input) {
|
|
|
2175
2216
|
]
|
|
2176
2217
|
);
|
|
2177
2218
|
}
|
|
2178
|
-
function SessionLifecycleRoomBridge({
|
|
2219
|
+
function SessionLifecycleRoomBridge({
|
|
2220
|
+
lifecycle,
|
|
2221
|
+
onConnectionDetailsChange
|
|
2222
|
+
}) {
|
|
2179
2223
|
const {
|
|
2180
2224
|
onConnectionStateChange,
|
|
2181
2225
|
setAgentPresent,
|
|
@@ -2198,6 +2242,87 @@ function SessionLifecycleRoomBridge({ lifecycle }) {
|
|
|
2198
2242
|
const audioLive = Boolean(assistant.audioTrack);
|
|
2199
2243
|
const transcriptionCount = transcriptions.length;
|
|
2200
2244
|
const prevTranscriptionCountRef = useRef(0);
|
|
2245
|
+
const audio = assistant.audioTrack;
|
|
2246
|
+
const video = assistant.videoTrack;
|
|
2247
|
+
const detailsEnabled = onConnectionDetailsChange !== void 0 && lifecycle.grant !== null;
|
|
2248
|
+
const detailsSessionId = lifecycle.grant?.session_id;
|
|
2249
|
+
const updateDetailsRef = useRef(null);
|
|
2250
|
+
useEffect(() => {
|
|
2251
|
+
if (!detailsEnabled || !onConnectionDetailsChange) return;
|
|
2252
|
+
let callback = onConnectionDetailsChange;
|
|
2253
|
+
let audioSource = audio;
|
|
2254
|
+
let videoSource = video;
|
|
2255
|
+
let closed = false;
|
|
2256
|
+
let pending = false;
|
|
2257
|
+
let previous;
|
|
2258
|
+
const deliver = (details) => {
|
|
2259
|
+
try {
|
|
2260
|
+
void Promise.resolve(callback(details)).catch(() => {
|
|
2261
|
+
});
|
|
2262
|
+
} catch {
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
const publisher = (source) => source ? {
|
|
2266
|
+
publisherQuality: source.participant.connectionQuality,
|
|
2267
|
+
streamState: source.publication.track?.streamState ?? null
|
|
2268
|
+
} : null;
|
|
2269
|
+
const schedule = () => {
|
|
2270
|
+
if (pending) return;
|
|
2271
|
+
pending = true;
|
|
2272
|
+
queueMicrotask(() => {
|
|
2273
|
+
pending = false;
|
|
2274
|
+
if (closed) return;
|
|
2275
|
+
const next = {
|
|
2276
|
+
connectionState: room.state,
|
|
2277
|
+
localQuality: room.localParticipant.connectionQuality,
|
|
2278
|
+
audio: publisher(audioSource),
|
|
2279
|
+
video: publisher(videoSource)
|
|
2280
|
+
};
|
|
2281
|
+
const last = previous;
|
|
2282
|
+
if (last?.connectionState === next.connectionState && last.localQuality === next.localQuality && ["audio", "video"].every((kind) => last[kind]?.publisherQuality === next[kind]?.publisherQuality && last[kind]?.streamState === next[kind]?.streamState)) return;
|
|
2283
|
+
previous = next;
|
|
2284
|
+
deliver(next);
|
|
2285
|
+
});
|
|
2286
|
+
};
|
|
2287
|
+
const onQuality = (_quality, participant) => {
|
|
2288
|
+
if (participant === room.localParticipant || participant === audioSource?.participant || participant === videoSource?.participant) schedule();
|
|
2289
|
+
};
|
|
2290
|
+
const onPublication = (publication) => {
|
|
2291
|
+
if (publication === audioSource?.publication || publication === videoSource?.publication) schedule();
|
|
2292
|
+
};
|
|
2293
|
+
const onTrack = (_track, publication) => onPublication(publication);
|
|
2294
|
+
room.on(RoomEvent.ConnectionStateChanged, schedule);
|
|
2295
|
+
room.on(RoomEvent.ConnectionQualityChanged, onQuality);
|
|
2296
|
+
room.on(RoomEvent.TrackStreamStateChanged, onPublication);
|
|
2297
|
+
room.on(RoomEvent.TrackSubscribed, onTrack);
|
|
2298
|
+
room.on(RoomEvent.TrackUnsubscribed, onTrack);
|
|
2299
|
+
updateDetailsRef.current = (nextCallback, nextAudio, nextVideo) => {
|
|
2300
|
+
callback = nextCallback;
|
|
2301
|
+
audioSource = nextAudio;
|
|
2302
|
+
videoSource = nextVideo;
|
|
2303
|
+
schedule();
|
|
2304
|
+
};
|
|
2305
|
+
schedule();
|
|
2306
|
+
return () => {
|
|
2307
|
+
closed = true;
|
|
2308
|
+
updateDetailsRef.current = null;
|
|
2309
|
+
room.off(RoomEvent.ConnectionStateChanged, schedule);
|
|
2310
|
+
room.off(RoomEvent.ConnectionQualityChanged, onQuality);
|
|
2311
|
+
room.off(RoomEvent.TrackStreamStateChanged, onPublication);
|
|
2312
|
+
room.off(RoomEvent.TrackSubscribed, onTrack);
|
|
2313
|
+
room.off(RoomEvent.TrackUnsubscribed, onTrack);
|
|
2314
|
+
deliver(null);
|
|
2315
|
+
};
|
|
2316
|
+
}, [room, detailsSessionId, detailsEnabled]);
|
|
2317
|
+
useEffect(() => {
|
|
2318
|
+
if (onConnectionDetailsChange) updateDetailsRef.current?.(onConnectionDetailsChange, audio, video);
|
|
2319
|
+
}, [
|
|
2320
|
+
onConnectionDetailsChange,
|
|
2321
|
+
detailsEnabled ? audio?.participant : void 0,
|
|
2322
|
+
detailsEnabled ? audio?.publication : void 0,
|
|
2323
|
+
detailsEnabled ? video?.participant : void 0,
|
|
2324
|
+
detailsEnabled ? video?.publication : void 0
|
|
2325
|
+
]);
|
|
2201
2326
|
useEffect(() => {
|
|
2202
2327
|
onConnectionStateChange(connectionState);
|
|
2203
2328
|
}, [connectionState, onConnectionStateChange]);
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RegisteredTool, ToolRegistration } from './tools.js';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason,
|
|
3
|
+
import { ah as SessionLifecycleRoomBridgeProps, h as AvatarSessionClient, A as AvatarVideoFit } from './proxy-client-Bu-5QFhA.js';
|
|
4
|
+
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, aL as AvatarVideoSurface, aM as AvatarVideoSurfaceProps, B as BehaviorSnapshot, C as CallTranscript, i as CallTranscriptSegment, j as CartesiaTtsModel, k as ClipResult, l as ClosingTurnResult, m as CreditsLowEvent, D as DEFAULT_APPROACHING_END_LEAD_SECONDS, n as DEFAULT_CREDITS_LOW_LEAD_SECONDS, o as DEFAULT_GOVERNOR_CONFIG, p as DEFAULT_GRACE_CEILING_SECONDS, q as DEFAULT_GRACE_WINDOW_LEAD_SECONDS, r as DEFAULT_IDLE_SECONDS, s as DEFAULT_IDLE_WARN_LEAD_SECONDS, t as DEFAULT_TURN_TIMEOUT_SECONDS, E as EndReason, u as EndedEvent, v as ExtendResult, F as FishTtsModel, w as FreezeReadingFn, G as Governor, x as GovernorAction, y as GovernorConfig, z as GovernorSignal, H as GovernorState, I as GraceWindowClosedEvent, J as GraceWindowOpenEvent, K as GraceWindowState, M as IdleWarningEvent, N as InboundRtpCursor, O as InboundRtpReading, P as KnownBehaviorState, Q as LLMProvider, R as LLMSelection, S as LiveKitAvatarGrantState, T as LiveKitAvatarGrantStatus, U as LiveKitCapacityState, V as LiveKitConnectionStatus, W as LiveKitSessionRequest, X as LiveKitSessionStartResult, aN as LivePlaybackKeeper, Y as MAX_RECONNECT_ATTEMPTS, Z as MAX_SESSION_INSTRUCTIONS_CHARS, aO as MIC_LEASE_ENDED_TIMEOUT_MS, aP as MicLease, aQ as NETWORK_QUALITY_POLICY, aR as NetworkQualityStatus, aS as PlayableVideoElement, _ as ProxyClientOptions, $ as QualityCap, a0 as RECONNECT_BACKOFF_MS, aT as RealtimeAvatarCapacityError, aU as RealtimeAvatarLiveKitRoom, aV as RealtimeAvatarLiveKitRoomProps, a1 as RealtimeAvatarRequestOptions, a2 as RealtimeSessionApi, a3 as RealtimeSessionMedia, a4 as RealtimeSessionRoomSinks, a5 as ReconnectPolicy, a6 as ReconnectingEvent, a7 as RecoveryState, a8 as RetryStep, a9 as SessionBehavior, aa as SessionClip, ab as SessionClocks, ac as SessionEndReason, ad as SessionLifecycleApi, ae as SessionLifecyclePhase, af as SessionLifecyclePhaseKind, ag as SessionLifecycleRoomBridge, ai as SurfaceLayers, aj as TurnState, ak as TurnTimeoutEvent, al as UseAvatarQualityGovernorInput, am as UseLiveKitAvatarGrantInput, an as UseRealtimeSessionInput, ao as UseSessionLifecycleInput, ap as VoiceSpec, aq as VoiceSpecInput, ar as capacityErrorFromBusy, as as capacityStateFromGrant, at as createProxyClient, av as knownBehaviorStates, aw as mapTurnState, ax as readInboundRtp, ay as sessionBehaviorSchema, az as sessionClipSchema, aW as shouldReplayPendingTurn, aA as splitCallTranscript, aB as useAvatarAdaptivePlayoutDelay, aC as useAvatarPlayoutDelay, aD as useAvatarQualityGovernor, aE as useCallTranscript, aF as useLiveKitAvatarGrant, aH as useMicLease, aI as useRealtimeSession, aJ as useReleaseMicLeaseOnTrackEnded, aK as useSessionLifecycle } from './proxy-client-Bu-5QFhA.js';
|
|
5
5
|
export { D as DEFAULT_AVATAR_PLAYOUT_DELAY_SECONDS } from './playout-delay-DWOc8iCl.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '@livekit/components-react';
|
|
@@ -82,7 +82,7 @@ type AvatarCallHandle = {
|
|
|
82
82
|
/** End now. */
|
|
83
83
|
end: () => void;
|
|
84
84
|
};
|
|
85
|
-
type AvatarCallProps = {
|
|
85
|
+
type AvatarCallProps = Pick<SessionLifecycleRoomBridgeProps, "onConnectionDetailsChange"> & {
|
|
86
86
|
client: AvatarSessionClient;
|
|
87
87
|
/** Which character. */
|
|
88
88
|
avatarId: string;
|
|
@@ -129,4 +129,4 @@ declare function useAvatarCall(props: AvatarCallProps): {
|
|
|
129
129
|
/** One component: a live character on screen. */
|
|
130
130
|
declare function AvatarCall(props: AvatarCallProps): ReactNode;
|
|
131
131
|
|
|
132
|
-
export { AvatarCall, type AvatarCallEndReason, type AvatarCallHandle, type AvatarCallProps, type AvatarCallStatus, AvatarSessionClient, AvatarVideoFit, DEFAULT_AVATAR_UNSTABLE_STALL_MS, useAvatarCall, useCharacterTools };
|
|
132
|
+
export { AvatarCall, type AvatarCallEndReason, type AvatarCallHandle, type AvatarCallProps, type AvatarCallStatus, AvatarSessionClient, AvatarVideoFit, DEFAULT_AVATAR_UNSTABLE_STALL_MS, SessionLifecycleRoomBridgeProps, useAvatarCall, useCharacterTools };
|
package/dist/react.js
CHANGED
|
@@ -1922,6 +1922,46 @@ var AVATAR_VIDEO_FIT_COVER = "object-cover";
|
|
|
1922
1922
|
var AVATAR_VIDEO_LIVE_WRAP = "absolute inset-0 z-20 size-full transition-opacity ease-out";
|
|
1923
1923
|
var AVATAR_VIDEO_BADGE = "absolute top-2 right-2 z-30 inline-flex items-center gap-1.5 rounded-md bg-black/55 px-1.5 py-0.5 font-mono text-[10px] text-white/85 backdrop-blur-sm";
|
|
1924
1924
|
var AVATAR_VIDEO_BADGE_DOT = "size-1.5 rounded-full bg-emerald-400";
|
|
1925
|
+
var RECORDED_MEDIA_MODES = ["audio", "video", "audio_video"];
|
|
1926
|
+
var recordingModeSchema = z.enum(["off", ...RECORDED_MEDIA_MODES]).describe("Server-owned recording policy; omitted means off. Audio includes user and avatar audio.");
|
|
1927
|
+
var RECORDING_STATUSES = ["pending", "recording", "processing", "ready", "failed", "expired"];
|
|
1928
|
+
z.enum(RECORDING_STATUSES);
|
|
1929
|
+
var recordingMetadataSchema = z.object({
|
|
1930
|
+
sessionId: z.string().min(1),
|
|
1931
|
+
recordingId: z.string().min(1),
|
|
1932
|
+
mode: recordingModeSchema.exclude(["off"]),
|
|
1933
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
1934
|
+
retainedUntil: z.string().datetime({ offset: true })
|
|
1935
|
+
});
|
|
1936
|
+
var recordingArtifactSchema = z.discriminatedUnion("status", [
|
|
1937
|
+
recordingMetadataSchema.extend({ status: z.enum(["pending", "recording", "processing", "expired"]) }).strict(),
|
|
1938
|
+
recordingMetadataSchema.extend({
|
|
1939
|
+
status: z.literal("ready"),
|
|
1940
|
+
mediaType: z.enum(["audio/mp4", "video/mp4"]),
|
|
1941
|
+
sizeBytes: z.number().int().positive(),
|
|
1942
|
+
durationMs: z.number().int().nonnegative().nullable()
|
|
1943
|
+
}).strict(),
|
|
1944
|
+
recordingMetadataSchema.extend({
|
|
1945
|
+
status: z.literal("failed"),
|
|
1946
|
+
errorCode: z.enum(["recording_failed", "recording_unavailable"])
|
|
1947
|
+
}).strict()
|
|
1948
|
+
]);
|
|
1949
|
+
z.object({
|
|
1950
|
+
sessionId: z.string().min(1).optional(),
|
|
1951
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
1952
|
+
cursor: z.string().min(1).optional()
|
|
1953
|
+
}).strict();
|
|
1954
|
+
z.object({
|
|
1955
|
+
data: z.array(recordingArtifactSchema),
|
|
1956
|
+
nextCursor: z.string().nullable()
|
|
1957
|
+
}).strict();
|
|
1958
|
+
z.object({
|
|
1959
|
+
recordingId: z.string().min(1),
|
|
1960
|
+
url: z.string().url(),
|
|
1961
|
+
expiresAt: z.string().datetime({ offset: true })
|
|
1962
|
+
}).strict();
|
|
1963
|
+
|
|
1964
|
+
// ../client/src/wire.ts
|
|
1925
1965
|
var DEFAULT_AVATAR_ID = "maria";
|
|
1926
1966
|
var DEFAULT_BACKGROUND_ID = "plain_white";
|
|
1927
1967
|
var sessionModeSchema = z.enum(["avatar", "voice"]);
|
|
@@ -2151,6 +2191,7 @@ z.object({
|
|
|
2151
2191
|
clientMetadata: clientMetadataSchema.optional()
|
|
2152
2192
|
}).strict();
|
|
2153
2193
|
z.object({
|
|
2194
|
+
recording: recordingArtifactSchema.optional(),
|
|
2154
2195
|
status: z.literal("ready").default("ready"),
|
|
2155
2196
|
session_id: z.string().min(1),
|
|
2156
2197
|
room_name: z.string().min(1),
|
|
@@ -2714,7 +2755,10 @@ function useSessionLifecycle(input) {
|
|
|
2714
2755
|
]
|
|
2715
2756
|
);
|
|
2716
2757
|
}
|
|
2717
|
-
function SessionLifecycleRoomBridge({
|
|
2758
|
+
function SessionLifecycleRoomBridge({
|
|
2759
|
+
lifecycle,
|
|
2760
|
+
onConnectionDetailsChange
|
|
2761
|
+
}) {
|
|
2718
2762
|
const {
|
|
2719
2763
|
onConnectionStateChange,
|
|
2720
2764
|
setAgentPresent,
|
|
@@ -2737,6 +2781,87 @@ function SessionLifecycleRoomBridge({ lifecycle }) {
|
|
|
2737
2781
|
const audioLive = Boolean(assistant.audioTrack);
|
|
2738
2782
|
const transcriptionCount = transcriptions.length;
|
|
2739
2783
|
const prevTranscriptionCountRef = useRef(0);
|
|
2784
|
+
const audio = assistant.audioTrack;
|
|
2785
|
+
const video = assistant.videoTrack;
|
|
2786
|
+
const detailsEnabled = onConnectionDetailsChange !== void 0 && lifecycle.grant !== null;
|
|
2787
|
+
const detailsSessionId = lifecycle.grant?.session_id;
|
|
2788
|
+
const updateDetailsRef = useRef(null);
|
|
2789
|
+
useEffect(() => {
|
|
2790
|
+
if (!detailsEnabled || !onConnectionDetailsChange) return;
|
|
2791
|
+
let callback = onConnectionDetailsChange;
|
|
2792
|
+
let audioSource = audio;
|
|
2793
|
+
let videoSource = video;
|
|
2794
|
+
let closed = false;
|
|
2795
|
+
let pending = false;
|
|
2796
|
+
let previous;
|
|
2797
|
+
const deliver = (details) => {
|
|
2798
|
+
try {
|
|
2799
|
+
void Promise.resolve(callback(details)).catch(() => {
|
|
2800
|
+
});
|
|
2801
|
+
} catch {
|
|
2802
|
+
}
|
|
2803
|
+
};
|
|
2804
|
+
const publisher = (source) => source ? {
|
|
2805
|
+
publisherQuality: source.participant.connectionQuality,
|
|
2806
|
+
streamState: source.publication.track?.streamState ?? null
|
|
2807
|
+
} : null;
|
|
2808
|
+
const schedule = () => {
|
|
2809
|
+
if (pending) return;
|
|
2810
|
+
pending = true;
|
|
2811
|
+
queueMicrotask(() => {
|
|
2812
|
+
pending = false;
|
|
2813
|
+
if (closed) return;
|
|
2814
|
+
const next = {
|
|
2815
|
+
connectionState: room.state,
|
|
2816
|
+
localQuality: room.localParticipant.connectionQuality,
|
|
2817
|
+
audio: publisher(audioSource),
|
|
2818
|
+
video: publisher(videoSource)
|
|
2819
|
+
};
|
|
2820
|
+
const last = previous;
|
|
2821
|
+
if (last?.connectionState === next.connectionState && last.localQuality === next.localQuality && ["audio", "video"].every((kind) => last[kind]?.publisherQuality === next[kind]?.publisherQuality && last[kind]?.streamState === next[kind]?.streamState)) return;
|
|
2822
|
+
previous = next;
|
|
2823
|
+
deliver(next);
|
|
2824
|
+
});
|
|
2825
|
+
};
|
|
2826
|
+
const onQuality = (_quality, participant) => {
|
|
2827
|
+
if (participant === room.localParticipant || participant === audioSource?.participant || participant === videoSource?.participant) schedule();
|
|
2828
|
+
};
|
|
2829
|
+
const onPublication = (publication) => {
|
|
2830
|
+
if (publication === audioSource?.publication || publication === videoSource?.publication) schedule();
|
|
2831
|
+
};
|
|
2832
|
+
const onTrack = (_track, publication) => onPublication(publication);
|
|
2833
|
+
room.on(RoomEvent.ConnectionStateChanged, schedule);
|
|
2834
|
+
room.on(RoomEvent.ConnectionQualityChanged, onQuality);
|
|
2835
|
+
room.on(RoomEvent.TrackStreamStateChanged, onPublication);
|
|
2836
|
+
room.on(RoomEvent.TrackSubscribed, onTrack);
|
|
2837
|
+
room.on(RoomEvent.TrackUnsubscribed, onTrack);
|
|
2838
|
+
updateDetailsRef.current = (nextCallback, nextAudio, nextVideo) => {
|
|
2839
|
+
callback = nextCallback;
|
|
2840
|
+
audioSource = nextAudio;
|
|
2841
|
+
videoSource = nextVideo;
|
|
2842
|
+
schedule();
|
|
2843
|
+
};
|
|
2844
|
+
schedule();
|
|
2845
|
+
return () => {
|
|
2846
|
+
closed = true;
|
|
2847
|
+
updateDetailsRef.current = null;
|
|
2848
|
+
room.off(RoomEvent.ConnectionStateChanged, schedule);
|
|
2849
|
+
room.off(RoomEvent.ConnectionQualityChanged, onQuality);
|
|
2850
|
+
room.off(RoomEvent.TrackStreamStateChanged, onPublication);
|
|
2851
|
+
room.off(RoomEvent.TrackSubscribed, onTrack);
|
|
2852
|
+
room.off(RoomEvent.TrackUnsubscribed, onTrack);
|
|
2853
|
+
deliver(null);
|
|
2854
|
+
};
|
|
2855
|
+
}, [room, detailsSessionId, detailsEnabled]);
|
|
2856
|
+
useEffect(() => {
|
|
2857
|
+
if (onConnectionDetailsChange) updateDetailsRef.current?.(onConnectionDetailsChange, audio, video);
|
|
2858
|
+
}, [
|
|
2859
|
+
onConnectionDetailsChange,
|
|
2860
|
+
detailsEnabled ? audio?.participant : void 0,
|
|
2861
|
+
detailsEnabled ? audio?.publication : void 0,
|
|
2862
|
+
detailsEnabled ? video?.participant : void 0,
|
|
2863
|
+
detailsEnabled ? video?.publication : void 0
|
|
2864
|
+
]);
|
|
2740
2865
|
useEffect(() => {
|
|
2741
2866
|
onConnectionStateChange(connectionState);
|
|
2742
2867
|
}, [connectionState, onConnectionStateChange]);
|
|
@@ -3306,7 +3431,11 @@ function useAvatarCall(props) {
|
|
|
3306
3431
|
onDisconnected: session.onDisconnected,
|
|
3307
3432
|
onError: session.onConnectionError
|
|
3308
3433
|
},
|
|
3309
|
-
createElement(SessionLifecycleRoomBridge, {
|
|
3434
|
+
createElement(SessionLifecycleRoomBridge, {
|
|
3435
|
+
key: "bridge",
|
|
3436
|
+
lifecycle: session,
|
|
3437
|
+
onConnectionDetailsChange: props.onConnectionDetailsChange
|
|
3438
|
+
}),
|
|
3310
3439
|
createElement(
|
|
3311
3440
|
AvatarVideoSurface,
|
|
3312
3441
|
{
|