livekit-client 2.22.3 → 2.23.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 +35 -0
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +71 -8
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +1746 -547
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.fm.worker.js +1 -1
- package/dist/livekit-client.fm.worker.js.map +1 -1
- package/dist/livekit-client.fm.worker.mjs +2 -1
- package/dist/livekit-client.fm.worker.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +4 -2
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/api/WebSocketStream.d.ts +1 -0
- package/dist/src/api/WebSocketStream.d.ts.map +1 -1
- package/dist/src/api/utils.d.ts +1 -1
- package/dist/src/api/utils.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts +12 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/options.d.ts +14 -0
- package/dist/src/options.d.ts.map +1 -1
- package/dist/src/room/DefaultReconnectPolicy.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +100 -7
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +16 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +54 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-channel/DataChannelManager.d.ts +9 -8
- package/dist/src/room/data-channel/DataChannelManager.d.ts.map +1 -1
- package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts +25 -12
- package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-channel/LossyDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-channel/ReliableDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/defaults.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +18 -0
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +3 -2
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +4 -0
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -1
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
- package/dist/src/room/rpc/utils.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts +24 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +18 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +9 -0
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +6 -0
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/processor/types.d.ts +11 -0
- package/dist/src/room/track/processor/types.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +13 -0
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +60 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/compressionStreamStubs.d.ts +12 -0
- package/dist/src/test/compressionStreamStubs.d.ts.map +1 -0
- package/dist/ts4.2/api/SignalClient.d.ts +187 -185
- package/dist/ts4.2/api/SignalClientStateMachine.d.ts +85 -85
- package/dist/ts4.2/api/WebSocketStream.d.ts +34 -33
- package/dist/ts4.2/api/utils.d.ts +9 -9
- package/dist/ts4.2/connectionHelper/ConnectionCheck.d.ts +30 -30
- package/dist/ts4.2/connectionHelper/checks/Checker.d.ts +62 -62
- package/dist/ts4.2/connectionHelper/checks/cloudRegion.d.ts +18 -18
- package/dist/ts4.2/connectionHelper/checks/connectionProtocol.d.ts +20 -20
- package/dist/ts4.2/connectionHelper/checks/publishAudio.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/publishVideo.d.ts +7 -7
- package/dist/ts4.2/connectionHelper/checks/reconnect.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/turn.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/webrtc.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/websocket.d.ts +6 -6
- package/dist/ts4.2/e2ee/E2eeManager.d.ts +111 -111
- package/dist/ts4.2/e2ee/KeyProvider.d.ts +54 -54
- package/dist/ts4.2/e2ee/constants.d.ts +21 -21
- package/dist/ts4.2/e2ee/errors.d.ts +12 -12
- package/dist/ts4.2/e2ee/events.d.ts +39 -39
- package/dist/ts4.2/e2ee/index.d.ts +6 -6
- package/dist/ts4.2/e2ee/types.d.ts +231 -231
- package/dist/ts4.2/e2ee/utils.d.ts +32 -32
- package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +16 -16
- package/dist/ts4.2/e2ee/worker/ErrorRateLimiter.d.ts +21 -21
- package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +209 -209
- package/dist/ts4.2/e2ee/worker/ParticipantKeyHandler.d.ts +81 -84
- package/dist/ts4.2/e2ee/worker/e2ee.worker.d.ts +2 -2
- package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +39 -28
- package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +23 -23
- package/dist/ts4.2/frameMetadata/FrameMetadataManager.d.ts +53 -53
- package/dist/ts4.2/frameMetadata/frameMetadata.d.ts +33 -33
- package/dist/ts4.2/frameMetadata/types.d.ts +62 -62
- package/dist/ts4.2/frameMetadata/utils.d.ts +9 -9
- package/dist/ts4.2/frameMetadata/worker/frameMetadata.worker.d.ts +2 -2
- package/dist/ts4.2/index.d.ts +76 -76
- package/dist/ts4.2/logger.d.ts +66 -66
- package/dist/ts4.2/options.d.ts +163 -149
- package/dist/ts4.2/room/BackOffStrategy.d.ts +27 -27
- package/dist/ts4.2/room/DefaultReconnectPolicy.d.ts +8 -8
- package/dist/ts4.2/room/DeviceManager.d.ts +12 -12
- package/dist/ts4.2/room/PCTransport.d.ts +268 -175
- package/dist/ts4.2/room/PCTransportManager.d.ts +77 -77
- package/dist/ts4.2/room/RTCEngine.d.ts +277 -262
- package/dist/ts4.2/room/ReconnectPolicy.d.ts +24 -24
- package/dist/ts4.2/room/RegionUrlProvider.d.ts +36 -36
- package/dist/ts4.2/room/Room.d.ts +407 -365
- package/dist/ts4.2/room/attribute-typings.d.ts +35 -35
- package/dist/ts4.2/room/data-channel/DataChannelManager.d.ts +63 -62
- package/dist/ts4.2/room/data-channel/FlowControlledDataChannel.d.ts +107 -95
- package/dist/ts4.2/room/data-channel/LossyDataChannel.d.ts +41 -41
- package/dist/ts4.2/room/data-channel/ReliableDataChannel.d.ts +57 -57
- package/dist/ts4.2/room/data-channel/types.d.ts +12 -12
- package/dist/ts4.2/room/data-stream/compression.d.ts +49 -49
- package/dist/ts4.2/room/data-stream/constants.d.ts +18 -18
- package/dist/ts4.2/room/data-stream/incoming/IncomingDataStreamManager.d.ts +29 -29
- package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +80 -80
- package/dist/ts4.2/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +73 -73
- package/dist/ts4.2/room/data-stream/outgoing/StreamWriter.d.ts +16 -16
- package/dist/ts4.2/room/data-stream/outgoing/header-utils.d.ts +18 -18
- package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +79 -80
- package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +50 -50
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +59 -59
- package/dist/ts4.2/room/data-track/frame.d.ts +22 -22
- package/dist/ts4.2/room/data-track/handle.d.ts +27 -27
- package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +124 -124
- package/dist/ts4.2/room/data-track/incoming/errors.d.ts +24 -24
- package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +41 -41
- package/dist/ts4.2/room/data-track/incoming/types.d.ts +20 -20
- package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +126 -126
- package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +74 -74
- package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +23 -23
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +48 -48
- package/dist/ts4.2/room/data-track/packet/constants.d.ts +20 -20
- package/dist/ts4.2/room/data-track/packet/errors.d.ts +40 -40
- package/dist/ts4.2/room/data-track/packet/extensions.d.ts +69 -69
- package/dist/ts4.2/room/data-track/packet/index.d.ts +98 -98
- package/dist/ts4.2/room/data-track/packet/serializable.d.ts +13 -13
- package/dist/ts4.2/room/data-track/packetizer.d.ts +43 -43
- package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -23
- package/dist/ts4.2/room/data-track/types.d.ts +22 -22
- package/dist/ts4.2/room/data-track/utils.d.ts +60 -60
- package/dist/ts4.2/room/debounce.d.ts +11 -11
- package/dist/ts4.2/room/defaults.d.ts +9 -9
- package/dist/ts4.2/room/errors.d.ts +180 -162
- package/dist/ts4.2/room/events.d.ts +638 -637
- package/dist/ts4.2/room/participant/LocalParticipant.d.ts +291 -287
- package/dist/ts4.2/room/participant/Participant.d.ts +142 -144
- package/dist/ts4.2/room/participant/ParticipantTrackPermission.d.ts +26 -26
- package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +85 -86
- package/dist/ts4.2/room/participant/publishUtils.d.ts +53 -53
- package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +43 -43
- package/dist/ts4.2/room/rpc/client/events.d.ts +8 -8
- package/dist/ts4.2/room/rpc/index.d.ts +7 -7
- package/dist/ts4.2/room/rpc/server/RpcServerManager.d.ts +44 -44
- package/dist/ts4.2/room/rpc/server/events.d.ts +8 -8
- package/dist/ts4.2/room/rpc/utils.d.ts +131 -131
- package/dist/ts4.2/room/stats.d.ts +71 -71
- package/dist/ts4.2/room/statsSummary.d.ts +13 -13
- package/dist/ts4.2/room/timers.d.ts +12 -12
- package/dist/ts4.2/room/token-source/TokenSource.d.ts +82 -82
- package/dist/ts4.2/room/token-source/types.d.ts +70 -70
- package/dist/ts4.2/room/token-source/utils.d.ts +8 -8
- package/dist/ts4.2/room/track/FrameMetadataExtractor.d.ts +19 -19
- package/dist/ts4.2/room/track/LocalAudioTrack.d.ts +62 -42
- package/dist/ts4.2/room/track/LocalTrack.d.ts +143 -125
- package/dist/ts4.2/room/track/LocalTrackPublication.d.ts +42 -42
- package/dist/ts4.2/room/track/LocalVideoTrack.d.ts +109 -100
- package/dist/ts4.2/room/track/RemoteAudioTrack.d.ts +61 -55
- package/dist/ts4.2/room/track/RemoteTrack.d.ts +38 -38
- package/dist/ts4.2/room/track/RemoteTrackPublication.d.ts +72 -75
- package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +73 -76
- package/dist/ts4.2/room/track/Track.d.ts +156 -166
- package/dist/ts4.2/room/track/TrackPublication.d.ts +75 -81
- package/dist/ts4.2/room/track/create.d.ts +25 -25
- package/dist/ts4.2/room/track/facingMode.d.ts +41 -41
- package/dist/ts4.2/room/track/options.d.ts +403 -403
- package/dist/ts4.2/room/track/processor/types.d.ts +42 -31
- package/dist/ts4.2/room/track/record.d.ts +13 -13
- package/dist/ts4.2/room/track/types.d.ts +28 -28
- package/dist/ts4.2/room/track/utils.d.ts +60 -47
- package/dist/ts4.2/room/types.d.ts +127 -127
- package/dist/ts4.2/room/utils.d.ts +273 -214
- package/dist/ts4.2/test/MockMediaStreamTrack.d.ts +26 -26
- package/dist/ts4.2/test/compressionStreamStubs.d.ts +12 -0
- package/dist/ts4.2/test/mocks.d.ts +12 -12
- package/dist/ts4.2/test/promiseState.d.ts +12 -12
- package/dist/ts4.2/test/signalToken.d.ts +26 -26
- package/dist/ts4.2/type-polyfills/non-shared-typed-arrays.d.ts +2 -2
- package/dist/ts4.2/utils/AsyncQueue.d.ts +23 -23
- package/dist/ts4.2/utils/TypedPromise.d.ts +17 -17
- package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -13
- package/dist/ts4.2/utils/browserParser.d.ts +13 -13
- package/dist/ts4.2/utils/camelToSnakeCase.d.ts +8 -8
- package/dist/ts4.2/utils/cloneDeep.d.ts +2 -2
- package/dist/ts4.2/utils/dataPacketBuffer.d.ts +34 -34
- package/dist/ts4.2/utils/deferrable-map.d.ts +32 -32
- package/dist/ts4.2/utils/machineInspector.d.ts +54 -54
- package/dist/ts4.2/utils/serializer.d.ts +48 -48
- package/dist/ts4.2/utils/subscribeToEvents.d.ts +15 -15
- package/dist/ts4.2/utils/ttlmap.d.ts +20 -20
- package/dist/ts4.2/version.d.ts +15 -15
- package/package.json +5 -4
- package/src/api/SignalClient.e2e.test.ts +1 -3
- package/src/api/SignalClient.test.ts +394 -10
- package/src/api/SignalClient.ts +132 -76
- package/src/api/WebSocketStream.test.ts +11 -0
- package/src/api/WebSocketStream.ts +22 -1
- package/src/api/utils.ts +1 -1
- package/src/e2ee/E2eeManager.test.ts +43 -0
- package/src/e2ee/E2eeManager.ts +6 -2
- package/src/e2ee/worker/FrameCryptor.test.ts +212 -90
- package/src/e2ee/worker/FrameCryptor.ts +21 -4
- package/src/e2ee/worker/naluUtils.test.ts +123 -0
- package/src/e2ee/worker/naluUtils.ts +57 -2
- package/src/index.ts +2 -0
- package/src/options.ts +16 -0
- package/src/room/DefaultReconnectPolicy.test.ts +58 -0
- package/src/room/DefaultReconnectPolicy.ts +14 -2
- package/src/room/PCTransport.test.ts +327 -9
- package/src/room/PCTransport.ts +339 -36
- package/src/room/PCTransportManager.ts +3 -1
- package/src/room/RTCEngine.test.ts +318 -2
- package/src/room/RTCEngine.ts +126 -12
- package/src/room/Room.test.ts +148 -6
- package/src/room/Room.ts +312 -80
- package/src/room/data-channel/DataChannelManager.test.ts +24 -7
- package/src/room/data-channel/DataChannelManager.ts +43 -38
- package/src/room/data-channel/FlowControlledDataChannel.test.ts +60 -18
- package/src/room/data-channel/FlowControlledDataChannel.ts +40 -22
- package/src/room/data-channel/LossyDataChannel.test.ts +38 -0
- package/src/room/data-channel/LossyDataChannel.ts +10 -1
- package/src/room/data-channel/ReliableDataChannel.test.ts +72 -0
- package/src/room/data-channel/ReliableDataChannel.ts +16 -5
- package/src/room/data-stream/incoming/IncomingDataStreamManager.test.ts +47 -20
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +16 -5
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.test.ts +60 -39
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +4 -4
- package/src/room/defaults.ts +1 -0
- package/src/room/errors.test.ts +36 -0
- package/src/room/errors.ts +27 -0
- package/src/room/events.ts +2 -1
- package/src/room/participant/LocalParticipant.test.ts +136 -1
- package/src/room/participant/LocalParticipant.ts +66 -17
- package/src/room/participant/Participant.ts +6 -3
- package/src/room/participant/publishUtils.ts +0 -19
- package/src/room/participant/restartOnDefaultAudioDevice.test.ts +177 -0
- package/src/room/rpc/client/RpcClientManager.test.ts +51 -0
- package/src/room/rpc/client/RpcClientManager.ts +32 -15
- package/src/room/rpc/utils.test.ts +32 -0
- package/src/room/rpc/utils.ts +7 -0
- package/src/room/track/LocalAudioTrack.ts +101 -10
- package/src/room/track/LocalTrack.ts +87 -19
- package/src/room/track/LocalVideoTrack.ts +17 -3
- package/src/room/track/RemoteAudioTrack.ts +59 -14
- package/src/room/track/RemoteVideoTrack.test.ts +210 -0
- package/src/room/track/RemoteVideoTrack.ts +29 -3
- package/src/room/track/processor/types.ts +11 -0
- package/src/room/track/utils.test.ts +206 -2
- package/src/room/track/utils.ts +117 -5
- package/src/room/utils.test.ts +250 -0
- package/src/room/utils.ts +152 -19
- package/src/test/compressionStreamStubs.ts +53 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare enum DataChannelKind {
|
|
2
|
-
RELIABLE = 0,
|
|
3
|
-
LOSSY = 1,
|
|
4
|
-
DATA_TRACK_LOSSY = 2
|
|
5
|
-
}
|
|
6
|
-
export declare const reliableDataChannelWaterMarkLow: number;
|
|
7
|
-
export declare const reliableDataChannelWaterMarkHigh: number;
|
|
8
|
-
export declare const lossyDataChannelWaterMarkLow: number;
|
|
9
|
-
export declare const lossyDataChannelWaterMarkHigh: number;
|
|
10
|
-
export declare function dataChannelLowWaterMark(kind: DataChannelKind): number;
|
|
11
|
-
export declare function dataChannelHighWaterMark(kind: DataChannelKind): number;
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
1
|
+
export declare enum DataChannelKind {
|
|
2
|
+
RELIABLE = 0,
|
|
3
|
+
LOSSY = 1,
|
|
4
|
+
DATA_TRACK_LOSSY = 2
|
|
5
|
+
}
|
|
6
|
+
export declare const reliableDataChannelWaterMarkLow: number;
|
|
7
|
+
export declare const reliableDataChannelWaterMarkHigh: number;
|
|
8
|
+
export declare const lossyDataChannelWaterMarkLow: number;
|
|
9
|
+
export declare const lossyDataChannelWaterMarkHigh: number;
|
|
10
|
+
export declare function dataChannelLowWaterMark(kind: DataChannelKind): number;
|
|
11
|
+
export declare function dataChannelHighWaterMark(kind: DataChannelKind): number;
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Compression helpers for data streams. The buffered deflate-raw variant ({@link deflateRawCompress})
|
|
3
|
-
* is for the inline (single-packet) case where the payload is small and bounded;
|
|
4
|
-
* {@link deflateRawTransform} / {@link inflateRawTransform} serve the chunked (multi-packet)
|
|
5
|
-
* `sendText`/`sendBytes`/`sendFile` paths, streaming the bytes through without buffering the whole
|
|
6
|
-
* payload.
|
|
7
|
-
*
|
|
8
|
-
* These operate on bytes (not strings) so a single set of helpers serves both text and byte streams;
|
|
9
|
-
* the `TextEncoder`/`TextDecoder` boundary lives at the manager/reader edges.
|
|
10
|
-
*
|
|
11
|
-
* Both streaming variants are exposed as `ReadableWritablePair`s so they drop straight into a
|
|
12
|
-
* `pipeThrough` chain. Each needs one localized cast to bridge a DOM lib-type mismatch: the platform
|
|
13
|
-
* `CompressionStream`/`DecompressionStream` type their `writable` as `WritableStream<BufferSource>`
|
|
14
|
-
* (a wider element type than `Uint8Array`), and `WritableStream<W>` is covariant in `W`, so neither
|
|
15
|
-
* is structurally a `ReadableWritablePair<Uint8Array, Uint8Array>` without help.
|
|
16
|
-
*
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
20
|
-
/**
|
|
21
|
-
* A `deflate-raw` compression transform (inverse of {@link inflateRawTransform}): pipe a byte stream
|
|
22
|
-
* through it to get the compressed bytes without buffering the whole payload. Used for the chunked
|
|
23
|
-
* `sendText`/`sendBytes`/`sendFile` paths, where the full payload is known up front but is streamed
|
|
24
|
-
* (e.g. from `file.stream()`) rather than held in memory.
|
|
25
|
-
*/
|
|
26
|
-
export declare function deflateRawTransform(): ReadableWritablePair<NonSharedUint8Array, NonSharedUint8Array>;
|
|
27
|
-
/**
|
|
28
|
-
* A `deflate-raw` decompression transform (inverse of {@link deflateRawTransform}): pipe a
|
|
29
|
-
* stream of compressed bytes through it to get the decompressed bytes. Inflate emits output greedily,
|
|
30
|
-
* so as long as the sender flushed at write boundaries each write's content is produced as soon as
|
|
31
|
-
* its compressed bytes arrive.
|
|
32
|
-
*/
|
|
33
|
-
export declare function inflateRawTransform(): ReadableWritablePair<NonSharedUint8Array, NonSharedUint8Array>;
|
|
34
|
-
/** deflate-raw compresses a byte array in full. Use for inline payloads; prefer the streaming
|
|
35
|
-
* path for the chunked case. */
|
|
36
|
-
export declare function deflateRawCompress(data: NonSharedUint8Array): Promise<NonSharedUint8Array>;
|
|
37
|
-
/**
|
|
38
|
-
* Decompresses a raw-deflate byte array in full (inverse of {@link deflateRawCompress}).
|
|
39
|
-
* `maxByteLength` bounds the decompressed output (decompression-bomb guard); exceeding it rejects
|
|
40
|
-
* with a `PayloadTooLarge` error.
|
|
41
|
-
*/
|
|
42
|
-
export declare function deflateRawDecompress(data: NonSharedUint8Array, maxByteLength?: number): Promise<NonSharedUint8Array>;
|
|
43
|
-
/**
|
|
44
|
-
* Drains a byte stream, concatenating all of its chunks into a single array. When
|
|
45
|
-
* `maxByteLength` is given, drops the stream and throws `PayloadTooLarge` as soon as the
|
|
46
|
-
* accumulated output exceeds it.
|
|
47
|
-
*/
|
|
48
|
-
export declare function collect(stream: ReadableStream<NonSharedUint8Array>, maxByteLength?: number): Promise<NonSharedUint8Array>;
|
|
49
|
-
//# sourceMappingURL=compression.d.ts.map
|
|
1
|
+
/*
|
|
2
|
+
* Compression helpers for data streams. The buffered deflate-raw variant ({@link deflateRawCompress})
|
|
3
|
+
* is for the inline (single-packet) case where the payload is small and bounded;
|
|
4
|
+
* {@link deflateRawTransform} / {@link inflateRawTransform} serve the chunked (multi-packet)
|
|
5
|
+
* `sendText`/`sendBytes`/`sendFile` paths, streaming the bytes through without buffering the whole
|
|
6
|
+
* payload.
|
|
7
|
+
*
|
|
8
|
+
* These operate on bytes (not strings) so a single set of helpers serves both text and byte streams;
|
|
9
|
+
* the `TextEncoder`/`TextDecoder` boundary lives at the manager/reader edges.
|
|
10
|
+
*
|
|
11
|
+
* Both streaming variants are exposed as `ReadableWritablePair`s so they drop straight into a
|
|
12
|
+
* `pipeThrough` chain. Each needs one localized cast to bridge a DOM lib-type mismatch: the platform
|
|
13
|
+
* `CompressionStream`/`DecompressionStream` type their `writable` as `WritableStream<BufferSource>`
|
|
14
|
+
* (a wider element type than `Uint8Array`), and `WritableStream<W>` is covariant in `W`, so neither
|
|
15
|
+
* is structurally a `ReadableWritablePair<Uint8Array, Uint8Array>` without help.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
20
|
+
/**
|
|
21
|
+
* A `deflate-raw` compression transform (inverse of {@link inflateRawTransform}): pipe a byte stream
|
|
22
|
+
* through it to get the compressed bytes without buffering the whole payload. Used for the chunked
|
|
23
|
+
* `sendText`/`sendBytes`/`sendFile` paths, where the full payload is known up front but is streamed
|
|
24
|
+
* (e.g. from `file.stream()`) rather than held in memory.
|
|
25
|
+
*/
|
|
26
|
+
export declare function deflateRawTransform(): ReadableWritablePair<NonSharedUint8Array, NonSharedUint8Array>;
|
|
27
|
+
/**
|
|
28
|
+
* A `deflate-raw` decompression transform (inverse of {@link deflateRawTransform}): pipe a
|
|
29
|
+
* stream of compressed bytes through it to get the decompressed bytes. Inflate emits output greedily,
|
|
30
|
+
* so as long as the sender flushed at write boundaries each write's content is produced as soon as
|
|
31
|
+
* its compressed bytes arrive.
|
|
32
|
+
*/
|
|
33
|
+
export declare function inflateRawTransform(): ReadableWritablePair<NonSharedUint8Array, NonSharedUint8Array>;
|
|
34
|
+
/** deflate-raw compresses a byte array in full. Use for inline payloads; prefer the streaming
|
|
35
|
+
* path for the chunked case. */
|
|
36
|
+
export declare function deflateRawCompress(data: NonSharedUint8Array): Promise<NonSharedUint8Array>;
|
|
37
|
+
/**
|
|
38
|
+
* Decompresses a raw-deflate byte array in full (inverse of {@link deflateRawCompress}).
|
|
39
|
+
* `maxByteLength` bounds the decompressed output (decompression-bomb guard); exceeding it rejects
|
|
40
|
+
* with a `PayloadTooLarge` error.
|
|
41
|
+
*/
|
|
42
|
+
export declare function deflateRawDecompress(data: NonSharedUint8Array, maxByteLength?: number): Promise<NonSharedUint8Array>;
|
|
43
|
+
/**
|
|
44
|
+
* Drains a byte stream, concatenating all of its chunks into a single array. When
|
|
45
|
+
* `maxByteLength` is given, drops the stream and throws `PayloadTooLarge` as soon as the
|
|
46
|
+
* accumulated output exceeds it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function collect(stream: ReadableStream<NonSharedUint8Array>, maxByteLength?: number): Promise<NonSharedUint8Array>;
|
|
49
|
+
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maximum size of a single data-stream chunk in bytes, and the budget used to decide whether a
|
|
3
|
-
* payload can be sent inline as a single header packet. Kept below the ~16k data-channel MTU to
|
|
4
|
-
* leave headroom for protocol framing and E2EE overhead.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare const STREAM_CHUNK_SIZE_BYTES = 15000;
|
|
9
|
-
/**
|
|
10
|
-
* Default cap on the number of decompressed bytes a single incoming compressed data stream may
|
|
11
|
-
* produce (5 GB). A tiny compressed payload can inflate to an arbitrarily large output
|
|
12
|
-
* (decompression bomb), so the decompressor's output is bounded rather than trusting the wire
|
|
13
|
-
* size; streams exceeding the cap error with `PayloadTooLarge`.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare const DEFAULT_MAX_PAYLOAD_BYTE_LENGTH = 5000000000;
|
|
18
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
1
|
+
/**
|
|
2
|
+
* Maximum size of a single data-stream chunk in bytes, and the budget used to decide whether a
|
|
3
|
+
* payload can be sent inline as a single header packet. Kept below the ~16k data-channel MTU to
|
|
4
|
+
* leave headroom for protocol framing and E2EE overhead.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const STREAM_CHUNK_SIZE_BYTES = 15000;
|
|
9
|
+
/**
|
|
10
|
+
* Default cap on the number of decompressed bytes a single incoming compressed data stream may
|
|
11
|
+
* produce (5 GB). A tiny compressed payload can inflate to an arbitrarily large output
|
|
12
|
+
* (decompression bomb), so the decompressor's output is bounded rather than trusting the wire
|
|
13
|
+
* size; streams exceeding the cap error with `PayloadTooLarge`.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_MAX_PAYLOAD_BYTE_LENGTH = 5000000000;
|
|
18
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { DataPacket } from '@livekit/protocol';
|
|
2
|
-
import { Encryption_Type } from '@livekit/protocol';
|
|
3
|
-
import type { ByteStreamHandler, TextStreamHandler } from './StreamReader';
|
|
4
|
-
export default class IncomingDataStreamManager {
|
|
5
|
-
private log;
|
|
6
|
-
/** Max number of decompressed bytes an incoming compressed stream may produce before it is
|
|
7
|
-
* errored (decompression-bomb guard). */
|
|
8
|
-
private maxPayloadByteLength;
|
|
9
|
-
constructor(maxPayloadByteLength?: number);
|
|
10
|
-
private byteStreamControllers;
|
|
11
|
-
private textStreamControllers;
|
|
12
|
-
private byteStreamHandlers;
|
|
13
|
-
private textStreamHandlers;
|
|
14
|
-
private isConnected;
|
|
15
|
-
private bufferedPackets;
|
|
16
|
-
setConnected(connected: boolean): void;
|
|
17
|
-
private flushBufferedPackets;
|
|
18
|
-
registerTextStreamHandler(topic: string, callback: TextStreamHandler): void;
|
|
19
|
-
unregisterTextStreamHandler(topic: string): void;
|
|
20
|
-
registerByteStreamHandler(topic: string, callback: ByteStreamHandler): void;
|
|
21
|
-
unregisterByteStreamHandler(topic: string): void;
|
|
22
|
-
clearControllers(): void;
|
|
23
|
-
validateParticipantHasNoActiveDataStreams(participantIdentity: string): void;
|
|
24
|
-
handleDataStreamPacket(packet: DataPacket, encryptionType: Encryption_Type): void;
|
|
25
|
-
private handleStreamHeader;
|
|
26
|
-
private handleStreamChunk;
|
|
27
|
-
private handleStreamTrailer;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=IncomingDataStreamManager.d.ts.map
|
|
1
|
+
import type { DataPacket } from '@livekit/protocol';
|
|
2
|
+
import { Encryption_Type } from '@livekit/protocol';
|
|
3
|
+
import type { ByteStreamHandler, TextStreamHandler } from './StreamReader';
|
|
4
|
+
export default class IncomingDataStreamManager {
|
|
5
|
+
private log;
|
|
6
|
+
/** Max number of decompressed bytes an incoming compressed stream may produce before it is
|
|
7
|
+
* errored (decompression-bomb guard). */
|
|
8
|
+
private maxPayloadByteLength;
|
|
9
|
+
constructor(maxPayloadByteLength?: number);
|
|
10
|
+
private byteStreamControllers;
|
|
11
|
+
private textStreamControllers;
|
|
12
|
+
private byteStreamHandlers;
|
|
13
|
+
private textStreamHandlers;
|
|
14
|
+
private isConnected;
|
|
15
|
+
private bufferedPackets;
|
|
16
|
+
setConnected(connected: boolean): void;
|
|
17
|
+
private flushBufferedPackets;
|
|
18
|
+
registerTextStreamHandler(topic: string, callback: TextStreamHandler): void;
|
|
19
|
+
unregisterTextStreamHandler(topic: string): void;
|
|
20
|
+
registerByteStreamHandler(topic: string, callback: ByteStreamHandler): void;
|
|
21
|
+
unregisterByteStreamHandler(topic: string): void;
|
|
22
|
+
clearControllers(): void;
|
|
23
|
+
validateParticipantHasNoActiveDataStreams(participantIdentity: string): void;
|
|
24
|
+
handleDataStreamPacket(packet: DataPacket, encryptionType: Encryption_Type): void;
|
|
25
|
+
private handleStreamHeader;
|
|
26
|
+
private handleStreamChunk;
|
|
27
|
+
private handleStreamTrailer;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=IncomingDataStreamManager.d.ts.map
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import type { DataStream_Chunk } from '@livekit/protocol';
|
|
2
|
-
import type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from '../../types';
|
|
3
|
-
export type BaseStreamReaderReadAllOpts = {
|
|
4
|
-
/** An AbortSignal can be used to terminate reads early. */
|
|
5
|
-
signal?: AbortSignal;
|
|
6
|
-
};
|
|
7
|
-
declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
8
|
-
protected reader: ReadableStream<DataStream_Chunk>;
|
|
9
|
-
protected totalByteSize?: number;
|
|
10
|
-
protected _info: T;
|
|
11
|
-
protected bytesReceived: number;
|
|
12
|
-
get info(): T;
|
|
13
|
-
/** @internal */
|
|
14
|
-
protected validateBytesReceived(doneReceiving?: boolean): void;
|
|
15
|
-
constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number);
|
|
16
|
-
/**
|
|
17
|
-
* Counts a chunk's bytes against `totalByteSize` and reports progress. Chunk ordering and
|
|
18
|
-
* de-duplication happen upstream in the manager's `ensureOrderedChunks`, so every chunk reaching
|
|
19
|
-
* here is new and in order.
|
|
20
|
-
*/
|
|
21
|
-
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
22
|
-
/**
|
|
23
|
-
* @param progress - progress of the stream between 0 and 1. Undefined for streams of unknown size
|
|
24
|
-
*/
|
|
25
|
-
onProgress?: (progress: number | undefined) => void;
|
|
26
|
-
abstract readAll(opts?: BaseStreamReaderReadAllOpts): Promise<string | Array<Uint8Array>>;
|
|
27
|
-
}
|
|
28
|
-
export declare class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {
|
|
29
|
-
signal?: AbortSignal;
|
|
30
|
-
[Symbol.asyncIterator](): {
|
|
31
|
-
next: () => Promise<IteratorResult<Uint8Array>>;
|
|
32
|
-
return(): Promise<IteratorResult<Uint8Array>>;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Injects an AbortSignal, which if aborted, will terminate the currently active
|
|
36
|
-
* stream iteration operation.
|
|
37
|
-
*
|
|
38
|
-
* Note that when using AbortSignal.timeout(...), the timeout applies across
|
|
39
|
-
* the whole iteration operation, not just one individual chunk read.
|
|
40
|
-
*/
|
|
41
|
-
withAbortSignal(signal: AbortSignal): this;
|
|
42
|
-
readAll(opts?: BaseStreamReaderReadAllOpts): Promise<Array<Uint8Array>>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* A class to read chunks from a ReadableStream and decode them as UTF-8 text.
|
|
46
|
-
*
|
|
47
|
-
* NOTE: chunk-level `version` (resending a chunk at an already-received `chunkIndex` to supersede
|
|
48
|
-
* it) is not supported. The reader used to rebuild the whole string from a per-index chunk map and
|
|
49
|
-
* yield it as `TextStreamChunk.collected`, which made superseding work; 5d4a6346 (#1410, text auto
|
|
50
|
-
* chunking) changed the iterator to yield each chunk's text as it arrives, and a streaming reader
|
|
51
|
-
* cannot retract text it has already handed to the consumer. No sender emits a versioned chunk.
|
|
52
|
-
*/
|
|
53
|
-
export declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
54
|
-
signal?: AbortSignal;
|
|
55
|
-
/**
|
|
56
|
-
* Async iterator implementation to allow usage of `for await...of` syntax.
|
|
57
|
-
* Yields each chunk's decoded text as it arrives - a delta, not the string accumulated so far.
|
|
58
|
-
*/
|
|
59
|
-
[Symbol.asyncIterator](): {
|
|
60
|
-
next: () => Promise<IteratorResult<string>>;
|
|
61
|
-
return(): Promise<IteratorResult<string>>;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Injects an AbortSignal, which if aborted, will terminate the currently active
|
|
65
|
-
* stream iteration operation.
|
|
66
|
-
*
|
|
67
|
-
* Note that when using AbortSignal.timeout(...), the timeout applies across
|
|
68
|
-
* the whole iteration operation, not just one individual chunk read.
|
|
69
|
-
*/
|
|
70
|
-
withAbortSignal(signal: AbortSignal): this;
|
|
71
|
-
readAll(opts?: BaseStreamReaderReadAllOpts): Promise<string>;
|
|
72
|
-
}
|
|
73
|
-
export type ByteStreamHandler = (reader: ByteStreamReader, participantInfo: {
|
|
74
|
-
identity: string;
|
|
75
|
-
}) => void;
|
|
76
|
-
export type TextStreamHandler = (reader: TextStreamReader, participantInfo: {
|
|
77
|
-
identity: string;
|
|
78
|
-
}) => void;
|
|
79
|
-
export {};
|
|
80
|
-
//# sourceMappingURL=StreamReader.d.ts.map
|
|
1
|
+
import type { DataStream_Chunk } from '@livekit/protocol';
|
|
2
|
+
import type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from '../../types';
|
|
3
|
+
export type BaseStreamReaderReadAllOpts = {
|
|
4
|
+
/** An AbortSignal can be used to terminate reads early. */
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
};
|
|
7
|
+
declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
8
|
+
protected reader: ReadableStream<DataStream_Chunk>;
|
|
9
|
+
protected totalByteSize?: number;
|
|
10
|
+
protected _info: T;
|
|
11
|
+
protected bytesReceived: number;
|
|
12
|
+
get info(): T;
|
|
13
|
+
/** @internal */
|
|
14
|
+
protected validateBytesReceived(doneReceiving?: boolean): void;
|
|
15
|
+
constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number);
|
|
16
|
+
/**
|
|
17
|
+
* Counts a chunk's bytes against `totalByteSize` and reports progress. Chunk ordering and
|
|
18
|
+
* de-duplication happen upstream in the manager's `ensureOrderedChunks`, so every chunk reaching
|
|
19
|
+
* here is new and in order.
|
|
20
|
+
*/
|
|
21
|
+
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
22
|
+
/**
|
|
23
|
+
* @param progress - progress of the stream between 0 and 1. Undefined for streams of unknown size
|
|
24
|
+
*/
|
|
25
|
+
onProgress?: (progress: number | undefined) => void;
|
|
26
|
+
abstract readAll(opts?: BaseStreamReaderReadAllOpts): Promise<string | Array<Uint8Array>>;
|
|
27
|
+
}
|
|
28
|
+
export declare class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
[Symbol.asyncIterator](): {
|
|
31
|
+
next: () => Promise<IteratorResult<Uint8Array>>;
|
|
32
|
+
return(): Promise<IteratorResult<Uint8Array>>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Injects an AbortSignal, which if aborted, will terminate the currently active
|
|
36
|
+
* stream iteration operation.
|
|
37
|
+
*
|
|
38
|
+
* Note that when using AbortSignal.timeout(...), the timeout applies across
|
|
39
|
+
* the whole iteration operation, not just one individual chunk read.
|
|
40
|
+
*/
|
|
41
|
+
withAbortSignal(signal: AbortSignal): this;
|
|
42
|
+
readAll(opts?: BaseStreamReaderReadAllOpts): Promise<Array<Uint8Array>>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A class to read chunks from a ReadableStream and decode them as UTF-8 text.
|
|
46
|
+
*
|
|
47
|
+
* NOTE: chunk-level `version` (resending a chunk at an already-received `chunkIndex` to supersede
|
|
48
|
+
* it) is not supported. The reader used to rebuild the whole string from a per-index chunk map and
|
|
49
|
+
* yield it as `TextStreamChunk.collected`, which made superseding work; 5d4a6346 (#1410, text auto
|
|
50
|
+
* chunking) changed the iterator to yield each chunk's text as it arrives, and a streaming reader
|
|
51
|
+
* cannot retract text it has already handed to the consumer. No sender emits a versioned chunk.
|
|
52
|
+
*/
|
|
53
|
+
export declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
/**
|
|
56
|
+
* Async iterator implementation to allow usage of `for await...of` syntax.
|
|
57
|
+
* Yields each chunk's decoded text as it arrives - a delta, not the string accumulated so far.
|
|
58
|
+
*/
|
|
59
|
+
[Symbol.asyncIterator](): {
|
|
60
|
+
next: () => Promise<IteratorResult<string>>;
|
|
61
|
+
return(): Promise<IteratorResult<string>>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Injects an AbortSignal, which if aborted, will terminate the currently active
|
|
65
|
+
* stream iteration operation.
|
|
66
|
+
*
|
|
67
|
+
* Note that when using AbortSignal.timeout(...), the timeout applies across
|
|
68
|
+
* the whole iteration operation, not just one individual chunk read.
|
|
69
|
+
*/
|
|
70
|
+
withAbortSignal(signal: AbortSignal): this;
|
|
71
|
+
readAll(opts?: BaseStreamReaderReadAllOpts): Promise<string>;
|
|
72
|
+
}
|
|
73
|
+
export type ByteStreamHandler = (reader: ByteStreamReader, participantInfo: {
|
|
74
|
+
identity: string;
|
|
75
|
+
}) => void;
|
|
76
|
+
export type TextStreamHandler = (reader: TextStreamReader, participantInfo: {
|
|
77
|
+
identity: string;
|
|
78
|
+
}) => void;
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=StreamReader.d.ts.map
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { ClientInfo_Capability } from '@livekit/protocol';
|
|
2
|
-
import type { StructuredLogger } from '../../../logger';
|
|
3
|
-
import type RTCEngine from '../../RTCEngine';
|
|
4
|
-
import type { ByteStreamInfo, SendBytesOptions, SendFileOptions, SendTextOptions, StreamBytesOptions, StreamTextOptions, TextStreamInfo } from '../../types';
|
|
5
|
-
import { ByteStreamWriter, TextStreamWriter } from './StreamWriter';
|
|
6
|
-
/**
|
|
7
|
-
* Manages sending custom user data via data channels.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export default class OutgoingDataStreamManager {
|
|
11
|
-
protected engine: RTCEngine;
|
|
12
|
-
protected log: StructuredLogger;
|
|
13
|
-
/** Returns the advertised client protocol of a remote participant, used to decide whether a
|
|
14
|
-
* recipient can receive single-packet (inline) data streams. */
|
|
15
|
-
protected getRemoteParticipantClientProtocol: (identity: string) => number;
|
|
16
|
-
/** Returns the client capabilities a remote participant advertises, used to decide whether a
|
|
17
|
-
* recipient can decompress a deflate-raw compressed stream. */
|
|
18
|
-
protected getRemoteParticipantCapabilities: (identity: string) => Array<ClientInfo_Capability>;
|
|
19
|
-
/** Returns the identities of every remote participant currently in the room, used to decide
|
|
20
|
-
* whether a broadcast (no explicit destinations) can be sent inline. */
|
|
21
|
-
protected getAllRemoteParticipantIdentities: () => Array<string>;
|
|
22
|
-
constructor(engine: RTCEngine, log: StructuredLogger, getRemoteParticipantClientProtocol: (identity: string) => number, getRemoteParticipantCapabilities: (identity: string) => Array<ClientInfo_Capability>, getAllRemoteParticipantIdentities: () => Array<string>);
|
|
23
|
-
setupEngine(engine: RTCEngine): void;
|
|
24
|
-
/** {@inheritDoc LocalParticipant.sendText} */
|
|
25
|
-
sendText(text: string, options?: SendTextOptions): Promise<TextStreamInfo>;
|
|
26
|
-
/**
|
|
27
|
-
* Sends a complete in-memory byte payload. Mirrors {@link sendText}'s semantics: when every
|
|
28
|
-
* recipient supports data streams v2 the payload rides inline in a single header packet
|
|
29
|
-
* (optionally deflate-raw compressed), otherwise it is sent as a (optionally compressed)
|
|
30
|
-
* chunked byte stream. Unlike {@link sendFile}, the whole payload is already in memory, so the
|
|
31
|
-
* inline single-packet fast path applies.
|
|
32
|
-
*/
|
|
33
|
-
sendBytes(bytes: Uint8Array, options?: SendBytesOptions): Promise<ByteStreamInfo>;
|
|
34
|
-
/**
|
|
35
|
-
* Returns true only if every recipient is known to support data streams v2 (single-packet inline
|
|
36
|
-
* streams and compression). For a targeted send this checks the named destination identities; for
|
|
37
|
-
* a broadcast (no explicit destinations) it checks every remote participant currently in the room.
|
|
38
|
-
* An empty room (nobody to receive) is considered eligible.
|
|
39
|
-
*/
|
|
40
|
-
private allRecipientsSupportV2;
|
|
41
|
-
/**
|
|
42
|
-
* Returns true only if every recipient advertises the deflate-raw compression capability (so it
|
|
43
|
-
* can decompress a compressed stream). Resolved the same way as {@link allRecipientsSupportV2}:
|
|
44
|
-
* named destinations, or every remote participant for a broadcast; an empty room is eligible.
|
|
45
|
-
*/
|
|
46
|
-
private allRecipientsSupportCompression;
|
|
47
|
-
/**
|
|
48
|
-
* Shared chunked-stream send for `sendText`/`sendFile`: sends the prebuilt header packet, then
|
|
49
|
-
* forwards `source` (optionally deflate-raw compressed) as `streamChunk` packets re-chunked to
|
|
50
|
-
* the MTU budget with contiguous indices, then sends the trailer. The source is consumed
|
|
51
|
-
* incrementally, so a `file.stream()` is never buffered in full. The platform compressor can't
|
|
52
|
-
* flush mid-stream, so compression is only used when the whole payload is available as a stream
|
|
53
|
-
* up front (not for incremental writers like `streamText`/`streamBytes`).
|
|
54
|
-
*/
|
|
55
|
-
private sendChunkedByteStream;
|
|
56
|
-
/**
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
streamText(options?: StreamTextOptions): Promise<TextStreamWriter>;
|
|
60
|
-
sendFile(file: File, options?: SendFileOptions): Promise<{
|
|
61
|
-
id: string;
|
|
62
|
-
}>;
|
|
63
|
-
/**
|
|
64
|
-
* Streams a file as a chunked byte stream, compressed (deflate-raw) when the runtime supports it
|
|
65
|
-
* and every recipient is on data streams v2. The file is piped `file.stream()` →
|
|
66
|
-
* (`CompressionStream`) → chunk packets via {@link sendChunkedByteStream}, so it is never fully
|
|
67
|
-
* buffered in memory — unlike {@link sendBytes}, there is no inline single-packet fast path for
|
|
68
|
-
* files (the compressed size can't be known up front without buffering the whole file).
|
|
69
|
-
*/
|
|
70
|
-
private _sendFile;
|
|
71
|
-
streamBytes(options?: StreamBytesOptions): Promise<ByteStreamWriter>;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=OutgoingDataStreamManager.d.ts.map
|
|
1
|
+
import { ClientInfo_Capability } from '@livekit/protocol';
|
|
2
|
+
import type { StructuredLogger } from '../../../logger';
|
|
3
|
+
import type RTCEngine from '../../RTCEngine';
|
|
4
|
+
import type { ByteStreamInfo, SendBytesOptions, SendFileOptions, SendTextOptions, StreamBytesOptions, StreamTextOptions, TextStreamInfo } from '../../types';
|
|
5
|
+
import { ByteStreamWriter, TextStreamWriter } from './StreamWriter';
|
|
6
|
+
/**
|
|
7
|
+
* Manages sending custom user data via data channels.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export default class OutgoingDataStreamManager {
|
|
11
|
+
protected engine: RTCEngine;
|
|
12
|
+
protected log: StructuredLogger;
|
|
13
|
+
/** Returns the advertised client protocol of a remote participant, used to decide whether a
|
|
14
|
+
* recipient can receive single-packet (inline) data streams. */
|
|
15
|
+
protected getRemoteParticipantClientProtocol: (identity: string) => number;
|
|
16
|
+
/** Returns the client capabilities a remote participant advertises, used to decide whether a
|
|
17
|
+
* recipient can decompress a deflate-raw compressed stream. */
|
|
18
|
+
protected getRemoteParticipantCapabilities: (identity: string) => Array<ClientInfo_Capability>;
|
|
19
|
+
/** Returns the identities of every remote participant currently in the room, used to decide
|
|
20
|
+
* whether a broadcast (no explicit destinations) can be sent inline. */
|
|
21
|
+
protected getAllRemoteParticipantIdentities: () => Array<string>;
|
|
22
|
+
constructor(engine: RTCEngine, log: StructuredLogger, getRemoteParticipantClientProtocol: (identity: string) => number, getRemoteParticipantCapabilities: (identity: string) => Array<ClientInfo_Capability>, getAllRemoteParticipantIdentities: () => Array<string>);
|
|
23
|
+
setupEngine(engine: RTCEngine): void;
|
|
24
|
+
/** {@inheritDoc LocalParticipant.sendText} */
|
|
25
|
+
sendText(text: string, options?: SendTextOptions): Promise<TextStreamInfo>;
|
|
26
|
+
/**
|
|
27
|
+
* Sends a complete in-memory byte payload. Mirrors {@link sendText}'s semantics: when every
|
|
28
|
+
* recipient supports data streams v2 the payload rides inline in a single header packet
|
|
29
|
+
* (optionally deflate-raw compressed), otherwise it is sent as a (optionally compressed)
|
|
30
|
+
* chunked byte stream. Unlike {@link sendFile}, the whole payload is already in memory, so the
|
|
31
|
+
* inline single-packet fast path applies.
|
|
32
|
+
*/
|
|
33
|
+
sendBytes(bytes: Uint8Array, options?: SendBytesOptions): Promise<ByteStreamInfo>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns true only if every recipient is known to support data streams v2 (single-packet inline
|
|
36
|
+
* streams and compression). For a targeted send this checks the named destination identities; for
|
|
37
|
+
* a broadcast (no explicit destinations) it checks every remote participant currently in the room.
|
|
38
|
+
* An empty room (nobody to receive) is considered eligible.
|
|
39
|
+
*/
|
|
40
|
+
private allRecipientsSupportV2;
|
|
41
|
+
/**
|
|
42
|
+
* Returns true only if every recipient advertises the deflate-raw compression capability (so it
|
|
43
|
+
* can decompress a compressed stream). Resolved the same way as {@link allRecipientsSupportV2}:
|
|
44
|
+
* named destinations, or every remote participant for a broadcast; an empty room is eligible.
|
|
45
|
+
*/
|
|
46
|
+
private allRecipientsSupportCompression;
|
|
47
|
+
/**
|
|
48
|
+
* Shared chunked-stream send for `sendText`/`sendFile`: sends the prebuilt header packet, then
|
|
49
|
+
* forwards `source` (optionally deflate-raw compressed) as `streamChunk` packets re-chunked to
|
|
50
|
+
* the MTU budget with contiguous indices, then sends the trailer. The source is consumed
|
|
51
|
+
* incrementally, so a `file.stream()` is never buffered in full. The platform compressor can't
|
|
52
|
+
* flush mid-stream, so compression is only used when the whole payload is available as a stream
|
|
53
|
+
* up front (not for incremental writers like `streamText`/`streamBytes`).
|
|
54
|
+
*/
|
|
55
|
+
private sendChunkedByteStream;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
streamText(options?: StreamTextOptions): Promise<TextStreamWriter>;
|
|
60
|
+
sendFile(file: File, options?: SendFileOptions): Promise<{
|
|
61
|
+
id: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Streams a file as a chunked byte stream, compressed (deflate-raw) when the runtime supports it
|
|
65
|
+
* and every recipient is on data streams v2. The file is piped `file.stream()` →
|
|
66
|
+
* (`CompressionStream`) → chunk packets via {@link sendChunkedByteStream}, so it is never fully
|
|
67
|
+
* buffered in memory — unlike {@link sendBytes}, there is no inline single-packet fast path for
|
|
68
|
+
* files (the compressed size can't be known up front without buffering the whole file).
|
|
69
|
+
*/
|
|
70
|
+
private _sendFile;
|
|
71
|
+
streamBytes(options?: StreamBytesOptions): Promise<ByteStreamWriter>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=OutgoingDataStreamManager.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from '../../types';
|
|
2
|
-
declare class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {
|
|
3
|
-
protected writableStream: WritableStream<T>;
|
|
4
|
-
protected defaultWriter: WritableStreamDefaultWriter<T>;
|
|
5
|
-
protected onClose?: () => void;
|
|
6
|
-
readonly info: InfoType;
|
|
7
|
-
constructor(writableStream: WritableStream<T>, info: InfoType, onClose?: () => void);
|
|
8
|
-
write(chunk: T): Promise<void>;
|
|
9
|
-
close(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
export declare class TextStreamWriter extends BaseStreamWriter<string, TextStreamInfo> {
|
|
12
|
-
}
|
|
13
|
-
export declare class ByteStreamWriter extends BaseStreamWriter<Uint8Array, ByteStreamInfo> {
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=StreamWriter.d.ts.map
|
|
1
|
+
import type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from '../../types';
|
|
2
|
+
declare class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {
|
|
3
|
+
protected writableStream: WritableStream<T>;
|
|
4
|
+
protected defaultWriter: WritableStreamDefaultWriter<T>;
|
|
5
|
+
protected onClose?: () => void;
|
|
6
|
+
readonly info: InfoType;
|
|
7
|
+
constructor(writableStream: WritableStream<T>, info: InfoType, onClose?: () => void);
|
|
8
|
+
write(chunk: T): Promise<void>;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class TextStreamWriter extends BaseStreamWriter<string, TextStreamInfo> {
|
|
12
|
+
}
|
|
13
|
+
export declare class ByteStreamWriter extends BaseStreamWriter<Uint8Array, ByteStreamInfo> {
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=StreamWriter.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { DataPacket, DataStream_CompressionType, DataStream_Header } from '@livekit/protocol';
|
|
2
|
-
import type { ByteStreamInfo, StreamTextOptions, TextStreamInfo } from '../../types';
|
|
3
|
-
/** The data-streams-v2 wire signals carried directly on the header: the compression flag and the
|
|
4
|
-
* inline single-packet payload. Both used to live in reserved header attributes; they are now
|
|
5
|
-
* first-class protobuf fields on `DataStream.Header`. */
|
|
6
|
-
export interface StreamHeaderV2Fields {
|
|
7
|
-
/** Compression applied to the inline/chunked payload. Defaults to `NONE` when omitted. */
|
|
8
|
-
compression?: DataStream_CompressionType;
|
|
9
|
-
/** The full payload smuggled into the header for single-packet (inline) sends. */
|
|
10
|
-
inlineContent?: Uint8Array;
|
|
11
|
-
}
|
|
12
|
-
/** Builds the `DataStream_Header` for a text stream from its info and stream options. */
|
|
13
|
-
export declare function buildTextStreamHeader(info: TextStreamInfo, options?: Pick<StreamTextOptions, 'version' | 'replyToStreamId' | 'type'>, v2?: StreamHeaderV2Fields): DataStream_Header;
|
|
14
|
-
/** Builds the `DataStream_Header` for a byte stream from its info. */
|
|
15
|
-
export declare function buildByteStreamHeader(info: ByteStreamInfo, v2?: StreamHeaderV2Fields): DataStream_Header;
|
|
16
|
-
/** Wraps a `DataStream_Header` in a `DataPacket` ready to be sent over a data channel. */
|
|
17
|
-
export declare function createStreamHeaderPacket(header: DataStream_Header, destinationIdentities?: Array<string>): DataPacket;
|
|
18
|
-
//# sourceMappingURL=header-utils.d.ts.map
|
|
1
|
+
import { DataPacket, DataStream_CompressionType, DataStream_Header } from '@livekit/protocol';
|
|
2
|
+
import type { ByteStreamInfo, StreamTextOptions, TextStreamInfo } from '../../types';
|
|
3
|
+
/** The data-streams-v2 wire signals carried directly on the header: the compression flag and the
|
|
4
|
+
* inline single-packet payload. Both used to live in reserved header attributes; they are now
|
|
5
|
+
* first-class protobuf fields on `DataStream.Header`. */
|
|
6
|
+
export interface StreamHeaderV2Fields {
|
|
7
|
+
/** Compression applied to the inline/chunked payload. Defaults to `NONE` when omitted. */
|
|
8
|
+
compression?: DataStream_CompressionType;
|
|
9
|
+
/** The full payload smuggled into the header for single-packet (inline) sends. */
|
|
10
|
+
inlineContent?: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
/** Builds the `DataStream_Header` for a text stream from its info and stream options. */
|
|
13
|
+
export declare function buildTextStreamHeader(info: TextStreamInfo, options?: Pick<StreamTextOptions, 'version' | 'replyToStreamId' | 'type'>, v2?: StreamHeaderV2Fields): DataStream_Header;
|
|
14
|
+
/** Builds the `DataStream_Header` for a byte stream from its info. */
|
|
15
|
+
export declare function buildByteStreamHeader(info: ByteStreamInfo, v2?: StreamHeaderV2Fields): DataStream_Header;
|
|
16
|
+
/** Wraps a `DataStream_Header` in a `DataPacket` ready to be sent over a data channel. */
|
|
17
|
+
export declare function createStreamHeaderPacket(header: DataStream_Header, destinationIdentities?: Array<string>): DataPacket;
|
|
18
|
+
//# sourceMappingURL=header-utils.d.ts.map
|