@urun-sh/core 0.2.56 → 0.2.57

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/dist/internal.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __urunCreateRequire } from 'node:module'; const require = globalThis.require ?? __urunCreateRequire(import.meta.url);
2
- import{E as r,H as t,I as n,J as a,K as s,M as p,N as m,O as c,S as i,T as l,U as S,V as f,W as x,X as C,Y as D,a as e,b as o}from"./chunk-ROHOB3GT.mjs";export{e as ChannelMultiplexer,l as DOC_SYNC_WIRE_CONTRACT_VERSION,o as DeferredChannelMultiplexer,x as DeferredDocConnector,p as LoopbackStreamData,C as SessionDocumentImpl,i as TransportSession,r as allocateSession,D as createPresence,f as createWebsocketDocConnector,S as deriveYjsServerUrl,s as ensureNodeWebRTC,t as isNodeRuntime,n as nodeMediasoupHandlerName,a as nodeWebRTCUnavailableReason,c as streamDataLabel,m as transportStreamData};
2
+ import{E as r,H as t,I as n,J as a,K as s,O as p,P as m,Q as c,U as i,V as l,W as S,X as f,Y as x,Z as C,_ as D,a as e,b as o}from"./chunk-GR7O2DMI.mjs";export{e as ChannelMultiplexer,l as DOC_SYNC_WIRE_CONTRACT_VERSION,o as DeferredChannelMultiplexer,x as DeferredDocConnector,p as LoopbackStreamData,C as SessionDocumentImpl,i as TransportSession,r as allocateSession,D as createPresence,f as createWebsocketDocConnector,S as deriveYjsServerUrl,s as ensureNodeWebRTC,t as isNodeRuntime,n as nodeMediasoupHandlerName,a as nodeWebRTCUnavailableReason,c as streamDataLabel,m as transportStreamData};
@@ -263,6 +263,10 @@ interface TransportSessionOptions {
263
263
 
264
264
  audioPlayout?: AudioPlayoutOptions;
265
265
 
266
+ videoPlayout?: VideoPlayoutOptions;
267
+
268
+ sessionStats?: SessionStatsOptions;
269
+
266
270
  diagnosticSink?: (diagnostic: SessionDiagnostic) => void;
267
271
  }
268
272
 
@@ -271,6 +275,57 @@ interface AudioPlayoutOptions {
271
275
  jitterBufferTargetMs?: number;
272
276
  }
273
277
 
278
+ interface VideoPlayoutOptions {
279
+
280
+ jitterBufferTargetMs?: number;
281
+ }
282
+
283
+ interface SessionStatsOptions {
284
+
285
+ pollMs?: number;
286
+ }
287
+
288
+ interface InboundStatsSample {
289
+
290
+ consumerId: string;
291
+
292
+ total: number;
293
+ framesDecoded: number | null;
294
+
295
+ jitter: number | null;
296
+ packetsReceived: number | null;
297
+ packetsLost: number | null;
298
+ nackCount: number | null;
299
+ pliCount: number | null;
300
+ firCount: number | null;
301
+ keyFramesDecoded: number | null;
302
+ framesReceived: number | null;
303
+ framesDropped: number | null;
304
+ retransmittedPacketsReceived: number | null;
305
+ retransmittedBytesReceived: number | null;
306
+ jitterBufferDelay: number | null;
307
+ jitterBufferEmittedCount: number | null;
308
+
309
+ estimatedPlayoutTimestamp: number | null;
310
+ jitterBufferTargetDelay: number | null;
311
+ jitterBufferMinimumDelay: number | null;
312
+ concealedSamples: number | null;
313
+ insertedSamplesForDeceleration: number | null;
314
+ }
315
+
316
+ interface SessionStatsSample {
317
+
318
+ timestamp: number;
319
+
320
+ stream: string | null;
321
+
322
+ avSyncMs: number | null;
323
+
324
+ audio: InboundStatsSample | null;
325
+
326
+ video: InboundStatsSample | null;
327
+ }
328
+
274
329
  interface MediaLivenessOptions {
275
330
 
276
331
  pollMs?: number;
@@ -424,6 +479,8 @@ interface Session {
424
479
 
425
480
  onActivation?(handler: (event: ActivationEvent) => void): () => void;
426
481
 
482
+ onStats?(handler: (sample: SessionStatsSample) => void): () => void;
483
+
427
484
  whenLive(options?: {
428
485
  timeout?: number;
429
486
  signal?: AbortSignal;
@@ -550,6 +607,10 @@ interface AppOptions {
550
607
  priority?: 'preempt';
551
608
 
552
609
  audioPlayout?: AudioPlayoutOptions;
610
+
611
+ videoPlayout?: VideoPlayoutOptions;
612
+
613
+ sessionStats?: SessionStatsOptions;
553
614
  }
554
615
  interface AccessTokenOptions$1 {
555
616
  forceRefresh?: boolean;
@@ -750,6 +811,8 @@ interface TransportEvents {
750
811
 
751
812
  diagnostic: (diagnostic: SessionDiagnostic) => void;
752
813
 
814
+ stats: (sample: SessionStatsSample) => void;
815
+
753
816
  seeked: (stream: string, target: number | 'live') => void;
754
817
 
755
818
  signal: (msg: Record<string, unknown>) => void;
@@ -822,6 +885,10 @@ declare class TransportSession {
822
885
 
823
886
  private _mediaProbeTimer;
824
887
 
888
+ private _statsTimer;
889
+
890
+ private _statsSampleInFlight;
891
+
825
892
  private _joinProbes;
826
893
 
827
894
  private _decodeDeathHandled;
@@ -838,6 +905,8 @@ declare class TransportSession {
838
905
 
839
906
  private _streamDataHandlers;
840
907
 
908
+ private _streamDataLane;
909
+
841
910
  private _dataProducers;
842
911
 
843
912
  private _dataProducerPromises;
@@ -914,6 +983,14 @@ declare class TransportSession {
914
983
 
915
984
  private _dispatchStreamData;
916
985
 
986
+ markStreamDataLaneQuic(): void;
987
+
988
+ dispatchQuicStreamData(name: string, payload: unknown): void;
989
+
990
+ raiseQuicStreamDataError(err: Error): void;
991
+
992
+ quicStreamDataLaneLost(reason: string): void;
993
+
917
994
  private _streamNameFromLabel;
918
995
 
919
996
  mediaUnavailableReason(): string | null;
@@ -962,9 +1039,9 @@ declare class TransportSession {
962
1039
  private _onConsumeData;
963
1040
  private _onConsume;
964
1041
 
965
- private _audioJitterBufferTargetMs;
1042
+ private _jitterBufferTargetMs;
966
1043
 
967
- private _capAudioJitterBuffer;
1044
+ private _capJitterBuffer;
968
1045
 
969
1046
  private _closeConsumer;
970
1047
 
@@ -976,6 +1053,13 @@ declare class TransportSession {
976
1053
  private _startMediaProbe;
977
1054
  private _stopMediaProbe;
978
1055
 
1056
+ private _statsPollMs;
1057
+ private _startStatsSampler;
1058
+ private _stopStatsSampler;
1059
+
1060
+ private _lanePairKey;
1061
+ private _sampleSessionStats;
1062
+
979
1063
  private _resetJoinProbes;
980
1064
  private _sampleMediaArrival;
981
1065
 
@@ -1103,4 +1187,4 @@ interface DataChannelTransport {
1103
1187
 
1104
1188
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
1105
1189
 
1106
- export { type SessionEndResult as $, type AccessTokenOptions$1 as A, type PrewakeResult as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type PrewakeStatus as E, type RecordingBucket as F, type RecordingLifecycle as G, type RecordingStatus as H, type RecordingsAccessor as I, type ReleaseSessionBeaconOptions as J, type RequestOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RequestStreamOptions as N, type RuntimeArtifact as O, type Presence as P, type RuntimeArtifactDownload as Q, type Recording as R, type RuntimeArtifactsAccessor as S, type RuntimeAvailability as T, type RuntimeWakeDetail as U, type RuntimeWakeGolden as V, type RuntimeWakeReasonCode as W, type Session as X, type SessionDiagnostic as Y, type SessionDocument as Z, SessionDocumentImpl as _, type AccessTokenOptions as a, type SessionFailureKind as a0, type SessionPhase as a1, type SessionPhaseError as a2, type SessionPhaseName as a3, type SessionStartOptions as a4, type SessionStatus as a5, type SessionStream as a6, type SessionText as a7, type Store as a8, type StoreOptions as a9, type StreamChunkOptions as aa, type StreamDataTransport as ab, TransportSession as ac, type TransportSessionOptions as ad, type TransportState as ae, allocateSession as af, createPresence as ag, createWebsocketDocConnector as ah, deriveYjsServerUrl as ai, derivedLegName as aj, derivedLegRole as ak, isPendingRecording as al, mediaRecorderChunkSource as am, prewake as an, releaseSessionBeacon as ao, streamDataLabel as ap, transportStreamData as aq, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type AudioPlayoutOptions as i, type ChannelMessage as j, ChannelMultiplexer as k, type ChannelName as l, type ChunkReadable as m, DOC_SYNC_WIRE_CONTRACT_VERSION as n, DeferredChannelMultiplexer as o, DeferredDocConnector as p, type DerivedLegRole as q, type DocConnection as r, type DocConnectionState as s, type DocConnector as t, type DocTokenSupplier as u, type MediaChunkSource as v, type MediaChunkSourceFactory as w, type MediaRecorderChunkSourceOptions as x, type PresenceState as y, type PrewakeOptions as z };
1190
+ export { SessionDocumentImpl as $, type AccessTokenOptions$1 as A, type PrewakeResult as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type PrewakeStatus as E, type RecordingBucket as F, type RecordingLifecycle as G, type RecordingStatus as H, type InboundStatsSample as I, type RecordingsAccessor as J, type ReleaseSessionBeaconOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RequestOptions as N, type RequestStreamOptions as O, type Presence as P, type RuntimeArtifact as Q, type Recording as R, type RuntimeArtifactDownload as S, type RuntimeArtifactsAccessor as T, type RuntimeAvailability as U, type RuntimeWakeDetail as V, type RuntimeWakeGolden as W, type RuntimeWakeReasonCode as X, type Session as Y, type SessionDiagnostic as Z, type SessionDocument as _, type AccessTokenOptions as a, type SessionEndResult as a0, type SessionFailureKind as a1, type SessionPhase as a2, type SessionPhaseError as a3, type SessionPhaseName as a4, type SessionStartOptions as a5, type SessionStatsOptions as a6, type SessionStatsSample as a7, type SessionStatus as a8, type SessionStream as a9, type SessionText as aa, type Store as ab, type StoreOptions as ac, type StreamChunkOptions as ad, type StreamDataTransport as ae, TransportSession as af, type TransportSessionOptions as ag, type TransportState as ah, type VideoPlayoutOptions as ai, allocateSession as aj, createPresence as ak, createWebsocketDocConnector as al, deriveYjsServerUrl as am, derivedLegName as an, derivedLegRole as ao, isPendingRecording as ap, mediaRecorderChunkSource as aq, prewake as ar, releaseSessionBeacon as as, streamDataLabel as at, transportStreamData as au, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type AudioPlayoutOptions as i, type ChannelMessage as j, ChannelMultiplexer as k, type ChannelName as l, type ChunkReadable as m, DOC_SYNC_WIRE_CONTRACT_VERSION as n, DeferredChannelMultiplexer as o, DeferredDocConnector as p, type DerivedLegRole as q, type DocConnection as r, type DocConnectionState as s, type DocConnector as t, type DocTokenSupplier as u, type MediaChunkSource as v, type MediaChunkSourceFactory as w, type MediaRecorderChunkSourceOptions as x, type PresenceState as y, type PrewakeOptions as z };
@@ -263,6 +263,10 @@ interface TransportSessionOptions {
263
263
 
264
264
  audioPlayout?: AudioPlayoutOptions;
265
265
 
266
+ videoPlayout?: VideoPlayoutOptions;
267
+
268
+ sessionStats?: SessionStatsOptions;
269
+
266
270
  diagnosticSink?: (diagnostic: SessionDiagnostic) => void;
267
271
  }
268
272
 
@@ -271,6 +275,57 @@ interface AudioPlayoutOptions {
271
275
  jitterBufferTargetMs?: number;
272
276
  }
273
277
 
278
+ interface VideoPlayoutOptions {
279
+
280
+ jitterBufferTargetMs?: number;
281
+ }
282
+
283
+ interface SessionStatsOptions {
284
+
285
+ pollMs?: number;
286
+ }
287
+
288
+ interface InboundStatsSample {
289
+
290
+ consumerId: string;
291
+
292
+ total: number;
293
+ framesDecoded: number | null;
294
+
295
+ jitter: number | null;
296
+ packetsReceived: number | null;
297
+ packetsLost: number | null;
298
+ nackCount: number | null;
299
+ pliCount: number | null;
300
+ firCount: number | null;
301
+ keyFramesDecoded: number | null;
302
+ framesReceived: number | null;
303
+ framesDropped: number | null;
304
+ retransmittedPacketsReceived: number | null;
305
+ retransmittedBytesReceived: number | null;
306
+ jitterBufferDelay: number | null;
307
+ jitterBufferEmittedCount: number | null;
308
+
309
+ estimatedPlayoutTimestamp: number | null;
310
+ jitterBufferTargetDelay: number | null;
311
+ jitterBufferMinimumDelay: number | null;
312
+ concealedSamples: number | null;
313
+ insertedSamplesForDeceleration: number | null;
314
+ }
315
+
316
+ interface SessionStatsSample {
317
+
318
+ timestamp: number;
319
+
320
+ stream: string | null;
321
+
322
+ avSyncMs: number | null;
323
+
324
+ audio: InboundStatsSample | null;
325
+
326
+ video: InboundStatsSample | null;
327
+ }
328
+
274
329
  interface MediaLivenessOptions {
275
330
 
276
331
  pollMs?: number;
@@ -424,6 +479,8 @@ interface Session {
424
479
 
425
480
  onActivation?(handler: (event: ActivationEvent) => void): () => void;
426
481
 
482
+ onStats?(handler: (sample: SessionStatsSample) => void): () => void;
483
+
427
484
  whenLive(options?: {
428
485
  timeout?: number;
429
486
  signal?: AbortSignal;
@@ -550,6 +607,10 @@ interface AppOptions {
550
607
  priority?: 'preempt';
551
608
 
552
609
  audioPlayout?: AudioPlayoutOptions;
610
+
611
+ videoPlayout?: VideoPlayoutOptions;
612
+
613
+ sessionStats?: SessionStatsOptions;
553
614
  }
554
615
  interface AccessTokenOptions$1 {
555
616
  forceRefresh?: boolean;
@@ -750,6 +811,8 @@ interface TransportEvents {
750
811
 
751
812
  diagnostic: (diagnostic: SessionDiagnostic) => void;
752
813
 
814
+ stats: (sample: SessionStatsSample) => void;
815
+
753
816
  seeked: (stream: string, target: number | 'live') => void;
754
817
 
755
818
  signal: (msg: Record<string, unknown>) => void;
@@ -822,6 +885,10 @@ declare class TransportSession {
822
885
 
823
886
  private _mediaProbeTimer;
824
887
 
888
+ private _statsTimer;
889
+
890
+ private _statsSampleInFlight;
891
+
825
892
  private _joinProbes;
826
893
 
827
894
  private _decodeDeathHandled;
@@ -838,6 +905,8 @@ declare class TransportSession {
838
905
 
839
906
  private _streamDataHandlers;
840
907
 
908
+ private _streamDataLane;
909
+
841
910
  private _dataProducers;
842
911
 
843
912
  private _dataProducerPromises;
@@ -914,6 +983,14 @@ declare class TransportSession {
914
983
 
915
984
  private _dispatchStreamData;
916
985
 
986
+ markStreamDataLaneQuic(): void;
987
+
988
+ dispatchQuicStreamData(name: string, payload: unknown): void;
989
+
990
+ raiseQuicStreamDataError(err: Error): void;
991
+
992
+ quicStreamDataLaneLost(reason: string): void;
993
+
917
994
  private _streamNameFromLabel;
918
995
 
919
996
  mediaUnavailableReason(): string | null;
@@ -962,9 +1039,9 @@ declare class TransportSession {
962
1039
  private _onConsumeData;
963
1040
  private _onConsume;
964
1041
 
965
- private _audioJitterBufferTargetMs;
1042
+ private _jitterBufferTargetMs;
966
1043
 
967
- private _capAudioJitterBuffer;
1044
+ private _capJitterBuffer;
968
1045
 
969
1046
  private _closeConsumer;
970
1047
 
@@ -976,6 +1053,13 @@ declare class TransportSession {
976
1053
  private _startMediaProbe;
977
1054
  private _stopMediaProbe;
978
1055
 
1056
+ private _statsPollMs;
1057
+ private _startStatsSampler;
1058
+ private _stopStatsSampler;
1059
+
1060
+ private _lanePairKey;
1061
+ private _sampleSessionStats;
1062
+
979
1063
  private _resetJoinProbes;
980
1064
  private _sampleMediaArrival;
981
1065
 
@@ -1103,4 +1187,4 @@ interface DataChannelTransport {
1103
1187
 
1104
1188
  declare function transportStreamData(transport: DataChannelTransport): StreamDataTransport;
1105
1189
 
1106
- export { type SessionEndResult as $, type AccessTokenOptions$1 as A, type PrewakeResult as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type PrewakeStatus as E, type RecordingBucket as F, type RecordingLifecycle as G, type RecordingStatus as H, type RecordingsAccessor as I, type ReleaseSessionBeaconOptions as J, type RequestOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RequestStreamOptions as N, type RuntimeArtifact as O, type Presence as P, type RuntimeArtifactDownload as Q, type Recording as R, type RuntimeArtifactsAccessor as S, type RuntimeAvailability as T, type RuntimeWakeDetail as U, type RuntimeWakeGolden as V, type RuntimeWakeReasonCode as W, type Session as X, type SessionDiagnostic as Y, type SessionDocument as Z, SessionDocumentImpl as _, type AccessTokenOptions as a, type SessionFailureKind as a0, type SessionPhase as a1, type SessionPhaseError as a2, type SessionPhaseName as a3, type SessionStartOptions as a4, type SessionStatus as a5, type SessionStream as a6, type SessionText as a7, type Store as a8, type StoreOptions as a9, type StreamChunkOptions as aa, type StreamDataTransport as ab, TransportSession as ac, type TransportSessionOptions as ad, type TransportState as ae, allocateSession as af, createPresence as ag, createWebsocketDocConnector as ah, deriveYjsServerUrl as ai, derivedLegName as aj, derivedLegRole as ak, isPendingRecording as al, mediaRecorderChunkSource as am, prewake as an, releaseSessionBeacon as ao, streamDataLabel as ap, transportStreamData as aq, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type AudioPlayoutOptions as i, type ChannelMessage as j, ChannelMultiplexer as k, type ChannelName as l, type ChunkReadable as m, DOC_SYNC_WIRE_CONTRACT_VERSION as n, DeferredChannelMultiplexer as o, DeferredDocConnector as p, type DerivedLegRole as q, type DocConnection as r, type DocConnectionState as s, type DocConnector as t, type DocTokenSupplier as u, type MediaChunkSource as v, type MediaChunkSourceFactory as w, type MediaRecorderChunkSourceOptions as x, type PresenceState as y, type PrewakeOptions as z };
1190
+ export { SessionDocumentImpl as $, type AccessTokenOptions$1 as A, type PrewakeResult as B, type ChannelEndpoint as C, DERIVED_LEG_SEP as D, type PrewakeStatus as E, type RecordingBucket as F, type RecordingLifecycle as G, type RecordingStatus as H, type InboundStatsSample as I, type RecordingsAccessor as J, type ReleaseSessionBeaconOptions as K, LoopbackStreamData as L, type MediaChunkBinding as M, type RequestOptions as N, type RequestStreamOptions as O, type Presence as P, type RuntimeArtifact as Q, type Recording as R, type RuntimeArtifactDownload as S, type RuntimeArtifactsAccessor as T, type RuntimeAvailability as U, type RuntimeWakeDetail as V, type RuntimeWakeGolden as W, type RuntimeWakeReasonCode as X, type Session as Y, type SessionDiagnostic as Z, type SessionDocument as _, type AccessTokenOptions as a, type SessionEndResult as a0, type SessionFailureKind as a1, type SessionPhase as a2, type SessionPhaseError as a3, type SessionPhaseName as a4, type SessionStartOptions as a5, type SessionStatsOptions as a6, type SessionStatsSample as a7, type SessionStatus as a8, type SessionStream as a9, type SessionText as aa, type Store as ab, type StoreOptions as ac, type StreamChunkOptions as ad, type StreamDataTransport as ae, TransportSession as af, type TransportSessionOptions as ag, type TransportState as ah, type VideoPlayoutOptions as ai, allocateSession as aj, createPresence as ak, createWebsocketDocConnector as al, deriveYjsServerUrl as am, derivedLegName as an, derivedLegRole as ao, isPendingRecording as ap, mediaRecorderChunkSource as aq, prewake as ar, releaseSessionBeacon as as, streamDataLabel as at, transportStreamData as au, type ActivationEvent as b, type ActivationState as c, type AllocateSessionOptions as d, type AllocatedSession as e, type App as f, type AppOptions as g, type AttachOptions as h, type AudioPlayoutOptions as i, type ChannelMessage as j, ChannelMultiplexer as k, type ChannelName as l, type ChunkReadable as m, DOC_SYNC_WIRE_CONTRACT_VERSION as n, DeferredChannelMultiplexer as o, DeferredDocConnector as p, type DerivedLegRole as q, type DocConnection as r, type DocConnectionState as s, type DocConnector as t, type DocTokenSupplier as u, type MediaChunkSource as v, type MediaChunkSourceFactory as w, type MediaRecorderChunkSourceOptions as x, type PresenceState as y, type PrewakeOptions as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/core",
3
- "version": "0.2.56",
3
+ "version": "0.2.57",
4
4
  "description": "Core transport and channel primitives for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",