livekit-client 2.18.9 → 2.19.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.
Files changed (217) hide show
  1. package/dist/livekit-client.e2ee.worker.js +1 -1
  2. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  3. package/dist/livekit-client.e2ee.worker.mjs +5609 -644
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +3553 -2813
  6. package/dist/livekit-client.esm.mjs.map +1 -1
  7. package/dist/livekit-client.pt.worker.js +2 -0
  8. package/dist/livekit-client.pt.worker.js.map +1 -0
  9. package/dist/livekit-client.pt.worker.mjs +5834 -0
  10. package/dist/livekit-client.pt.worker.mjs.map +1 -0
  11. package/dist/livekit-client.umd.js +1 -1
  12. package/dist/livekit-client.umd.js.map +1 -1
  13. package/dist/src/api/SignalClient.d.ts +2 -1
  14. package/dist/src/api/SignalClient.d.ts.map +1 -1
  15. package/dist/src/e2ee/E2eeManager.d.ts +8 -7
  16. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  17. package/dist/src/e2ee/types.d.ts +35 -8
  18. package/dist/src/e2ee/types.d.ts.map +1 -1
  19. package/dist/src/e2ee/utils.d.ts +5 -5
  20. package/dist/src/e2ee/utils.d.ts.map +1 -1
  21. package/dist/src/e2ee/worker/DataCryptor.d.ts +5 -5
  22. package/dist/src/e2ee/worker/DataCryptor.d.ts.map +1 -1
  23. package/dist/src/e2ee/worker/FrameCryptor.d.ts +21 -4
  24. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  25. package/dist/src/e2ee/worker/naluUtils.d.ts +1 -1
  26. package/dist/src/e2ee/worker/naluUtils.d.ts.map +1 -1
  27. package/dist/src/e2ee/worker/sifPayload.d.ts +7 -7
  28. package/dist/src/e2ee/worker/sifPayload.d.ts.map +1 -1
  29. package/dist/src/index.d.ts +4 -1
  30. package/dist/src/index.d.ts.map +1 -1
  31. package/dist/src/options.d.ts +7 -0
  32. package/dist/src/options.d.ts.map +1 -1
  33. package/dist/src/packetTrailer/PacketTrailerManager.d.ts +49 -0
  34. package/dist/src/packetTrailer/PacketTrailerManager.d.ts.map +1 -0
  35. package/dist/src/packetTrailer/packetTrailer.d.ts +32 -0
  36. package/dist/src/packetTrailer/packetTrailer.d.ts.map +1 -0
  37. package/dist/src/packetTrailer/types.d.ts +57 -0
  38. package/dist/src/packetTrailer/types.d.ts.map +1 -0
  39. package/dist/src/packetTrailer/utils.d.ts +9 -0
  40. package/dist/src/packetTrailer/utils.d.ts.map +1 -0
  41. package/dist/src/packetTrailer/worker/packetTrailer.worker.d.ts +2 -0
  42. package/dist/src/packetTrailer/worker/packetTrailer.worker.d.ts.map +1 -0
  43. package/dist/src/room/RTCEngine.d.ts +2 -4
  44. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  45. package/dist/src/room/Room.d.ts +7 -3
  46. package/dist/src/room/Room.d.ts.map +1 -1
  47. package/dist/src/room/data-track/RemoteDataTrack.d.ts +5 -1
  48. package/dist/src/room/data-track/RemoteDataTrack.d.ts.map +1 -1
  49. package/dist/src/room/data-track/depacketizer.d.ts +12 -4
  50. package/dist/src/room/data-track/depacketizer.d.ts.map +1 -1
  51. package/dist/src/room/data-track/frame.d.ts +3 -3
  52. package/dist/src/room/data-track/frame.d.ts.map +1 -1
  53. package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts +3 -1
  54. package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts.map +1 -1
  55. package/dist/src/room/data-track/incoming/pipeline.d.ts +4 -1
  56. package/dist/src/room/data-track/incoming/pipeline.d.ts.map +1 -1
  57. package/dist/src/room/data-track/outgoing/types.d.ts +2 -2
  58. package/dist/src/room/data-track/outgoing/types.d.ts.map +1 -1
  59. package/dist/src/room/data-track/packet/extensions.d.ts +4 -4
  60. package/dist/src/room/data-track/packet/extensions.d.ts.map +1 -1
  61. package/dist/src/room/data-track/packet/index.d.ts +5 -5
  62. package/dist/src/room/data-track/packet/index.d.ts.map +1 -1
  63. package/dist/src/room/data-track/packet/serializable.d.ts +1 -1
  64. package/dist/src/room/data-track/packet/serializable.d.ts.map +1 -1
  65. package/dist/src/room/data-track/types.d.ts +7 -0
  66. package/dist/src/room/data-track/types.d.ts.map +1 -1
  67. package/dist/src/room/events.d.ts +2 -2
  68. package/dist/src/room/participant/LocalParticipant.d.ts +8 -14
  69. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  70. package/dist/src/room/participant/Participant.d.ts +1 -1
  71. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  72. package/dist/src/room/participant/RemoteParticipant.d.ts +5 -1
  73. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  74. package/dist/src/room/rpc/client/RpcClientManager.d.ts +39 -0
  75. package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -0
  76. package/dist/src/room/rpc/client/events.d.ts +8 -0
  77. package/dist/src/room/rpc/client/events.d.ts.map +1 -0
  78. package/dist/src/room/rpc/index.d.ts +6 -0
  79. package/dist/src/room/rpc/index.d.ts.map +1 -0
  80. package/dist/src/room/rpc/server/RpcServerManager.d.ts +44 -0
  81. package/dist/src/room/rpc/server/RpcServerManager.d.ts.map +1 -0
  82. package/dist/src/room/rpc/server/events.d.ts +8 -0
  83. package/dist/src/room/rpc/server/events.d.ts.map +1 -0
  84. package/dist/src/room/{rpc.d.ts → rpc/utils.d.ts} +34 -4
  85. package/dist/src/room/rpc/utils.d.ts.map +1 -0
  86. package/dist/src/room/track/PacketTrailerExtractor.d.ts +19 -0
  87. package/dist/src/room/track/PacketTrailerExtractor.d.ts.map +1 -0
  88. package/dist/src/room/track/RemoteVideoTrack.d.ts +16 -0
  89. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  90. package/dist/src/room/track/Track.d.ts +1 -1
  91. package/dist/src/room/track/Track.d.ts.map +1 -1
  92. package/dist/src/room/track/create.d.ts.map +1 -1
  93. package/dist/src/room/track/options.d.ts +10 -0
  94. package/dist/src/room/track/options.d.ts.map +1 -1
  95. package/dist/src/room/track/utils.d.ts.map +1 -1
  96. package/dist/src/room/utils.d.ts +4 -3
  97. package/dist/src/room/utils.d.ts.map +1 -1
  98. package/dist/src/test/MockMediaStreamTrack.d.ts.map +1 -1
  99. package/dist/src/utils/dataPacketBuffer.d.ts +1 -1
  100. package/dist/src/utils/dataPacketBuffer.d.ts.map +1 -1
  101. package/dist/src/version.d.ts +9 -1
  102. package/dist/src/version.d.ts.map +1 -1
  103. package/dist/ts4.2/api/SignalClient.d.ts +2 -1
  104. package/dist/ts4.2/e2ee/E2eeManager.d.ts +8 -7
  105. package/dist/ts4.2/e2ee/types.d.ts +35 -8
  106. package/dist/ts4.2/e2ee/utils.d.ts +5 -5
  107. package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +5 -5
  108. package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +21 -4
  109. package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +1 -1
  110. package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +7 -7
  111. package/dist/ts4.2/index.d.ts +5 -1
  112. package/dist/ts4.2/options.d.ts +7 -0
  113. package/dist/ts4.2/packetTrailer/PacketTrailerManager.d.ts +49 -0
  114. package/dist/ts4.2/packetTrailer/packetTrailer.d.ts +32 -0
  115. package/dist/ts4.2/packetTrailer/types.d.ts +57 -0
  116. package/dist/ts4.2/packetTrailer/utils.d.ts +9 -0
  117. package/dist/ts4.2/packetTrailer/worker/packetTrailer.worker.d.ts +2 -0
  118. package/dist/ts4.2/room/RTCEngine.d.ts +2 -4
  119. package/dist/ts4.2/room/Room.d.ts +7 -3
  120. package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +5 -1
  121. package/dist/ts4.2/room/data-track/depacketizer.d.ts +12 -4
  122. package/dist/ts4.2/room/data-track/frame.d.ts +3 -3
  123. package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +3 -1
  124. package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +4 -1
  125. package/dist/ts4.2/room/data-track/outgoing/types.d.ts +2 -2
  126. package/dist/ts4.2/room/data-track/packet/extensions.d.ts +4 -4
  127. package/dist/ts4.2/room/data-track/packet/index.d.ts +5 -5
  128. package/dist/ts4.2/room/data-track/packet/serializable.d.ts +1 -1
  129. package/dist/ts4.2/room/data-track/types.d.ts +7 -0
  130. package/dist/ts4.2/room/events.d.ts +2 -2
  131. package/dist/ts4.2/room/participant/LocalParticipant.d.ts +8 -14
  132. package/dist/ts4.2/room/participant/Participant.d.ts +1 -1
  133. package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +5 -1
  134. package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +43 -0
  135. package/dist/ts4.2/room/rpc/client/events.d.ts +8 -0
  136. package/dist/ts4.2/room/rpc/index.d.ts +7 -0
  137. package/dist/ts4.2/room/rpc/server/RpcServerManager.d.ts +44 -0
  138. package/dist/ts4.2/room/rpc/server/events.d.ts +8 -0
  139. package/dist/ts4.2/room/{rpc.d.ts → rpc/utils.d.ts} +34 -4
  140. package/dist/ts4.2/room/track/PacketTrailerExtractor.d.ts +19 -0
  141. package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +16 -0
  142. package/dist/ts4.2/room/track/Track.d.ts +1 -1
  143. package/dist/ts4.2/room/track/options.d.ts +10 -0
  144. package/dist/ts4.2/room/utils.d.ts +4 -3
  145. package/dist/ts4.2/utils/dataPacketBuffer.d.ts +1 -1
  146. package/dist/ts4.2/version.d.ts +9 -1
  147. package/package.json +24 -16
  148. package/src/api/SignalClient.test.ts +102 -10
  149. package/src/api/SignalClient.ts +4 -2
  150. package/src/api/WebSocketStream.test.ts +0 -1
  151. package/src/e2ee/E2eeManager.ts +82 -30
  152. package/src/e2ee/types.ts +37 -8
  153. package/src/e2ee/utils.ts +7 -6
  154. package/src/e2ee/worker/DataCryptor.ts +6 -6
  155. package/src/e2ee/worker/FrameCryptor.test.ts +177 -4
  156. package/src/e2ee/worker/FrameCryptor.ts +94 -14
  157. package/src/e2ee/worker/ParticipantKeyHandler.test.ts +4 -4
  158. package/src/e2ee/worker/e2ee.worker.ts +13 -5
  159. package/src/e2ee/worker/naluUtils.ts +4 -4
  160. package/src/e2ee/worker/sifPayload.ts +10 -8
  161. package/src/index.ts +7 -0
  162. package/src/options.ts +8 -0
  163. package/src/packetTrailer/PacketTrailerManager.test.ts +172 -0
  164. package/src/packetTrailer/PacketTrailerManager.ts +250 -0
  165. package/src/packetTrailer/packetTrailer.test.ts +174 -0
  166. package/src/packetTrailer/packetTrailer.ts +276 -0
  167. package/src/packetTrailer/types.ts +75 -0
  168. package/src/packetTrailer/utils.test.ts +105 -0
  169. package/src/packetTrailer/utils.ts +50 -0
  170. package/src/packetTrailer/worker/packetTrailer.worker.ts +155 -0
  171. package/src/packetTrailer/worker/tsconfig.json +14 -0
  172. package/src/room/BackOffStrategy.test.ts +1 -1
  173. package/src/room/RTCEngine.test.ts +219 -0
  174. package/src/room/RTCEngine.ts +86 -46
  175. package/src/room/Room.test.ts +62 -1
  176. package/src/room/Room.ts +111 -86
  177. package/src/room/data-track/RemoteDataTrack.ts +8 -1
  178. package/src/room/data-track/depacketizer.test.ts +433 -1
  179. package/src/room/data-track/depacketizer.ts +79 -61
  180. package/src/room/data-track/frame.ts +2 -2
  181. package/src/room/data-track/incoming/IncomingDataTrackManager.test.ts +194 -0
  182. package/src/room/data-track/incoming/IncomingDataTrackManager.ts +21 -1
  183. package/src/room/data-track/incoming/pipeline.ts +13 -2
  184. package/src/room/data-track/outgoing/types.ts +3 -2
  185. package/src/room/data-track/packet/extensions.ts +2 -2
  186. package/src/room/data-track/packet/index.ts +6 -6
  187. package/src/room/data-track/packet/serializable.ts +1 -1
  188. package/src/room/data-track/types.ts +8 -0
  189. package/src/room/events.ts +2 -2
  190. package/src/room/participant/LocalParticipant.test.ts +81 -0
  191. package/src/room/participant/LocalParticipant.ts +64 -187
  192. package/src/room/participant/Participant.ts +1 -1
  193. package/src/room/participant/RemoteParticipant.ts +9 -0
  194. package/src/room/participant/publishUtils.ts +1 -1
  195. package/src/room/rpc/client/RpcClientManager.test.ts +430 -0
  196. package/src/room/rpc/client/RpcClientManager.ts +269 -0
  197. package/src/room/rpc/client/events.ts +9 -0
  198. package/src/room/rpc/index.ts +14 -0
  199. package/src/room/rpc/server/RpcServerManager.test.ts +471 -0
  200. package/src/room/rpc/server/RpcServerManager.ts +293 -0
  201. package/src/room/rpc/server/events.ts +9 -0
  202. package/src/room/{rpc.ts → rpc/utils.ts} +49 -8
  203. package/src/room/track/PacketTrailerExtractor.ts +43 -0
  204. package/src/room/track/RemoteVideoTrack.ts +23 -2
  205. package/src/room/track/Track.ts +1 -1
  206. package/src/room/track/create.ts +0 -4
  207. package/src/room/track/options.ts +11 -0
  208. package/src/room/track/record.ts +1 -1
  209. package/src/room/track/utils.ts +4 -1
  210. package/src/room/utils.test.ts +14 -1
  211. package/src/room/utils.ts +19 -4
  212. package/src/test/MockMediaStreamTrack.ts +0 -1
  213. package/src/type-polyfills/non-shared-typed-arrays.d.ts +6 -0
  214. package/src/utils/dataPacketBuffer.ts +1 -1
  215. package/src/version.ts +11 -1
  216. package/dist/src/room/rpc.d.ts.map +0 -1
  217. package/src/room/rpc.test.ts +0 -301
@@ -68,6 +68,7 @@ declare class Room extends Room_base {
68
68
  private connectFuture?;
69
69
  private disconnectLock;
70
70
  private e2eeManager;
71
+ private packetTrailerManager;
71
72
  private e2eeStateMutex;
72
73
  private connectionReconcileInterval?;
73
74
  private regionUrlProvider?;
@@ -84,7 +85,8 @@ declare class Room extends Room_base {
84
85
  private outgoingDataStreamManager;
85
86
  private incomingDataTrackManager;
86
87
  private outgoingDataTrackManager;
87
- private rpcHandlers;
88
+ private rpcClientManager;
89
+ private rpcServerManager;
88
90
  get hasE2EESetup(): boolean;
89
91
  /**
90
92
  * Creates a new Room, the primary construct for a LiveKit session.
@@ -133,6 +135,7 @@ declare class Room extends Room_base {
133
135
  */
134
136
  setE2EEEnabled(enabled: boolean): Promise<void>;
135
137
  private setupE2EE;
138
+ private setupPacketTrailer;
136
139
  private get logContext();
137
140
  /**
138
141
  * if the current room has a participant with `recorder: true` in its JWT grant
@@ -242,7 +245,6 @@ declare class Room extends Room_base {
242
245
  private handleChatMessage;
243
246
  private handleMetrics;
244
247
  private handleDataStream;
245
- private handleIncomingRpcRequest;
246
248
  bufferedSegments: Map<string, TranscriptionSegmentModel>;
247
249
  private handleAudioPlaybackStarted;
248
250
  private handleAudioPlaybackFailed;
@@ -265,6 +267,8 @@ declare class Room extends Room_base {
265
267
  */
266
268
  private updateSubscriptions;
267
269
  private getRemoteParticipantBySid;
270
+ private getRemoteParticipantClientProtocol;
271
+ private registerRpcDataStreamHandler;
268
272
  private registerConnectionReconcile;
269
273
  private clearConnectionReconcile;
270
274
  private setAndEmitConnectionState;
@@ -319,7 +323,7 @@ export type RoomEventCallbacks = {
319
323
  participantAttributesChanged: (changedAttributes: Record<string, string>, participant: RemoteParticipant | LocalParticipant) => void;
320
324
  activeSpeakersChanged: (speakers: Array<Participant>) => void;
321
325
  roomMetadataChanged: (metadata: string) => void;
322
- dataReceived: (payload: Uint8Array, participant?: RemoteParticipant, kind?: DataPacket_Kind, topic?: string, encryptionType?: Encryption_Type) => void;
326
+ dataReceived: (payload: NonSharedUint8Array, participant?: RemoteParticipant, kind?: DataPacket_Kind, topic?: string, encryptionType?: Encryption_Type) => void;
323
327
  sipDTMFReceived: (dtmf: SipDTMF, participant?: RemoteParticipant) => void;
324
328
  transcriptionReceived: (transcription: TranscriptionSegment[], participant?: Participant, publication?: TrackPublication) => void;
325
329
  connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
@@ -2,7 +2,7 @@ import type Participant from '../participant/Participant';
2
2
  import type { DataTrackFrame } from './frame';
3
3
  import type IncomingDataTrackManager from './incoming/IncomingDataTrackManager';
4
4
  import type { IDataTrack, IRemoteTrack } from './track-interfaces';
5
- import type { DataTrackInfo } from './types';
5
+ import type { DataTrackInfo, RemoteDataTrackPipelineOptions } from './types';
6
6
  type RemoteDataTrackOptions = {
7
7
  publisherIdentity: Participant['identity'];
8
8
  };
@@ -41,6 +41,10 @@ export default class RemoteDataTrack implements IRemoteTrack, IDataTrack {
41
41
  * the initial subscription is established.
42
42
  */
43
43
  subscribe(options?: DataTrackSubscribeOptions): ReadableStream<DataTrackFrame>;
44
+ /** Configure how incoming frames for this track are processed before they are handed out to
45
+ * subscribers (the "pipeline"). These options apply to all current and future subscriptions
46
+ * of this track, and may be set at any time. */
47
+ setPipelineOptions(options: RemoteDataTrackPipelineOptions): void;
44
48
  }
45
49
  export {};
46
50
  //# sourceMappingURL=RemoteDataTrack.d.ts.map
@@ -24,14 +24,21 @@ export declare enum DataTrackDepacketizerDropReason {
24
24
  Incomplete = 3
25
25
  }
26
26
  type PushOptions = {
27
- /** If true, throws an error instead of logging a warning when a new frame is encountered half way
28
- * through processing a pre-existing frame. */
29
- errorOnPartialFrames: boolean;
27
+ /** If true, throws `DataTrackDepacketizerDropError.interrupted` instead of logging a warning
28
+ * when a new frame arrives while the partials map is at capacity. */
29
+ throwOnInterruption: boolean;
30
+ /** Maximum number of partial frames the depacketizer will track concurrently. When a new
31
+ * frame arrives while the partials map is at capacity, the oldest partial is evicted (or
32
+ * `DataTrackDepacketizerDropError.interrupted` is thrown when `throwOnInterruption` is set).
33
+ * Defaults to 1. */
34
+ maxPartialFrames?: number;
30
35
  };
31
36
  export default class DataTrackDepacketizer {
32
37
  /** Maximum number of packets to buffer per frame before dropping. */
33
38
  static MAX_BUFFER_PACKETS: number;
34
- private partial;
39
+ /** Partial frames currently being assembled, keyed by frame number. `Map` preserves insertion
40
+ * order, so the oldest entry is the first key. */
41
+ private partials;
35
42
  /** Should be repeatedly called with received {@link DataTrackPacket}s - intermediate calls
36
43
  * aggregate the packet's state internally, and return null.
37
44
  *
@@ -39,6 +46,7 @@ export default class DataTrackDepacketizer {
39
46
  * is returned.*/
40
47
  push(packet: DataTrackPacket, options?: PushOptions): Throws<DataTrackFrameInternal | null, DataTrackDepacketizerDropError>;
41
48
  reset(): void;
49
+ private peekOldestPartialFrameNumber;
42
50
  private frameFromSingle;
43
51
  /** Begin assembling a new packet. */
44
52
  private beginPartial;
@@ -1,17 +1,17 @@
1
1
  import { DataTrackExtensions } from './packet/extensions';
2
2
  /** A pair of payload bytes and packet extensions which can be fed into a {@link DataTrackPacketizer}. */
3
3
  export type DataTrackFrame = {
4
- payload: Uint8Array;
4
+ payload: NonSharedUint8Array;
5
5
  userTimestamp?: bigint;
6
6
  };
7
7
  /** An internal representation o data track frame which contains all SFU metadata. */
8
8
  export type DataTrackFrameInternal = {
9
- payload: Uint8Array;
9
+ payload: NonSharedUint8Array;
10
10
  extensions: DataTrackExtensions;
11
11
  };
12
12
  export declare const DataTrackFrameInternal: {
13
13
  from(frame: DataTrackFrame): {
14
- payload: Uint8Array<ArrayBufferLike>;
14
+ payload: Uint8Array<ArrayBuffer>;
15
15
  extensions: DataTrackExtensions;
16
16
  };
17
17
  /** Converts from a DataTrackFrameInternal -> DataTrackFrame. Some internal information is
@@ -6,7 +6,7 @@ import type RemoteParticipant from '../../participant/RemoteParticipant';
6
6
  import { DataTrackDepacketizerDropError } from '../depacketizer';
7
7
  import type { DataTrackFrame } from '../frame';
8
8
  import { DataTrackHandle } from '../handle';
9
- import type { DataTrackInfo, DataTrackSid } from '../types';
9
+ import type { DataTrackInfo, DataTrackSid, RemoteDataTrackPipelineOptions } from '../types';
10
10
  import { DataTrackSubscribeError } from './errors';
11
11
  import type { EventSfuUpdateSubscription, EventTrackAvailable, EventTrackUnavailable } from './types';
12
12
  export type DataTrackIncomingManagerCallbacks = {
@@ -40,6 +40,8 @@ export default class IncomingDataTrackManager extends IncomingDataTrackManager_b
40
40
  constructor(options?: IncomingDataTrackManagerOptions);
41
41
  /** @internal */
42
42
  updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
43
+ /** @internal */
44
+ setPipelineOptions(sid: DataTrackSid, options: RemoteDataTrackPipelineOptions): void;
43
45
  /** Allocates a ReadableStream which emits when a new {@link DataTrackFrame} is received from the
44
46
  * SFU. The SFU subscription is initiated lazily when the stream is created.
45
47
  *
@@ -3,7 +3,7 @@ import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
3
3
  import { DataTrackDepacketizerDropError } from '../depacketizer';
4
4
  import type { DataTrackFrameInternal } from '../frame';
5
5
  import { DataTrackPacket } from '../packet';
6
- import type { DataTrackInfo } from '../types';
6
+ import type { DataTrackInfo, RemoteDataTrackPipelineOptions } from '../types';
7
7
  /**
8
8
  * Options for creating a {@link IncomingDataTrackPipeline}.
9
9
  */
@@ -11,6 +11,7 @@ type Options = {
11
11
  info: DataTrackInfo;
12
12
  publisherIdentity: string;
13
13
  e2eeManager: BaseE2EEManager | null;
14
+ pipelineOptions?: RemoteDataTrackPipelineOptions;
14
15
  };
15
16
  /**
16
17
  * Pipeline for an individual data track subscription.
@@ -19,11 +20,13 @@ export default class IncomingDataTrackPipeline {
19
20
  private publisherIdentity;
20
21
  private e2eeManager;
21
22
  private depacketizer;
23
+ private options;
22
24
  /**
23
25
  * Creates a new pipeline with the given options.
24
26
  */
25
27
  constructor(options: Options);
26
28
  updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
29
+ setOptions(options: RemoteDataTrackPipelineOptions): void;
27
30
  processPacket(packet: DataTrackPacket): Promise<Throws<DataTrackFrameInternal | null, DataTrackDepacketizerDropError>>;
28
31
  /**
29
32
  * Depacketize the given frame, log if a drop occurs.
@@ -12,7 +12,7 @@ export type SfuPublishResponseResult = {
12
12
  data: DataTrackInfo;
13
13
  } | {
14
14
  type: 'error';
15
- error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.InvalidName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
15
+ error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.InvalidName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached> | DataTrackPublishError<DataTrackPublishErrorReason.Unknown>;
16
16
  };
17
17
  /** Request sent to the SFU to publish a track. */
18
18
  export type EventSfuPublishRequest = {
@@ -28,7 +28,7 @@ export type EventSfuUnpublishRequest = {
28
28
  export type EventPacketAvailable = {
29
29
  /** The handle associated with the data track which this packet bytes belong to. */
30
30
  handle: DataTrackHandle;
31
- bytes: Uint8Array;
31
+ bytes: NonSharedUint8Array;
32
32
  };
33
33
  /** A track has been created by a local participant and is available to be
34
34
  * subscribed to. */
@@ -26,15 +26,15 @@ export declare class DataTrackE2eeExtension extends DataTrackExtension {
26
26
  static tag: DataTrackExtensionTag;
27
27
  static lengthBytes: number;
28
28
  keyIndex: number;
29
- iv: Uint8Array;
30
- constructor(keyIndex: number, iv: Uint8Array);
29
+ iv: NonSharedUint8Array;
30
+ constructor(keyIndex: number, iv: NonSharedUint8Array);
31
31
  toBinaryLengthBytes(): number;
32
32
  toBinaryInto(dataView: DataView): Throws<number, never>;
33
33
  toJSON(): {
34
34
  tag: number;
35
35
  lengthBytes: number;
36
36
  keyIndex: number;
37
- iv: Uint8Array<ArrayBufferLike>;
37
+ iv: Uint8Array<ArrayBuffer>;
38
38
  };
39
39
  }
40
40
  export declare class DataTrackExtensions extends Serializable {
@@ -60,7 +60,7 @@ export declare class DataTrackExtensions extends Serializable {
60
60
  tag: number;
61
61
  lengthBytes: number;
62
62
  keyIndex: number;
63
- iv: Uint8Array<ArrayBufferLike>;
63
+ iv: Uint8Array<ArrayBuffer>;
64
64
  } | null;
65
65
  };
66
66
  }
@@ -43,7 +43,7 @@ export declare class DataTrackPacketHeader extends Serializable {
43
43
  tag: number;
44
44
  lengthBytes: number;
45
45
  keyIndex: number;
46
- iv: Uint8Array<ArrayBufferLike>;
46
+ iv: Uint8Array<ArrayBuffer>;
47
47
  } | null;
48
48
  };
49
49
  };
@@ -62,8 +62,8 @@ export declare enum FrameMarker {
62
62
  /** A class for serializing / deserializing data track packets. */
63
63
  export declare class DataTrackPacket extends Serializable {
64
64
  header: DataTrackPacketHeader;
65
- payload: Uint8Array;
66
- constructor(header: DataTrackPacketHeader, payload: Uint8Array);
65
+ payload: NonSharedUint8Array;
66
+ constructor(header: DataTrackPacketHeader, payload: NonSharedUint8Array);
67
67
  toBinaryLengthBytes(): number;
68
68
  toBinaryInto(dataView: DataView): Throws<number, DataTrackSerializeError>;
69
69
  static fromBinary<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): Throws<[
@@ -87,11 +87,11 @@ export declare class DataTrackPacket extends Serializable {
87
87
  tag: number;
88
88
  lengthBytes: number;
89
89
  keyIndex: number;
90
- iv: Uint8Array<ArrayBufferLike>;
90
+ iv: Uint8Array<ArrayBuffer>;
91
91
  } | null;
92
92
  };
93
93
  };
94
- payload: Uint8Array<ArrayBufferLike>;
94
+ payload: Uint8Array<ArrayBuffer>;
95
95
  };
96
96
  }
97
97
  //# sourceMappingURL=index.d.ts.map
@@ -7,6 +7,6 @@ export default abstract class Serializable {
7
7
  /** Given a DataView, serialize the instance inside and return the number of bytes written. */
8
8
  abstract toBinaryInto(dataView: DataView): Throws<number, DataTrackSerializeError>;
9
9
  /** Encodes the instance as binary and returns the data as a Uint8Array. */
10
- toBinary(): Throws<Uint8Array, DataTrackSerializeError>;
10
+ toBinary(): Throws<NonSharedUint8Array, DataTrackSerializeError>;
11
11
  }
12
12
  //# sourceMappingURL=serializable.d.ts.map
@@ -8,6 +8,13 @@ export type DataTrackInfo = {
8
8
  name: string;
9
9
  usesE2ee: boolean;
10
10
  };
11
+ export type RemoteDataTrackPipelineOptions = {
12
+ /** Set the maximum number of in-flight partial frames the depacketizer will track
13
+ * concurrently for this track. Higher values give more out-of-order tolerance for
14
+ * high-frequency senders. Defaults to 1.
15
+ */
16
+ maxPartialFrames?: number;
17
+ };
11
18
  export declare const DataTrackInfo: {
12
19
  from(protocolInfo: ProtocolDataTrackInfo): DataTrackInfo;
13
20
  toProtobuf(info: DataTrackInfo): ProtocolDataTrackInfo;
@@ -198,7 +198,7 @@ export declare enum RoomEvent {
198
198
  * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
199
199
  * All participants in the room will receive the messages sent to the room.
200
200
  *
201
- * args: (payload: Uint8Array, participant: [[Participant]], kind: [[DataPacket_Kind]], topic?: string)
201
+ * args: (payload: NonSharedUint8Array, participant: [[Participant]], kind: [[DataPacket_Kind]], topic?: string)
202
202
  */
203
203
  DataReceived = "dataReceived",
204
204
  /**
@@ -427,7 +427,7 @@ export declare enum ParticipantEvent {
427
427
  * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
428
428
  * All participants in the room will receive the messages sent to the room.
429
429
  *
430
- * args: (payload: Uint8Array, kind: [[DataPacket_Kind]])
430
+ * args: (payload: NonSharedUint8Array, kind: [[DataPacket_Kind]])
431
431
  */
432
432
  DataReceived = "dataReceived",
433
433
  /**
@@ -8,7 +8,7 @@ import LocalDataTrack from '../data-track/LocalDataTrack';
8
8
  import type OutgoingDataTrackManager from '../data-track/outgoing/OutgoingDataTrackManager';
9
9
  import type { DataTrackOptions } from '../data-track/outgoing/types';
10
10
  import type { PerformRpcParams, RpcInvocationData } from '../rpc';
11
- import { RpcError } from '../rpc';
11
+ import { RpcClientManager, RpcError, RpcServerManager } from '../rpc';
12
12
  import LocalTrack from '../track/LocalTrack';
13
13
  import LocalTrackPublication from '../track/LocalTrackPublication';
14
14
  import { Track } from '../track/Track';
@@ -40,15 +40,14 @@ export default class LocalParticipant extends Participant {
40
40
  private signalConnectedFuture?;
41
41
  private activeAgentFuture?;
42
42
  private firstActiveAgent?;
43
- private rpcHandlers;
44
43
  private roomOutgoingDataStreamManager;
45
44
  private roomOutgoingDataTrackManager;
45
+ private rpcClientManager;
46
+ private rpcServerManager;
46
47
  private pendingSignalRequests;
47
48
  private enabledPublishVideoCodecs;
48
- private pendingAcks;
49
- private pendingResponses;
50
49
  /** @internal */
51
- constructor(sid: string, identity: string, engine: RTCEngine, options: InternalRoomOptions, roomRpcHandlers: Map<string, (data: RpcInvocationData) => Promise<string>>, roomOutgoingDataStreamManager: OutgoingDataStreamManager, roomOutgoingDataTrackManager: OutgoingDataTrackManager);
50
+ constructor(sid: string, identity: string, engine: RTCEngine, options: InternalRoomOptions, roomOutgoingDataStreamManager: OutgoingDataStreamManager, roomOutgoingDataTrackManager: OutgoingDataTrackManager, rpcClientManager: RpcClientManager, rpcServerManager: RpcServerManager);
52
51
  get lastCameraError(): Error | undefined;
53
52
  get lastMicrophoneError(): Error | undefined;
54
53
  get isE2EEEnabled(): boolean;
@@ -63,7 +62,6 @@ export default class LocalParticipant extends Participant {
63
62
  private handleClosing;
64
63
  private handleSignalConnected;
65
64
  private handleSignalRequestResponse;
66
- private handleDataPacket;
67
65
  /**
68
66
  * Sets and updates the metadata of the local participant.
69
67
  * Note: this requires `canUpdateOwnMetadata` permission.
@@ -148,6 +146,8 @@ export default class LocalParticipant extends Participant {
148
146
  private waitUntilEngineConnected;
149
147
  private hasPermissionsToPublish;
150
148
  private publish;
149
+ private canPublishPacketTrailer;
150
+ private normalizeRequestedPacketTrailerOptions;
151
151
  get isLocal(): boolean;
152
152
  /** @internal
153
153
  * publish additional codec to existing track
@@ -163,7 +163,7 @@ export default class LocalParticipant extends Participant {
163
163
  * @param data Uint8Array of the payload. To send string data, use TextEncoder.encode
164
164
  * @param options optionally specify a `reliable`, `topic` and `destination`
165
165
  */
166
- publishData(data: Uint8Array, options?: DataPublishOptions): Promise<void>;
166
+ publishData(data: NonSharedUint8Array, options?: DataPublishOptions): Promise<void>;
167
167
  /**
168
168
  * Publish SIP DTMF message to the room.
169
169
  *
@@ -220,7 +220,7 @@ export default class LocalParticipant extends Participant {
220
220
  * @returns A promise that resolves with the response payload or rejects with an error.
221
221
  * @throws Error on failure. Details in `message`.
222
222
  */
223
- performRpc({ destinationIdentity, method, payload, responseTimeout, }: PerformRpcParams): TypedPromise<string, RpcError>;
223
+ performRpc(params: PerformRpcParams): TypedPromise<string, RpcError>;
224
224
  /**
225
225
  * @deprecated use `room.registerRpcMethod` instead
226
226
  */
@@ -247,12 +247,6 @@ export default class LocalParticipant extends Participant {
247
247
  * participant/track. Any omitted participants will not receive any permissions.
248
248
  */
249
249
  setTrackSubscriptionPermissions(allParticipantsAllowed: boolean, participantTrackPermissions?: ParticipantTrackPermission[]): void;
250
- private handleIncomingRpcAck;
251
- private handleIncomingRpcResponse;
252
- /** @internal */
253
- private publishRpcRequest;
254
- /** @internal */
255
- handleParticipantDisconnected(participantIdentity: string): void;
256
250
  /** @internal */
257
251
  setEnabledPublishCodecs(codecs: Codec[]): void;
258
252
  /** @internal */
@@ -124,7 +124,7 @@ export type ParticipantEventCallbacks = {
124
124
  localSenderCreated: (sender: RTCRtpSender, track: Track) => void;
125
125
  participantMetadataChanged: (prevMetadata: string | undefined, participant?: any) => void;
126
126
  participantNameChanged: (name: string) => void;
127
- dataReceived: (payload: Uint8Array, kind: DataPacket_Kind, encryptionType?: Encryption_Type) => void;
127
+ dataReceived: (payload: NonSharedUint8Array, kind: DataPacket_Kind, encryptionType?: Encryption_Type) => void;
128
128
  sipDTMFReceived: (dtmf: SipDTMF) => void;
129
129
  transcriptionReceived: (transcription: TranscriptionSegment[], publication?: TrackPublication) => void;
130
130
  isSpeakingChanged: (speaking: boolean) => void;
@@ -22,6 +22,10 @@ export default class RemoteParticipant extends Participant {
22
22
  * const track = await remoteParticipant.dataTracks.getDeferred("data track name"); */
23
23
  dataTracks: DeferrableMap<RemoteDataTrack['info']['name'], RemoteDataTrack>;
24
24
  signalClient: SignalClient;
25
+ /** A version number indicating the set of features that the report participant's client supports.
26
+ * @internal
27
+ **/
28
+ clientProtocol: number;
25
29
  private volumeMap;
26
30
  private audioOutput?;
27
31
  /** @internal */
@@ -31,7 +35,7 @@ export default class RemoteParticipant extends Participant {
31
35
  remoteParticipant: string;
32
36
  };
33
37
  /** @internal */
34
- constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind, remoteDataTracks?: Array<RemoteDataTrack>);
38
+ constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind, remoteDataTracks?: Array<RemoteDataTrack>, clientProtocol?: number);
35
39
  protected addTrackPublication(publication: RemoteTrackPublication): void;
36
40
  getTrackPublication(source: Track.Source): RemoteTrackPublication | undefined;
37
41
  getTrackPublicationByName(name: string): RemoteTrackPublication | undefined;
@@ -0,0 +1,43 @@
1
+ import type TypedEmitter from 'typed-emitter';
2
+ import type { StructuredLogger } from '../../../logger';
3
+ import type { TextStreamReader } from '../../data-stream/incoming/StreamReader';
4
+ import type OutgoingDataStreamManager from '../../data-stream/outgoing/OutgoingDataStreamManager';
5
+ import type Participant from '../../participant/Participant';
6
+ import type { PerformRpcParams } from '../utils';
7
+ import { RpcError } from '../utils';
8
+ import type { RpcClientManagerCallbacks } from './events';
9
+ declare const RpcClientManager_base: new () => TypedEmitter<RpcClientManagerCallbacks>;
10
+ /**
11
+ * Manages the client (caller) side of RPC: sending requests, tracking pending
12
+ * ack/response state, and handling incoming ack/response packets.
13
+ * @internal
14
+ */
15
+ export default class RpcClientManager extends RpcClientManager_base {
16
+ private log;
17
+ private outgoingDataStreamManager;
18
+ private getRemoteParticipantClientProtocol;
19
+ private getServerVersion;
20
+ private pendingAcks;
21
+ private pendingResponses;
22
+ constructor(log: StructuredLogger, outgoingDataStreamManager: OutgoingDataStreamManager, getRemoteParticipantClientProtocol: (identity: Participant['identity']) => number, getServerVersion: () => string | undefined);
23
+ performRpc({ destinationIdentity, method, payload, responseTimeout: responseTimeoutMs, }: PerformRpcParams): Promise<[
24
+ id: string,
25
+ completionPromise: Promise<string>
26
+ ]>;
27
+ private publishRpcRequest;
28
+ /**
29
+ * Handle an incoming data stream containing an RPC response payload.
30
+ * @internal
31
+ */
32
+ handleIncomingDataStream(reader: TextStreamReader, senderIdentity: Participant['identity'], attributes: Record<string, string>): Promise<void>;
33
+ /** @internal */
34
+ handleIncomingRpcResponseSuccess(requestId: string, payload: string): void;
35
+ /** @internal */
36
+ handleIncomingRpcResponseFailure(requestId: string, error: RpcError): void;
37
+ /** @internal */
38
+ handleIncomingRpcAck(requestId: string): void;
39
+ /** @internal */
40
+ handleParticipantDisconnected(participantIdentity: string): void;
41
+ }
42
+ export {};
43
+ //# sourceMappingURL=RpcClientManager.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { DataPacket } from '@livekit/protocol';
2
+ export type EventSendDataPacket = {
3
+ packet: DataPacket;
4
+ };
5
+ export type RpcClientManagerCallbacks = {
6
+ sendDataPacket: (event: EventSendDataPacket) => void;
7
+ };
8
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1,7 @@
1
+ export { default as RpcClientManager } from './client/RpcClientManager';
2
+ export type { RpcClientManagerCallbacks } from './client/events';
3
+ export { default as RpcServerManager } from './server/RpcServerManager';
4
+ export type { RpcServerManagerCallbacks } from './server/events';
5
+ export type { PerformRpcParams, RpcInvocationData } from './utils';
6
+ export { RPC_REQUEST_DATA_STREAM_TOPIC, RPC_RESPONSE_DATA_STREAM_TOPIC, RpcRequestAttrs, RpcError, byteLength, truncateBytes } from './utils';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { RpcRequest } from '@livekit/protocol';
2
+ import type TypedEmitter from 'typed-emitter';
3
+ import type { StructuredLogger } from '../../../logger';
4
+ import type { TextStreamReader } from '../../data-stream/incoming/StreamReader';
5
+ import type OutgoingDataStreamManager from '../../data-stream/outgoing/OutgoingDataStreamManager';
6
+ import type Participant from '../../participant/Participant';
7
+ import type { RpcInvocationData } from '../utils';
8
+ import type { RpcServerManagerCallbacks } from './events';
9
+ declare const RpcServerManager_base: new () => TypedEmitter<RpcServerManagerCallbacks>;
10
+ /**
11
+ * Manages the server (handler) side of RPC: processing incoming requests,
12
+ * managing registered method handlers, and sending responses.
13
+ * @internal
14
+ */
15
+ export default class RpcServerManager extends RpcServerManager_base {
16
+ private log;
17
+ private outgoingDataStreamManager;
18
+ private getRemoteParticipantClientProtocol;
19
+ private rpcHandlers;
20
+ constructor(log: StructuredLogger, outgoingDataStreamManager: OutgoingDataStreamManager, getRemoteParticipantClientProtocol: (identity: Participant['identity']) => number);
21
+ registerRpcMethod(method: string, handler: (data: RpcInvocationData) => Promise<string>): void;
22
+ unregisterRpcMethod(method: string): void;
23
+ /**
24
+ * Handle an incoming RPCRequest message containing a payload.
25
+ * This handles "version 1" of rpc requests.
26
+ * @internal
27
+ */
28
+ handleIncomingRpcRequest(callerIdentity: string, rpcRequest: RpcRequest): Promise<void>;
29
+ /**
30
+ * Handle an incoming data stream containing a RPC request payload.
31
+ * This handles "version 2" of rpc requests.
32
+ * @internal
33
+ */
34
+ handleIncomingDataStream(reader: TextStreamReader, callerIdentity: Participant['identity'], dataStreamAttrs: Record<string, string>): Promise<void>;
35
+ private publishRpcAck;
36
+ private publishRpcResponsePacket;
37
+ /**
38
+ * Send a successful RPC response payload, choosing the transport based on
39
+ * the caller's client protocol version.
40
+ */
41
+ private publishRpcResponse;
42
+ }
43
+ export {};
44
+ //# sourceMappingURL=RpcServerManager.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { DataPacket } from '@livekit/protocol';
2
+ export type EventSendDataPacket = {
3
+ packet: DataPacket;
4
+ };
5
+ export type RpcServerManagerCallbacks = {
6
+ sendDataPacket: (event: EventSendDataPacket) => void;
7
+ };
8
+ //# sourceMappingURL=events.d.ts.map
@@ -49,6 +49,7 @@ export declare class RpcError extends Error {
49
49
  static MAX_DATA_BYTES: number;
50
50
  code: number;
51
51
  data?: string;
52
+ cause?: unknown;
52
53
  /**
53
54
  * Creates an error object with the given code and message, plus an optional data payload.
54
55
  *
@@ -56,7 +57,9 @@ export declare class RpcError extends Error {
56
57
  *
57
58
  * Error codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings).
58
59
  */
59
- constructor(code: number, message: string, data?: string);
60
+ constructor(code: number, message: string, data?: string, options?: {
61
+ cause?: unknown;
62
+ });
60
63
  /**
61
64
  * @internal
62
65
  */
@@ -87,9 +90,36 @@ export declare class RpcError extends Error {
87
90
  *
88
91
  * @internal
89
92
  */
90
- static builtIn(key: keyof typeof RpcError.ErrorCode, data?: string): RpcError;
93
+ static builtIn(key: keyof typeof RpcError.ErrorCode, data?: string, options?: {
94
+ cause?: unknown;
95
+ }): RpcError;
91
96
  }
92
- export declare const MAX_PAYLOAD_BYTES = 15360;
97
+ export declare const MAX_V1_PAYLOAD_BYTES = 15360;
98
+ /**
99
+ * Topic used for v2 RPC request data streams.
100
+ * @internal
101
+ */
102
+ export declare const RPC_REQUEST_DATA_STREAM_TOPIC = "lk.rpc_request";
103
+ /**
104
+ * Topic used for v2 RPC response data streams.
105
+ * @internal
106
+ */
107
+ export declare const RPC_RESPONSE_DATA_STREAM_TOPIC = "lk.rpc_response";
108
+ /** @internal */
109
+ export declare enum RpcRequestAttrs {
110
+ RPC_REQUEST_ID = "lk.rpc_request_id",
111
+ RPC_REQUEST_METHOD = "lk.rpc_request_method",
112
+ RPC_REQUEST_RESPONSE_TIMEOUT_MS = "lk.rpc_request_response_timeout_ms",
113
+ RPC_REQUEST_VERSION = "lk.rpc_request_version"
114
+ }
115
+ /** Initial version of rpc which uses RpcRequest / RpcResponse messages.
116
+ * @internal
117
+ **/
118
+ export declare const RPC_VERSION_V1 = 1;
119
+ /** Rpc version backed by data streams instead of RpcRequest / RpcResponse.
120
+ * @internal
121
+ **/
122
+ export declare const RPC_VERSION_V2 = 2;
93
123
  /**
94
124
  * @internal
95
125
  */
@@ -98,4 +128,4 @@ export declare function byteLength(str: string): number;
98
128
  * @internal
99
129
  */
100
130
  export declare function truncateBytes(str: string, maxBytes: number): string;
101
- //# sourceMappingURL=rpc.d.ts.map
131
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,19 @@
1
+ import type { PacketTrailerMetadata } from '../../packetTrailer/types';
2
+ /**
3
+ * Caches packet trailer metadata extracted from received video frames,
4
+ * keyed by RTP timestamp so it can be looked up when the frame is displayed.
5
+ *
6
+ * Metadata is populated either by the packet trailer worker managed by
7
+ * `PacketTrailerManager` (non-E2EE) or by the E2EE FrameCryptor worker
8
+ * after decryption (E2EE).
9
+ *
10
+ * @experimental
11
+ */
12
+ export declare class PacketTrailerExtractor {
13
+ private metadataMap;
14
+ private activeSsrc;
15
+ storeMetadata(rtpTimestamp: number, ssrc: number, metadata: PacketTrailerMetadata): void;
16
+ lookupMetadata(rtpTimestamp: number): PacketTrailerMetadata | undefined;
17
+ dispose(): void;
18
+ }
19
+ //# sourceMappingURL=PacketTrailerExtractor.d.ts.map
@@ -1,5 +1,7 @@
1
+ import type { PacketTrailerMetadata } from '../../packetTrailer/types';
1
2
  import type { VideoReceiverStats } from '../stats';
2
3
  import type { LoggerOptions } from '../types';
4
+ import type { PacketTrailerExtractor } from './PacketTrailerExtractor';
3
5
  import RemoteTrack from './RemoteTrack';
4
6
  import { Track } from './Track';
5
7
  import type { AdaptiveStreamSettings } from './types';
@@ -9,8 +11,22 @@ export default class RemoteVideoTrack extends RemoteTrack<Track.Kind.Video> {
9
11
  private adaptiveStreamSettings?;
10
12
  private lastVisible?;
11
13
  private lastDimensions?;
14
+ /** @internal */
15
+ packetTrailerExtractor?: PacketTrailerExtractor;
12
16
  constructor(mediaTrack: MediaStreamTrack, sid: string, receiver: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, loggerOptions?: LoggerOptions);
13
17
  get isAdaptiveStream(): boolean;
18
+ /**
19
+ * Look up frame-level metadata for a given RTP timestamp.
20
+ * Use with the `TrackEvent.TimeSyncUpdate` event to correlate displayed frames
21
+ * with their capture-time metadata.
22
+ *
23
+ * Requires the room to be configured with the `packetTrailer` worker option
24
+ * and the publishing track to have packet trailer features enabled.
25
+ *
26
+ */
27
+ lookupFrameMetadata({ rtpTimestamp, }: {
28
+ rtpTimestamp: number;
29
+ }): PacketTrailerMetadata | undefined;
14
30
  setStreamState(value: Track.StreamState): void;
15
31
  /**
16
32
  * Note: When using adaptiveStream, you need to use remoteVideoTrack.attach() to add the track to a HTMLVideoElement, otherwise your video tracks might never start