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,124 +1,124 @@
|
|
|
1
|
-
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
-
import type TypedEmitter from 'typed-emitter';
|
|
3
|
-
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
4
|
-
import type Participant from '../../participant/Participant';
|
|
5
|
-
import type RemoteParticipant from '../../participant/RemoteParticipant';
|
|
6
|
-
import { DataTrackDepacketizerDropError } from '../depacketizer';
|
|
7
|
-
import type { DataTrackFrame } from '../frame';
|
|
8
|
-
import { DataTrackHandle } from '../handle';
|
|
9
|
-
import type { DataTrackInfo, DataTrackSid, RemoteDataTrackPipelineOptions } from '../types';
|
|
10
|
-
import { DataTrackSubscribeError } from './errors';
|
|
11
|
-
import type { EventSfuUpdateSubscription, EventTrackAvailable, EventTrackUnavailable } from './types';
|
|
12
|
-
export type DataTrackIncomingManagerCallbacks = {
|
|
13
|
-
/** Request sent to the SFU to update the subscription for a data track. */
|
|
14
|
-
sfuUpdateSubscription: (event: EventSfuUpdateSubscription) => void;
|
|
15
|
-
/** A track has been published by a remote participant and is available to be
|
|
16
|
-
* subscribed to. */
|
|
17
|
-
trackPublished: (event: EventTrackAvailable) => void;
|
|
18
|
-
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
19
|
-
trackUnpublished: (event: EventTrackUnavailable) => void;
|
|
20
|
-
};
|
|
21
|
-
type IncomingDataTrackManagerOptions = {
|
|
22
|
-
/** Provider to use for decrypting incoming frame payloads.
|
|
23
|
-
* If none, remote tracks using end-to-end encryption will not be available
|
|
24
|
-
* for subscription.
|
|
25
|
-
*/
|
|
26
|
-
e2eeManager?: BaseE2EEManager;
|
|
27
|
-
};
|
|
28
|
-
declare const IncomingDataTrackManager_base: new () => TypedEmitter<DataTrackIncomingManagerCallbacks>;
|
|
29
|
-
export default class IncomingDataTrackManager extends IncomingDataTrackManager_base {
|
|
30
|
-
private e2eeManager;
|
|
31
|
-
/** Mapping between track SID and descriptor. */
|
|
32
|
-
private descriptors;
|
|
33
|
-
/** Mapping between subscriber handle and track SID.
|
|
34
|
-
*
|
|
35
|
-
* This is an index that allows track descriptors to be looked up
|
|
36
|
-
* by subscriber handle in O(1) time, to make routing incoming packets
|
|
37
|
-
* (a hot code path) faster.
|
|
38
|
-
*/
|
|
39
|
-
private subscriptionHandles;
|
|
40
|
-
constructor(options?: IncomingDataTrackManagerOptions);
|
|
41
|
-
/** @internal */
|
|
42
|
-
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
43
|
-
/** @internal */
|
|
44
|
-
setPipelineOptions(sid: DataTrackSid, options: RemoteDataTrackPipelineOptions): void;
|
|
45
|
-
/** Allocates a ReadableStream which emits when a new {@link DataTrackFrame} is received from the
|
|
46
|
-
* SFU. The SFU subscription is initiated lazily when the stream is created.
|
|
47
|
-
*
|
|
48
|
-
* @returns A tuple of the ReadableStream and a Promise that resolves once the SFU subscription
|
|
49
|
-
* is fully established / the stream is ready to receive frames.
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
52
|
-
**/
|
|
53
|
-
openSubscriptionStream(sid: DataTrackSid, signal?: AbortSignal, bufferSize?: number): [
|
|
54
|
-
ReadableStream<DataTrackFrame>,
|
|
55
|
-
Promise<Throws<void, DataTrackSubscribeError>>
|
|
56
|
-
];
|
|
57
|
-
/** Client requested to subscribe to a data track.
|
|
58
|
-
*
|
|
59
|
-
* This is sent when the user calls {@link RemoteDataTrack.subscribe}.
|
|
60
|
-
*
|
|
61
|
-
* Only the first request to subscribe to a given track incurs meaningful overhead; subsequent
|
|
62
|
-
* requests simply attach an additional receiver to the broadcast channel, allowing them to consume
|
|
63
|
-
* frames from the existing subscription pipeline.
|
|
64
|
-
*/
|
|
65
|
-
subscribeRequest(sid: DataTrackSid, signal?: AbortSignal): Promise<Throws<void, DataTrackSubscribeError>>;
|
|
66
|
-
/**
|
|
67
|
-
* Get information about all currently subscribed tracks.
|
|
68
|
-
* @internal */
|
|
69
|
-
querySubscribed(): Promise<[
|
|
70
|
-
info: DataTrackInfo,
|
|
71
|
-
identity: string
|
|
72
|
-
][]>;
|
|
73
|
-
/** Client requested to unsubscribe from a data track. */
|
|
74
|
-
unSubscribeRequest(sid: DataTrackSid): void;
|
|
75
|
-
/** Detach abort-signal listeners and close all downstream stream controllers for an active
|
|
76
|
-
* subscription. Used when the subscription is being torn down by the manager (unsubscribe,
|
|
77
|
-
* unpublish, or shutdown). */
|
|
78
|
-
private closeStreamControllers;
|
|
79
|
-
/** SFU notification that track publications have changed.
|
|
80
|
-
*
|
|
81
|
-
* This event is produced from both {@link JoinResponse} and {@link ParticipantUpdate}
|
|
82
|
-
* to provide a complete view of remote participants' track publications:
|
|
83
|
-
*
|
|
84
|
-
* - From a `JoinResponse`, it captures the initial set of tracks published when a participant joins.
|
|
85
|
-
* - From a `ParticipantUpdate`, it captures subsequent changes (i.e., new tracks being
|
|
86
|
-
* published and existing tracks unpublished).
|
|
87
|
-
*/
|
|
88
|
-
receiveSfuPublicationUpdates(updates: Map<Participant['identity'], Array<DataTrackInfo>>): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* Get information about all currently remotely published tracks which could be subscribed to.
|
|
91
|
-
* @internal */
|
|
92
|
-
queryPublications(): Promise<DataTrackInfo[]>;
|
|
93
|
-
handleTrackPublished(publisherIdentity: Participant['identity'], info: DataTrackInfo): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Detects and handles SID reassignment, which occurs when the publisher
|
|
96
|
-
* republishes its tracks after a full reconnect.
|
|
97
|
-
*
|
|
98
|
-
* Returns `true` if an SID reassignment occurred, `false` otherwise.
|
|
99
|
-
*/
|
|
100
|
-
private handleSidReassigned;
|
|
101
|
-
handleTrackUnpublished(sid: DataTrackSid): void;
|
|
102
|
-
/** SFU notification that handles have been assigned for requested subscriptions. */
|
|
103
|
-
receivedSfuSubscriberHandles(
|
|
104
|
-
/** Mapping between track handles attached to incoming packets to the
|
|
105
|
-
* track SIDs they belong to. */
|
|
106
|
-
mapping: Map<DataTrackHandle, DataTrackSid>): void;
|
|
107
|
-
private registerSubscriberHandle;
|
|
108
|
-
/** Packet has been received over the transport. */
|
|
109
|
-
packetReceived(bytes: Uint8Array): Promise<Throws<void, DataTrackDepacketizerDropError>>;
|
|
110
|
-
/** Resend all subscription updates.
|
|
111
|
-
*
|
|
112
|
-
* This must be sent after a full reconnect to ensure the SFU knows which
|
|
113
|
-
* tracks are subscribed to locally.
|
|
114
|
-
*/
|
|
115
|
-
resendSubscriptionUpdates(): void;
|
|
116
|
-
/** Called when a remote participant is disconnected so that any pending data tracks can be
|
|
117
|
-
* cancelled. */
|
|
118
|
-
handleRemoteParticipantDisconnected(remoteParticipantIdentity: RemoteParticipant['identity']): void;
|
|
119
|
-
/** Resets the manager, ending any subscriptions, and getting it ready for the next room
|
|
120
|
-
* connection. */
|
|
121
|
-
reset(): void;
|
|
122
|
-
}
|
|
123
|
-
export {};
|
|
124
|
-
//# sourceMappingURL=IncomingDataTrackManager.d.ts.map
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import type TypedEmitter from 'typed-emitter';
|
|
3
|
+
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
4
|
+
import type Participant from '../../participant/Participant';
|
|
5
|
+
import type RemoteParticipant from '../../participant/RemoteParticipant';
|
|
6
|
+
import { DataTrackDepacketizerDropError } from '../depacketizer';
|
|
7
|
+
import type { DataTrackFrame } from '../frame';
|
|
8
|
+
import { DataTrackHandle } from '../handle';
|
|
9
|
+
import type { DataTrackInfo, DataTrackSid, RemoteDataTrackPipelineOptions } from '../types';
|
|
10
|
+
import { DataTrackSubscribeError } from './errors';
|
|
11
|
+
import type { EventSfuUpdateSubscription, EventTrackAvailable, EventTrackUnavailable } from './types';
|
|
12
|
+
export type DataTrackIncomingManagerCallbacks = {
|
|
13
|
+
/** Request sent to the SFU to update the subscription for a data track. */
|
|
14
|
+
sfuUpdateSubscription: (event: EventSfuUpdateSubscription) => void;
|
|
15
|
+
/** A track has been published by a remote participant and is available to be
|
|
16
|
+
* subscribed to. */
|
|
17
|
+
trackPublished: (event: EventTrackAvailable) => void;
|
|
18
|
+
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
19
|
+
trackUnpublished: (event: EventTrackUnavailable) => void;
|
|
20
|
+
};
|
|
21
|
+
type IncomingDataTrackManagerOptions = {
|
|
22
|
+
/** Provider to use for decrypting incoming frame payloads.
|
|
23
|
+
* If none, remote tracks using end-to-end encryption will not be available
|
|
24
|
+
* for subscription.
|
|
25
|
+
*/
|
|
26
|
+
e2eeManager?: BaseE2EEManager;
|
|
27
|
+
};
|
|
28
|
+
declare const IncomingDataTrackManager_base: new () => TypedEmitter<DataTrackIncomingManagerCallbacks>;
|
|
29
|
+
export default class IncomingDataTrackManager extends IncomingDataTrackManager_base {
|
|
30
|
+
private e2eeManager;
|
|
31
|
+
/** Mapping between track SID and descriptor. */
|
|
32
|
+
private descriptors;
|
|
33
|
+
/** Mapping between subscriber handle and track SID.
|
|
34
|
+
*
|
|
35
|
+
* This is an index that allows track descriptors to be looked up
|
|
36
|
+
* by subscriber handle in O(1) time, to make routing incoming packets
|
|
37
|
+
* (a hot code path) faster.
|
|
38
|
+
*/
|
|
39
|
+
private subscriptionHandles;
|
|
40
|
+
constructor(options?: IncomingDataTrackManagerOptions);
|
|
41
|
+
/** @internal */
|
|
42
|
+
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
setPipelineOptions(sid: DataTrackSid, options: RemoteDataTrackPipelineOptions): void;
|
|
45
|
+
/** Allocates a ReadableStream which emits when a new {@link DataTrackFrame} is received from the
|
|
46
|
+
* SFU. The SFU subscription is initiated lazily when the stream is created.
|
|
47
|
+
*
|
|
48
|
+
* @returns A tuple of the ReadableStream and a Promise that resolves once the SFU subscription
|
|
49
|
+
* is fully established / the stream is ready to receive frames.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
**/
|
|
53
|
+
openSubscriptionStream(sid: DataTrackSid, signal?: AbortSignal, bufferSize?: number): [
|
|
54
|
+
ReadableStream<DataTrackFrame>,
|
|
55
|
+
Promise<Throws<void, DataTrackSubscribeError>>
|
|
56
|
+
];
|
|
57
|
+
/** Client requested to subscribe to a data track.
|
|
58
|
+
*
|
|
59
|
+
* This is sent when the user calls {@link RemoteDataTrack.subscribe}.
|
|
60
|
+
*
|
|
61
|
+
* Only the first request to subscribe to a given track incurs meaningful overhead; subsequent
|
|
62
|
+
* requests simply attach an additional receiver to the broadcast channel, allowing them to consume
|
|
63
|
+
* frames from the existing subscription pipeline.
|
|
64
|
+
*/
|
|
65
|
+
subscribeRequest(sid: DataTrackSid, signal?: AbortSignal): Promise<Throws<void, DataTrackSubscribeError>>;
|
|
66
|
+
/**
|
|
67
|
+
* Get information about all currently subscribed tracks.
|
|
68
|
+
* @internal */
|
|
69
|
+
querySubscribed(): Promise<[
|
|
70
|
+
info: DataTrackInfo,
|
|
71
|
+
identity: string
|
|
72
|
+
][]>;
|
|
73
|
+
/** Client requested to unsubscribe from a data track. */
|
|
74
|
+
unSubscribeRequest(sid: DataTrackSid): void;
|
|
75
|
+
/** Detach abort-signal listeners and close all downstream stream controllers for an active
|
|
76
|
+
* subscription. Used when the subscription is being torn down by the manager (unsubscribe,
|
|
77
|
+
* unpublish, or shutdown). */
|
|
78
|
+
private closeStreamControllers;
|
|
79
|
+
/** SFU notification that track publications have changed.
|
|
80
|
+
*
|
|
81
|
+
* This event is produced from both {@link JoinResponse} and {@link ParticipantUpdate}
|
|
82
|
+
* to provide a complete view of remote participants' track publications:
|
|
83
|
+
*
|
|
84
|
+
* - From a `JoinResponse`, it captures the initial set of tracks published when a participant joins.
|
|
85
|
+
* - From a `ParticipantUpdate`, it captures subsequent changes (i.e., new tracks being
|
|
86
|
+
* published and existing tracks unpublished).
|
|
87
|
+
*/
|
|
88
|
+
receiveSfuPublicationUpdates(updates: Map<Participant['identity'], Array<DataTrackInfo>>): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Get information about all currently remotely published tracks which could be subscribed to.
|
|
91
|
+
* @internal */
|
|
92
|
+
queryPublications(): Promise<DataTrackInfo[]>;
|
|
93
|
+
handleTrackPublished(publisherIdentity: Participant['identity'], info: DataTrackInfo): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Detects and handles SID reassignment, which occurs when the publisher
|
|
96
|
+
* republishes its tracks after a full reconnect.
|
|
97
|
+
*
|
|
98
|
+
* Returns `true` if an SID reassignment occurred, `false` otherwise.
|
|
99
|
+
*/
|
|
100
|
+
private handleSidReassigned;
|
|
101
|
+
handleTrackUnpublished(sid: DataTrackSid): void;
|
|
102
|
+
/** SFU notification that handles have been assigned for requested subscriptions. */
|
|
103
|
+
receivedSfuSubscriberHandles(
|
|
104
|
+
/** Mapping between track handles attached to incoming packets to the
|
|
105
|
+
* track SIDs they belong to. */
|
|
106
|
+
mapping: Map<DataTrackHandle, DataTrackSid>): void;
|
|
107
|
+
private registerSubscriberHandle;
|
|
108
|
+
/** Packet has been received over the transport. */
|
|
109
|
+
packetReceived(bytes: Uint8Array): Promise<Throws<void, DataTrackDepacketizerDropError>>;
|
|
110
|
+
/** Resend all subscription updates.
|
|
111
|
+
*
|
|
112
|
+
* This must be sent after a full reconnect to ensure the SFU knows which
|
|
113
|
+
* tracks are subscribed to locally.
|
|
114
|
+
*/
|
|
115
|
+
resendSubscriptionUpdates(): void;
|
|
116
|
+
/** Called when a remote participant is disconnected so that any pending data tracks can be
|
|
117
|
+
* cancelled. */
|
|
118
|
+
handleRemoteParticipantDisconnected(remoteParticipantIdentity: RemoteParticipant['identity']): void;
|
|
119
|
+
/** Resets the manager, ending any subscriptions, and getting it ready for the next room
|
|
120
|
+
* connection. */
|
|
121
|
+
reset(): void;
|
|
122
|
+
}
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=IncomingDataTrackManager.d.ts.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { LivekitReasonedError } from '../../errors';
|
|
2
|
-
export declare enum DataTrackSubscribeErrorReason {
|
|
3
|
-
/** The track has been unpublished and is no longer available */
|
|
4
|
-
Unpublished = 0,
|
|
5
|
-
/** Request to subscribe to data track timed-out */
|
|
6
|
-
Timeout = 1,
|
|
7
|
-
/** Cannot subscribe to data track when disconnected */
|
|
8
|
-
Disconnected = 2,
|
|
9
|
-
/** Subscription to data track cancelled by caller */
|
|
10
|
-
Cancelled = 4
|
|
11
|
-
}
|
|
12
|
-
export declare class DataTrackSubscribeError<Reason extends DataTrackSubscribeErrorReason = DataTrackSubscribeErrorReason> extends LivekitReasonedError<Reason> {
|
|
13
|
-
readonly name = "DataTrackSubscribeError";
|
|
14
|
-
reason: Reason;
|
|
15
|
-
reasonName: string;
|
|
16
|
-
constructor(message: string, reason: Reason, options?: {
|
|
17
|
-
cause?: unknown;
|
|
18
|
-
});
|
|
19
|
-
static unpublished(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Unpublished>;
|
|
20
|
-
static timeout(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Timeout>;
|
|
21
|
-
static disconnected(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Disconnected>;
|
|
22
|
-
static cancelled(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Cancelled>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
1
|
+
import { LivekitReasonedError } from '../../errors';
|
|
2
|
+
export declare enum DataTrackSubscribeErrorReason {
|
|
3
|
+
/** The track has been unpublished and is no longer available */
|
|
4
|
+
Unpublished = 0,
|
|
5
|
+
/** Request to subscribe to data track timed-out */
|
|
6
|
+
Timeout = 1,
|
|
7
|
+
/** Cannot subscribe to data track when disconnected */
|
|
8
|
+
Disconnected = 2,
|
|
9
|
+
/** Subscription to data track cancelled by caller */
|
|
10
|
+
Cancelled = 4
|
|
11
|
+
}
|
|
12
|
+
export declare class DataTrackSubscribeError<Reason extends DataTrackSubscribeErrorReason = DataTrackSubscribeErrorReason> extends LivekitReasonedError<Reason> {
|
|
13
|
+
readonly name = "DataTrackSubscribeError";
|
|
14
|
+
reason: Reason;
|
|
15
|
+
reasonName: string;
|
|
16
|
+
constructor(message: string, reason: Reason, options?: {
|
|
17
|
+
cause?: unknown;
|
|
18
|
+
});
|
|
19
|
+
static unpublished(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Unpublished>;
|
|
20
|
+
static timeout(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Timeout>;
|
|
21
|
+
static disconnected(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Disconnected>;
|
|
22
|
+
static cancelled(): DataTrackSubscribeError<DataTrackSubscribeErrorReason.Cancelled>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
-
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
3
|
-
import { DataTrackDepacketizerDropError } from '../depacketizer';
|
|
4
|
-
import type { DataTrackFrameInternal } from '../frame';
|
|
5
|
-
import { DataTrackPacket } from '../packet';
|
|
6
|
-
import type { DataTrackInfo, RemoteDataTrackPipelineOptions } from '../types';
|
|
7
|
-
/**
|
|
8
|
-
* Options for creating a {@link IncomingDataTrackPipeline}.
|
|
9
|
-
*/
|
|
10
|
-
type Options = {
|
|
11
|
-
info: DataTrackInfo;
|
|
12
|
-
publisherIdentity: string;
|
|
13
|
-
e2eeManager: BaseE2EEManager | null;
|
|
14
|
-
pipelineOptions?: RemoteDataTrackPipelineOptions;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Pipeline for an individual data track subscription.
|
|
18
|
-
*/
|
|
19
|
-
export default class IncomingDataTrackPipeline {
|
|
20
|
-
private publisherIdentity;
|
|
21
|
-
private e2eeManager;
|
|
22
|
-
private depacketizer;
|
|
23
|
-
private options;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new pipeline with the given options.
|
|
26
|
-
*/
|
|
27
|
-
constructor(options: Options);
|
|
28
|
-
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
29
|
-
setOptions(options: RemoteDataTrackPipelineOptions): void;
|
|
30
|
-
processPacket(packet: DataTrackPacket): Promise<Throws<DataTrackFrameInternal | null, DataTrackDepacketizerDropError>>;
|
|
31
|
-
/**
|
|
32
|
-
* Depacketize the given frame, log if a drop occurs.
|
|
33
|
-
*/
|
|
34
|
-
private depacketize;
|
|
35
|
-
/**
|
|
36
|
-
* Decrypt the frame's payload if E2EE is enabled for this track.
|
|
37
|
-
*/
|
|
38
|
-
private decryptIfNeeded;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
41
|
-
//# sourceMappingURL=pipeline.d.ts.map
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
3
|
+
import { DataTrackDepacketizerDropError } from '../depacketizer';
|
|
4
|
+
import type { DataTrackFrameInternal } from '../frame';
|
|
5
|
+
import { DataTrackPacket } from '../packet';
|
|
6
|
+
import type { DataTrackInfo, RemoteDataTrackPipelineOptions } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Options for creating a {@link IncomingDataTrackPipeline}.
|
|
9
|
+
*/
|
|
10
|
+
type Options = {
|
|
11
|
+
info: DataTrackInfo;
|
|
12
|
+
publisherIdentity: string;
|
|
13
|
+
e2eeManager: BaseE2EEManager | null;
|
|
14
|
+
pipelineOptions?: RemoteDataTrackPipelineOptions;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Pipeline for an individual data track subscription.
|
|
18
|
+
*/
|
|
19
|
+
export default class IncomingDataTrackPipeline {
|
|
20
|
+
private publisherIdentity;
|
|
21
|
+
private e2eeManager;
|
|
22
|
+
private depacketizer;
|
|
23
|
+
private options;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new pipeline with the given options.
|
|
26
|
+
*/
|
|
27
|
+
constructor(options: Options);
|
|
28
|
+
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
29
|
+
setOptions(options: RemoteDataTrackPipelineOptions): void;
|
|
30
|
+
processPacket(packet: DataTrackPacket): Promise<Throws<DataTrackFrameInternal | null, DataTrackDepacketizerDropError>>;
|
|
31
|
+
/**
|
|
32
|
+
* Depacketize the given frame, log if a drop occurs.
|
|
33
|
+
*/
|
|
34
|
+
private depacketize;
|
|
35
|
+
/**
|
|
36
|
+
* Decrypt the frame's payload if E2EE is enabled for this track.
|
|
37
|
+
*/
|
|
38
|
+
private decryptIfNeeded;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type Participant from '../../participant/Participant';
|
|
2
|
-
import type RemoteDataTrack from '../RemoteDataTrack';
|
|
3
|
-
import type { DataTrackSid } from '../types';
|
|
4
|
-
/** Request sent to the SFU to update the subscription for a data track. */
|
|
5
|
-
export type EventSfuUpdateSubscription = {
|
|
6
|
-
/** Identifier of the affected track. */
|
|
7
|
-
sid: DataTrackSid;
|
|
8
|
-
/** Whether to subscribe or unsubscribe. */
|
|
9
|
-
subscribe: boolean;
|
|
10
|
-
};
|
|
11
|
-
/** A track has been published by a remote participant and is available to be subscribed to. */
|
|
12
|
-
export type EventTrackAvailable = {
|
|
13
|
-
track: RemoteDataTrack;
|
|
14
|
-
};
|
|
15
|
-
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
16
|
-
export type EventTrackUnavailable = {
|
|
17
|
-
sid: DataTrackSid;
|
|
18
|
-
publisherIdentity: Participant['identity'];
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=types.d.ts.map
|
|
1
|
+
import type Participant from '../../participant/Participant';
|
|
2
|
+
import type RemoteDataTrack from '../RemoteDataTrack';
|
|
3
|
+
import type { DataTrackSid } from '../types';
|
|
4
|
+
/** Request sent to the SFU to update the subscription for a data track. */
|
|
5
|
+
export type EventSfuUpdateSubscription = {
|
|
6
|
+
/** Identifier of the affected track. */
|
|
7
|
+
sid: DataTrackSid;
|
|
8
|
+
/** Whether to subscribe or unsubscribe. */
|
|
9
|
+
subscribe: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** A track has been published by a remote participant and is available to be subscribed to. */
|
|
12
|
+
export type EventTrackAvailable = {
|
|
13
|
+
track: RemoteDataTrack;
|
|
14
|
+
};
|
|
15
|
+
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
16
|
+
export type EventTrackUnavailable = {
|
|
17
|
+
sid: DataTrackSid;
|
|
18
|
+
publisherIdentity: Participant['identity'];
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|