livekit-client 2.17.3 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +8 -7
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +7823 -5772
- package/dist/livekit-client.esm.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 +12 -4
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/e2ee/constants.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +6 -0
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/utils.d.ts +2 -1
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/DataCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/index.d.ts +5 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +5 -0
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts +1 -1
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +27 -9
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +13 -3
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/data-track/LocalDataTrack.d.ts +48 -0
- package/dist/src/room/data-track/LocalDataTrack.d.ts.map +1 -0
- package/dist/src/room/data-track/RemoteDataTrack.d.ts +46 -0
- package/dist/src/room/data-track/RemoteDataTrack.d.ts.map +1 -0
- package/dist/src/room/data-track/depacketizer.d.ts +6 -6
- package/dist/src/room/data-track/depacketizer.d.ts.map +1 -1
- package/dist/src/room/data-track/frame.d.ts +14 -0
- package/dist/src/room/data-track/frame.d.ts.map +1 -1
- package/dist/src/room/data-track/handle.d.ts +2 -2
- package/dist/src/room/data-track/handle.d.ts.map +1 -1
- package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts +104 -0
- package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts.map +1 -0
- package/dist/src/room/data-track/incoming/errors.d.ts +24 -0
- package/dist/src/room/data-track/incoming/errors.d.ts.map +1 -0
- package/dist/src/room/data-track/incoming/pipeline.d.ts +38 -0
- package/dist/src/room/data-track/incoming/pipeline.d.ts.map +1 -0
- package/dist/src/room/data-track/incoming/types.d.ts +20 -0
- package/dist/src/room/data-track/incoming/types.d.ts.map +1 -0
- package/dist/src/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +63 -28
- package/dist/src/room/data-track/outgoing/OutgoingDataTrackManager.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/errors.d.ts +20 -10
- package/dist/src/room/data-track/outgoing/errors.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/pipeline.d.ts +9 -8
- package/dist/src/room/data-track/outgoing/pipeline.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/types.d.ts +16 -7
- package/dist/src/room/data-track/outgoing/types.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/errors.d.ts +2 -4
- package/dist/src/room/data-track/packet/errors.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/extensions.d.ts +4 -4
- package/dist/src/room/data-track/packet/extensions.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/index.d.ts +5 -5
- package/dist/src/room/data-track/packet/index.d.ts.map +1 -1
- package/dist/src/room/data-track/packet/serializable.d.ts +4 -4
- package/dist/src/room/data-track/packet/serializable.d.ts.map +1 -1
- package/dist/src/room/data-track/packetizer.d.ts +6 -6
- package/dist/src/room/data-track/packetizer.d.ts.map +1 -1
- package/dist/src/room/data-track/track-interfaces.d.ts +23 -0
- package/dist/src/room/data-track/track-interfaces.d.ts.map +1 -0
- package/dist/src/room/data-track/types.d.ts +15 -0
- package/dist/src/room/data-track/types.d.ts.map +1 -0
- package/dist/src/room/events.d.ts +24 -3
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +11 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +14 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/token-source/TokenSource.d.ts +1 -1
- package/dist/src/room/token-source/TokenSource.d.ts.map +1 -1
- package/dist/src/room/token-source/types.d.ts +1 -0
- package/dist/src/room/token-source/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +2 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/utils/abort-signal-polyfill.d.ts +13 -0
- package/dist/src/utils/abort-signal-polyfill.d.ts.map +1 -0
- package/dist/src/utils/deferrable-map.d.ts +32 -0
- package/dist/src/utils/deferrable-map.d.ts.map +1 -0
- package/dist/src/utils/subscribeToEvents.d.ts +3 -0
- package/dist/src/utils/subscribeToEvents.d.ts.map +1 -1
- package/dist/ts4.2/api/SignalClient.d.ts +12 -4
- package/dist/ts4.2/e2ee/types.d.ts +6 -0
- package/dist/ts4.2/e2ee/utils.d.ts +2 -1
- package/dist/ts4.2/index.d.ts +5 -4
- package/dist/ts4.2/room/PCTransport.d.ts +5 -0
- package/dist/ts4.2/room/PCTransportManager.d.ts +1 -1
- package/dist/ts4.2/room/RTCEngine.d.ts +27 -9
- package/dist/ts4.2/room/Room.d.ts +13 -3
- package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +48 -0
- package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +46 -0
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +6 -6
- package/dist/ts4.2/room/data-track/frame.d.ts +14 -0
- package/dist/ts4.2/room/data-track/handle.d.ts +2 -2
- package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +110 -0
- package/dist/ts4.2/room/data-track/incoming/errors.d.ts +24 -0
- package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +38 -0
- package/dist/ts4.2/room/data-track/incoming/types.d.ts +20 -0
- package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +63 -29
- package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +20 -10
- package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +9 -8
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +16 -7
- package/dist/ts4.2/room/data-track/packet/errors.d.ts +2 -4
- package/dist/ts4.2/room/data-track/packet/extensions.d.ts +4 -4
- package/dist/ts4.2/room/data-track/packet/index.d.ts +5 -6
- package/dist/ts4.2/room/data-track/packet/serializable.d.ts +4 -4
- package/dist/ts4.2/room/data-track/packetizer.d.ts +6 -6
- package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -0
- package/dist/ts4.2/room/data-track/types.d.ts +15 -0
- package/dist/ts4.2/room/events.d.ts +24 -3
- package/dist/ts4.2/room/participant/LocalParticipant.d.ts +11 -1
- package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +14 -1
- package/dist/ts4.2/room/token-source/TokenSource.d.ts +1 -1
- package/dist/ts4.2/room/token-source/types.d.ts +1 -0
- package/dist/ts4.2/room/utils.d.ts +2 -1
- package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -0
- package/dist/ts4.2/utils/deferrable-map.d.ts +32 -0
- package/dist/ts4.2/utils/subscribeToEvents.d.ts +3 -0
- package/package.json +4 -2
- package/src/api/SignalClient.test.ts +9 -4
- package/src/api/SignalClient.ts +116 -9
- package/src/e2ee/constants.ts +1 -0
- package/src/e2ee/types.ts +6 -0
- package/src/e2ee/utils.ts +4 -3
- package/src/e2ee/worker/DataCryptor.ts +1 -4
- package/src/e2ee/worker/FrameCryptor.ts +1 -4
- package/src/e2ee/worker/ParticipantKeyHandler.ts +1 -1
- package/src/index.ts +6 -4
- package/src/room/PCTransport.ts +41 -1
- package/src/room/PCTransportManager.ts +1 -1
- package/src/room/RTCEngine.ts +274 -112
- package/src/room/Room.ts +152 -15
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +9 -9
- package/src/room/data-track/LocalDataTrack.ts +126 -0
- package/src/room/data-track/RemoteDataTrack.ts +80 -0
- package/src/room/data-track/depacketizer.ts +23 -26
- package/src/room/data-track/frame.ts +28 -2
- package/src/room/data-track/handle.ts +2 -8
- package/src/room/data-track/incoming/IncomingDataTrackManager.test.ts +555 -0
- package/src/room/data-track/incoming/IncomingDataTrackManager.ts +589 -0
- package/src/room/data-track/incoming/errors.ts +57 -0
- package/src/room/data-track/incoming/pipeline.ts +121 -0
- package/src/room/data-track/incoming/types.ts +22 -0
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.test.ts +240 -27
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.ts +165 -84
- package/src/room/data-track/outgoing/errors.ts +40 -11
- package/src/room/data-track/outgoing/pipeline.ts +25 -23
- package/src/room/data-track/outgoing/types.ts +14 -6
- package/src/room/data-track/packet/errors.ts +2 -14
- package/src/room/data-track/packet/extensions.ts +21 -26
- package/src/room/data-track/packet/index.test.ts +22 -33
- package/src/room/data-track/packet/index.ts +4 -6
- package/src/room/data-track/packet/serializable.ts +4 -4
- package/src/room/data-track/packetizer.test.ts +2 -2
- package/src/room/data-track/packetizer.ts +7 -10
- package/src/room/data-track/track-interfaces.ts +53 -0
- package/src/room/data-track/types.ts +31 -0
- package/src/room/events.ts +26 -1
- package/src/room/participant/LocalParticipant.ts +57 -6
- package/src/room/participant/RemoteParticipant.ts +26 -1
- package/src/room/token-source/TokenSource.ts +8 -2
- package/src/room/token-source/types.ts +4 -0
- package/src/room/utils.ts +5 -1
- package/src/utils/abort-signal-polyfill.ts +63 -0
- package/src/utils/deferrable-map.ts +109 -0
- package/src/utils/subscribeToEvents.ts +18 -1
- package/dist/src/room/data-track/e2ee.d.ts +0 -12
- package/dist/src/room/data-track/e2ee.d.ts.map +0 -1
- package/dist/src/room/data-track/track.d.ts +0 -30
- package/dist/src/room/data-track/track.d.ts.map +0 -1
- package/dist/src/utils/throws.d.ts +0 -36
- package/dist/src/utils/throws.d.ts.map +0 -1
- package/dist/ts4.2/room/data-track/e2ee.d.ts +0 -12
- package/dist/ts4.2/room/data-track/track.d.ts +0 -30
- package/dist/ts4.2/utils/throws.d.ts +0 -39
- package/src/room/data-track/e2ee.ts +0 -14
- package/src/room/data-track/track.ts +0 -50
- package/src/utils/throws.ts +0 -42
|
@@ -0,0 +1,110 @@
|
|
|
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 } 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
|
+
/** Allocates a ReadableStream which emits when a new {@link DataTrackFrame} is received from the
|
|
44
|
+
* SFU. The SFU subscription is initiated lazily when the stream is created.
|
|
45
|
+
*
|
|
46
|
+
* @returns A tuple of the ReadableStream and a Promise that resolves once the SFU subscription
|
|
47
|
+
* is fully established / the stream is ready to receive frames.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
**/
|
|
51
|
+
openSubscriptionStream(sid: DataTrackSid, signal?: AbortSignal, bufferSize?: number): [
|
|
52
|
+
ReadableStream<DataTrackFrame>,
|
|
53
|
+
Promise<Throws<void, DataTrackSubscribeError>>
|
|
54
|
+
];
|
|
55
|
+
/** Client requested to subscribe to a data track.
|
|
56
|
+
*
|
|
57
|
+
* This is sent when the user calls {@link RemoteDataTrack.subscribe}.
|
|
58
|
+
*
|
|
59
|
+
* Only the first request to subscribe to a given track incurs meaningful overhead; subsequent
|
|
60
|
+
* requests simply attach an additional receiver to the broadcast channel, allowing them to consume
|
|
61
|
+
* frames from the existing subscription pipeline.
|
|
62
|
+
*/
|
|
63
|
+
subscribeRequest(sid: DataTrackSid, signal?: AbortSignal): Promise<Throws<void, DataTrackSubscribeError>>;
|
|
64
|
+
/**
|
|
65
|
+
* Get information about all currently subscribed tracks.
|
|
66
|
+
* @internal */
|
|
67
|
+
querySubscribed(): Promise<[
|
|
68
|
+
info: DataTrackInfo,
|
|
69
|
+
identity: string
|
|
70
|
+
][]>;
|
|
71
|
+
/** Client requested to unsubscribe from a data track. */
|
|
72
|
+
unSubscribeRequest(sid: DataTrackSid): void;
|
|
73
|
+
/** SFU notification that track publications have changed.
|
|
74
|
+
*
|
|
75
|
+
* This event is produced from both {@link JoinResponse} and {@link ParticipantUpdate}
|
|
76
|
+
* to provide a complete view of remote participants' track publications:
|
|
77
|
+
*
|
|
78
|
+
* - From a `JoinResponse`, it captures the initial set of tracks published when a participant joins.
|
|
79
|
+
* - From a `ParticipantUpdate`, it captures subsequent changes (i.e., new tracks being
|
|
80
|
+
* published and existing tracks unpublished).
|
|
81
|
+
*/
|
|
82
|
+
receiveSfuPublicationUpdates(updates: Map<Participant['identity'], Array<DataTrackInfo>>): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Get information about all currently remotely published tracks which could be subscribed to.
|
|
85
|
+
* @internal */
|
|
86
|
+
queryPublications(): Promise<DataTrackInfo[]>;
|
|
87
|
+
handleTrackPublished(publisherIdentity: Participant['identity'], info: DataTrackInfo): Promise<void>;
|
|
88
|
+
handleTrackUnpublished(sid: DataTrackSid): void;
|
|
89
|
+
/** SFU notification that handles have been assigned for requested subscriptions. */
|
|
90
|
+
receivedSfuSubscriberHandles(
|
|
91
|
+
/** Mapping between track handles attached to incoming packets to the
|
|
92
|
+
* track SIDs they belong to. */
|
|
93
|
+
mapping: Map<DataTrackHandle, DataTrackSid>): void;
|
|
94
|
+
private registerSubscriberHandle;
|
|
95
|
+
/** Packet has been received over the transport. */
|
|
96
|
+
packetReceived(bytes: Uint8Array): Promise<Throws<void, DataTrackDepacketizerDropError>>;
|
|
97
|
+
/** Resend all subscription updates.
|
|
98
|
+
*
|
|
99
|
+
* This must be sent after a full reconnect to ensure the SFU knows which
|
|
100
|
+
* tracks are subscribed to locally.
|
|
101
|
+
*/
|
|
102
|
+
resendSubscriptionUpdates(): void;
|
|
103
|
+
/** Called when a remote participant is disconnected so that any pending data tracks can be
|
|
104
|
+
* cancelled. */
|
|
105
|
+
handleRemoteParticipantDisconnected(remoteParticipantIdentity: RemoteParticipant['identity']): void;
|
|
106
|
+
/** Shutdown the manager, ending any subscriptions. */
|
|
107
|
+
shutdown(): void;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=IncomingDataTrackManager.d.ts.map
|
|
@@ -0,0 +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
|
|
@@ -0,0 +1,38 @@
|
|
|
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 } 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
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Pipeline for an individual data track subscription.
|
|
17
|
+
*/
|
|
18
|
+
export default class IncomingDataTrackPipeline {
|
|
19
|
+
private publisherIdentity;
|
|
20
|
+
private e2eeManager;
|
|
21
|
+
private depacketizer;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new pipeline with the given options.
|
|
24
|
+
*/
|
|
25
|
+
constructor(options: Options);
|
|
26
|
+
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
27
|
+
processPacket(packet: DataTrackPacket): Promise<Throws<DataTrackFrameInternal | null, DataTrackDepacketizerDropError>>;
|
|
28
|
+
/**
|
|
29
|
+
* Depacketize the given frame, log if a drop occurs.
|
|
30
|
+
*/
|
|
31
|
+
private depacketize;
|
|
32
|
+
/**
|
|
33
|
+
* Decrypt the frame's payload if E2EE is enabled for this track.
|
|
34
|
+
*/
|
|
35
|
+
private decryptIfNeeded;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +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,20 +1,22 @@
|
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
1
2
|
import type TypedEmitter from 'typed-emitter';
|
|
2
|
-
import type {
|
|
3
|
+
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
3
4
|
import { Future } from '../../utils';
|
|
4
|
-
import type {
|
|
5
|
+
import type { DataTrackFrameInternal } from '../frame';
|
|
5
6
|
import { DataTrackHandle } from '../handle';
|
|
6
|
-
import type { DataTrackInfo } from '../
|
|
7
|
-
import {
|
|
8
|
-
import { DataTrackPublishError, DataTrackPublishErrorReason, DataTrackPushFrameError, DataTrackPushFrameErrorReason } from './errors';
|
|
7
|
+
import type { DataTrackInfo } from '../types';
|
|
8
|
+
import { DataTrackPublishError, DataTrackPushFrameError, DataTrackPushFrameErrorReason } from './errors';
|
|
9
9
|
import DataTrackOutgoingPipeline from './pipeline';
|
|
10
|
-
import type { DataTrackOptions,
|
|
10
|
+
import type { DataTrackOptions, EventPacketAvailable, EventSfuPublishRequest, EventSfuUnpublishRequest, EventTrackPublished, EventTrackUnpublished, SfuPublishResponseResult } from './types';
|
|
11
11
|
export type PendingDescriptor = {
|
|
12
12
|
type: 'pending';
|
|
13
|
-
|
|
13
|
+
/** Resolves when the descriptor is fully published. */
|
|
14
|
+
completionFuture: Future<void, DataTrackPublishError>;
|
|
14
15
|
};
|
|
15
16
|
export type ActiveDescriptor = {
|
|
16
17
|
type: 'active';
|
|
17
18
|
info: DataTrackInfo;
|
|
19
|
+
publishState: 'published' | 'republishing' | 'unpublished';
|
|
18
20
|
pipeline: DataTrackOutgoingPipeline;
|
|
19
21
|
/** Resolves when the descriptor is unpublished. */
|
|
20
22
|
unpublishingFuture: Future<void, never>;
|
|
@@ -22,55 +24,87 @@ export type ActiveDescriptor = {
|
|
|
22
24
|
export type Descriptor = PendingDescriptor | ActiveDescriptor;
|
|
23
25
|
export declare const Descriptor: {
|
|
24
26
|
pending(): PendingDescriptor;
|
|
25
|
-
active(info: DataTrackInfo,
|
|
27
|
+
active(info: DataTrackInfo, e2eeManager: BaseE2EEManager | null): ActiveDescriptor;
|
|
26
28
|
};
|
|
27
29
|
export type DataTrackOutgoingManagerCallbacks = {
|
|
28
30
|
/** Request sent to the SFU to publish a track. */
|
|
29
|
-
sfuPublishRequest: (event:
|
|
31
|
+
sfuPublishRequest: (event: EventSfuPublishRequest) => void;
|
|
30
32
|
/** Request sent to the SFU to unpublish a track. */
|
|
31
|
-
sfuUnpublishRequest: (event:
|
|
32
|
-
/**
|
|
33
|
-
|
|
33
|
+
sfuUnpublishRequest: (event: EventSfuUnpublishRequest) => void;
|
|
34
|
+
/** A serialized packet is ready to be sent over the transport. */
|
|
35
|
+
packetAvailable: (event: EventPacketAvailable) => void;
|
|
36
|
+
/** A new {@link LocalDataTrack} has been published */
|
|
37
|
+
trackPublished: (event: EventTrackPublished) => void;
|
|
38
|
+
/** A {@link LocalDataTrack} has been unpublished */
|
|
39
|
+
trackUnpublished: (event: EventTrackUnpublished) => void;
|
|
34
40
|
};
|
|
35
|
-
type
|
|
41
|
+
type OutgoingDataTrackManagerOptions = {
|
|
36
42
|
/**
|
|
37
43
|
* Provider to use for encrypting outgoing frame payloads.
|
|
38
44
|
*
|
|
39
|
-
* If
|
|
45
|
+
* If null, end-to-end encryption will be disabled for all published tracks.
|
|
40
46
|
*/
|
|
41
|
-
|
|
47
|
+
e2eeManager?: BaseE2EEManager;
|
|
42
48
|
};
|
|
43
49
|
declare const OutgoingDataTrackManager_base: new () => TypedEmitter<DataTrackOutgoingManagerCallbacks>;
|
|
44
50
|
export default class OutgoingDataTrackManager extends OutgoingDataTrackManager_base {
|
|
45
|
-
private
|
|
51
|
+
private e2eeManager;
|
|
46
52
|
private handleAllocator;
|
|
47
53
|
private descriptors;
|
|
48
|
-
constructor(options?:
|
|
54
|
+
constructor(options?: OutgoingDataTrackManagerOptions);
|
|
49
55
|
static withDescriptors(descriptors: Map<DataTrackHandle, Descriptor>): OutgoingDataTrackManager;
|
|
56
|
+
/** @internal */
|
|
57
|
+
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
50
58
|
/**
|
|
51
59
|
* Used by attached {@link LocalDataTrack} instances to query their associated descriptor info.
|
|
52
60
|
* @internal
|
|
53
61
|
*/
|
|
54
62
|
getDescriptor(handle: DataTrackHandle): Descriptor | null;
|
|
55
|
-
createLocalDataTrack(handle: DataTrackHandle): LocalDataTrack | null;
|
|
56
63
|
/** Used by attached {@link LocalDataTrack} instances to broadcast data track packets to other
|
|
57
64
|
* subscribers.
|
|
58
65
|
* @internal
|
|
59
66
|
*/
|
|
60
|
-
tryProcessAndSend(handle: DataTrackHandle,
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
tryProcessAndSend(handle: DataTrackHandle, frame: DataTrackFrameInternal): Promise<Throws<void, DataTrackPushFrameError<DataTrackPushFrameErrorReason.Dropped> | DataTrackPushFrameError<DataTrackPushFrameErrorReason.TrackUnpublished>>>;
|
|
68
|
+
/**
|
|
69
|
+
* Client requested to publish a track.
|
|
70
|
+
*
|
|
71
|
+
* If the LiveKit server is too old and doesn't support data tracks, a
|
|
72
|
+
* {@link DataTrackPublishError#timeout} will be thrown.
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
**/
|
|
76
|
+
publishRequest(options: DataTrackOptions, signal?: AbortSignal): Promise<Throws<DataTrackHandle, DataTrackPublishError>>;
|
|
77
|
+
/**
|
|
78
|
+
* Get information about all currently published tracks.
|
|
79
|
+
* @internal
|
|
80
|
+
**/
|
|
81
|
+
queryPublished(): DataTrackInfo[];
|
|
82
|
+
/**
|
|
83
|
+
* Client request to unpublish a track.
|
|
84
|
+
* @internal
|
|
85
|
+
**/
|
|
68
86
|
unpublishRequest(handle: DataTrackHandle): Promise<void>;
|
|
69
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* SFU responded to a request to publish a data track.
|
|
89
|
+
* @internal
|
|
90
|
+
**/
|
|
70
91
|
receivedSfuPublishResponse(handle: DataTrackHandle, result: SfuPublishResponseResult): void;
|
|
71
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* SFU notification that a track has been unpublished.
|
|
94
|
+
* @internal
|
|
95
|
+
**/
|
|
72
96
|
receivedSfuUnpublishResponse(handle: DataTrackHandle): void;
|
|
73
|
-
/**
|
|
97
|
+
/** Republish all tracks.
|
|
98
|
+
*
|
|
99
|
+
* This must be sent after a full reconnect in order for existing publications
|
|
100
|
+
* to be recognized by the SFU. Each republished track will be assigned a new SID.
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
sfuWillRepublishTracks(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Shuts down the manager and all associated tracks.
|
|
106
|
+
* @internal
|
|
107
|
+
**/
|
|
74
108
|
shutdown(): Promise<void>;
|
|
75
109
|
}
|
|
76
110
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LivekitReasonedError } from '../../errors';
|
|
2
|
-
import { DataTrackPacketizerError
|
|
2
|
+
import { DataTrackPacketizerError } from '../packetizer';
|
|
3
3
|
export declare enum DataTrackPublishErrorReason {
|
|
4
4
|
/**
|
|
5
5
|
* Local participant does not have permission to publish data tracks.
|
|
@@ -15,19 +15,29 @@ export declare enum DataTrackPublishErrorReason {
|
|
|
15
15
|
LimitReached = 3,
|
|
16
16
|
/** Cannot publish data track when the room is disconnected. */
|
|
17
17
|
Disconnected = 4,
|
|
18
|
-
Cancelled = 5
|
|
18
|
+
Cancelled = 5,
|
|
19
|
+
/** The name requested is not able to be used when creating the data track. */
|
|
20
|
+
InvalidName = 6,
|
|
21
|
+
/** There was an error publishing, but it was not something that could be sorted into a known
|
|
22
|
+
* category. */
|
|
23
|
+
Unknown = 7
|
|
19
24
|
}
|
|
20
|
-
export declare class DataTrackPublishError<Reason extends DataTrackPublishErrorReason> extends LivekitReasonedError<Reason> {
|
|
25
|
+
export declare class DataTrackPublishError<Reason extends DataTrackPublishErrorReason = DataTrackPublishErrorReason> extends LivekitReasonedError<Reason> {
|
|
21
26
|
readonly name = "DataTrackPublishError";
|
|
22
27
|
reason: Reason;
|
|
23
28
|
reasonName: string;
|
|
29
|
+
/** Underling message from the SFU, if one was provided */
|
|
30
|
+
rawMessage?: string;
|
|
24
31
|
constructor(message: string, reason: Reason, options?: {
|
|
32
|
+
rawMessage?: string;
|
|
25
33
|
cause?: unknown;
|
|
26
34
|
});
|
|
27
|
-
static notAllowed(): DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed>;
|
|
28
|
-
static duplicateName(): DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName>;
|
|
35
|
+
static notAllowed(rawMessage?: string): DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed>;
|
|
36
|
+
static duplicateName(rawMessage?: string): DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName>;
|
|
37
|
+
static invalidName(rawMessage?: string): DataTrackPublishError<DataTrackPublishErrorReason.InvalidName>;
|
|
29
38
|
static timeout(): DataTrackPublishError<DataTrackPublishErrorReason.Timeout>;
|
|
30
|
-
static limitReached(): DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
39
|
+
static limitReached(rawMessage?: string): DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
40
|
+
static unknown(reason: number, message: string): DataTrackPublishError<DataTrackPublishErrorReason.Unknown>;
|
|
31
41
|
static disconnected(): DataTrackPublishError<DataTrackPublishErrorReason.Disconnected>;
|
|
32
42
|
static cancelled(): DataTrackPublishError<DataTrackPublishErrorReason.Cancelled>;
|
|
33
43
|
}
|
|
@@ -37,7 +47,7 @@ export declare enum DataTrackPushFrameErrorReason {
|
|
|
37
47
|
/** Frame was dropped. */
|
|
38
48
|
Dropped = 1
|
|
39
49
|
}
|
|
40
|
-
export declare class DataTrackPushFrameError<Reason extends DataTrackPushFrameErrorReason> extends LivekitReasonedError<Reason> {
|
|
50
|
+
export declare class DataTrackPushFrameError<Reason extends DataTrackPushFrameErrorReason = DataTrackPushFrameErrorReason> extends LivekitReasonedError<Reason> {
|
|
41
51
|
readonly name = "DataTrackPushFrameError";
|
|
42
52
|
reason: Reason;
|
|
43
53
|
reasonName: string;
|
|
@@ -45,20 +55,20 @@ export declare class DataTrackPushFrameError<Reason extends DataTrackPushFrameEr
|
|
|
45
55
|
cause?: unknown;
|
|
46
56
|
});
|
|
47
57
|
static trackUnpublished(): DataTrackPushFrameError<DataTrackPushFrameErrorReason.TrackUnpublished>;
|
|
48
|
-
static dropped(cause
|
|
58
|
+
static dropped(cause?: unknown): DataTrackPushFrameError<DataTrackPushFrameErrorReason.Dropped>;
|
|
49
59
|
}
|
|
50
60
|
export declare enum DataTrackOutgoingPipelineErrorReason {
|
|
51
61
|
Packetizer = 0,
|
|
52
62
|
Encryption = 1
|
|
53
63
|
}
|
|
54
|
-
export declare class DataTrackOutgoingPipelineError<Reason extends DataTrackOutgoingPipelineErrorReason> extends LivekitReasonedError<Reason> {
|
|
64
|
+
export declare class DataTrackOutgoingPipelineError<Reason extends DataTrackOutgoingPipelineErrorReason = DataTrackOutgoingPipelineErrorReason> extends LivekitReasonedError<Reason> {
|
|
55
65
|
readonly name = "DataTrackOutgoingPipelineError";
|
|
56
66
|
reason: Reason;
|
|
57
67
|
reasonName: string;
|
|
58
68
|
constructor(message: string, reason: Reason, options?: {
|
|
59
69
|
cause?: unknown;
|
|
60
70
|
});
|
|
61
|
-
static packetizer(cause: DataTrackPacketizerError
|
|
71
|
+
static packetizer(cause: DataTrackPacketizerError): DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Packetizer>;
|
|
62
72
|
static encryption(cause: unknown): DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>;
|
|
63
73
|
}
|
|
64
74
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import type { BaseE2EEManager } from '../../../e2ee/E2eeManager';
|
|
3
|
+
import type { DataTrackFrameInternal } from '../frame';
|
|
4
4
|
import { DataTrackPacket } from '../packet';
|
|
5
|
-
import type { DataTrackInfo } from '../
|
|
5
|
+
import type { DataTrackInfo } from '../types';
|
|
6
6
|
import { DataTrackOutgoingPipelineError, DataTrackOutgoingPipelineErrorReason } from './errors';
|
|
7
7
|
type Options = {
|
|
8
8
|
info: DataTrackInfo;
|
|
9
|
-
|
|
9
|
+
e2eeManager: BaseE2EEManager | null;
|
|
10
10
|
};
|
|
11
11
|
/** Processes outgoing frames into final packets for distribution to the SFU. */
|
|
12
12
|
export default class DataTrackOutgoingPipeline {
|
|
13
|
-
private
|
|
13
|
+
private e2eeManager;
|
|
14
14
|
private packetizer;
|
|
15
15
|
/** Maximum transmission unit (MTU) of the transport. */
|
|
16
16
|
private static TRANSPORT_MTU_BYTES;
|
|
17
17
|
constructor(options: Options);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
updateE2eeManager(e2eeManager: BaseE2EEManager | null): void;
|
|
19
|
+
processFrame(frame: DataTrackFrameInternal): Throws<AsyncGenerator<DataTrackPacket>, DataTrackOutgoingPipelineError>;
|
|
20
|
+
encryptIfNeeded(frame: DataTrackFrameInternal): Promise<Throws<DataTrackFrameInternal, DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>>>;
|
|
20
21
|
}
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type LocalDataTrack from '../LocalDataTrack';
|
|
1
2
|
import type { DataTrackHandle } from '../handle';
|
|
2
|
-
import type { DataTrackInfo } from '../
|
|
3
|
+
import type { DataTrackInfo, DataTrackSid } from '../types';
|
|
3
4
|
import type { DataTrackPublishError, DataTrackPublishErrorReason } from './errors';
|
|
4
5
|
/** Options for publishing a data track. */
|
|
5
6
|
export type DataTrackOptions = {
|
|
@@ -11,21 +12,29 @@ export type SfuPublishResponseResult = {
|
|
|
11
12
|
data: DataTrackInfo;
|
|
12
13
|
} | {
|
|
13
14
|
type: 'error';
|
|
14
|
-
error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
15
|
+
error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.InvalidName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
15
16
|
};
|
|
16
17
|
/** Request sent to the SFU to publish a track. */
|
|
17
|
-
export type
|
|
18
|
+
export type EventSfuPublishRequest = {
|
|
18
19
|
handle: DataTrackHandle;
|
|
19
20
|
name: string;
|
|
20
21
|
usesE2ee: boolean;
|
|
21
22
|
};
|
|
22
23
|
/** Request sent to the SFU to unpublish a track. */
|
|
23
|
-
export type
|
|
24
|
+
export type EventSfuUnpublishRequest = {
|
|
24
25
|
handle: DataTrackHandle;
|
|
25
26
|
};
|
|
26
|
-
/**
|
|
27
|
-
export type
|
|
27
|
+
/** A serialized packet is ready to be sent over the transport. */
|
|
28
|
+
export type EventPacketAvailable = {
|
|
28
29
|
bytes: Uint8Array;
|
|
29
|
-
|
|
30
|
+
};
|
|
31
|
+
/** A track has been created by a local participant and is available to be
|
|
32
|
+
* subscribed to. */
|
|
33
|
+
export type EventTrackPublished = {
|
|
34
|
+
track: LocalDataTrack;
|
|
35
|
+
};
|
|
36
|
+
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
37
|
+
export type EventTrackUnpublished = {
|
|
38
|
+
sid: DataTrackSid;
|
|
30
39
|
};
|
|
31
40
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -8,7 +8,7 @@ export declare enum DataTrackDeserializeErrorReason {
|
|
|
8
8
|
InvalidHandle = 4,
|
|
9
9
|
MalformedExt = 5
|
|
10
10
|
}
|
|
11
|
-
export declare class DataTrackDeserializeError<Reason extends DataTrackDeserializeErrorReason> extends LivekitReasonedError<DataTrackDeserializeErrorReason> {
|
|
11
|
+
export declare class DataTrackDeserializeError<Reason extends DataTrackDeserializeErrorReason = DataTrackDeserializeErrorReason> extends LivekitReasonedError<DataTrackDeserializeErrorReason> {
|
|
12
12
|
readonly name = "DataTrackDeserializeError";
|
|
13
13
|
reason: Reason;
|
|
14
14
|
reasonName: string;
|
|
@@ -23,12 +23,11 @@ export declare class DataTrackDeserializeError<Reason extends DataTrackDeseriali
|
|
|
23
23
|
static invalidHandle(cause: DataTrackHandleError): DataTrackDeserializeError<DataTrackDeserializeErrorReason.InvalidHandle>;
|
|
24
24
|
static malformedExt(tag: number): DataTrackDeserializeError<DataTrackDeserializeErrorReason.MalformedExt>;
|
|
25
25
|
}
|
|
26
|
-
export type DataTrackDeserializeErrorAll = DataTrackDeserializeError<DataTrackDeserializeErrorReason.TooShort> | DataTrackDeserializeError<DataTrackDeserializeErrorReason.HeaderOverrun> | DataTrackDeserializeError<DataTrackDeserializeErrorReason.MissingExtWords> | DataTrackDeserializeError<DataTrackDeserializeErrorReason.UnsupportedVersion> | DataTrackDeserializeError<DataTrackDeserializeErrorReason.InvalidHandle> | DataTrackDeserializeError<DataTrackDeserializeErrorReason.MalformedExt>;
|
|
27
26
|
export declare enum DataTrackSerializeErrorReason {
|
|
28
27
|
TooSmallForHeader = 0,
|
|
29
28
|
TooSmallForPayload = 1
|
|
30
29
|
}
|
|
31
|
-
export declare class DataTrackSerializeError<Reason extends DataTrackSerializeErrorReason> extends LivekitReasonedError<DataTrackSerializeErrorReason> {
|
|
30
|
+
export declare class DataTrackSerializeError<Reason extends DataTrackSerializeErrorReason = DataTrackSerializeErrorReason> extends LivekitReasonedError<DataTrackSerializeErrorReason> {
|
|
32
31
|
readonly name = "DataTrackSerializeError";
|
|
33
32
|
reason: Reason;
|
|
34
33
|
reasonName: string;
|
|
@@ -38,5 +37,4 @@ export declare class DataTrackSerializeError<Reason extends DataTrackSerializeEr
|
|
|
38
37
|
static tooSmallForHeader(): DataTrackSerializeError<DataTrackSerializeErrorReason.TooSmallForHeader>;
|
|
39
38
|
static tooSmallForPayload(): DataTrackSerializeError<DataTrackSerializeErrorReason.TooSmallForPayload>;
|
|
40
39
|
}
|
|
41
|
-
export type DataTrackSerializeErrorAll = DataTrackSerializeError<DataTrackSerializeErrorReason.TooSmallForHeader> | DataTrackSerializeError<DataTrackSerializeErrorReason.TooSmallForPayload>;
|
|
42
40
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
2
|
import { DataTrackDeserializeError, DataTrackDeserializeErrorReason } from './errors';
|
|
3
3
|
import Serializable from './serializable';
|
|
4
4
|
export declare enum DataTrackExtensionTag {
|
|
@@ -12,7 +12,7 @@ declare abstract class DataTrackExtension extends Serializable {
|
|
|
12
12
|
export declare class DataTrackUserTimestampExtension extends DataTrackExtension {
|
|
13
13
|
static tag: DataTrackExtensionTag;
|
|
14
14
|
static lengthBytes: number;
|
|
15
|
-
|
|
15
|
+
timestamp: bigint;
|
|
16
16
|
constructor(timestamp: bigint);
|
|
17
17
|
toBinaryLengthBytes(): number;
|
|
18
18
|
toBinaryInto(dataView: DataView): Throws<number, never>;
|
|
@@ -25,8 +25,8 @@ export declare class DataTrackUserTimestampExtension extends DataTrackExtension
|
|
|
25
25
|
export declare class DataTrackE2eeExtension extends DataTrackExtension {
|
|
26
26
|
static tag: DataTrackExtensionTag;
|
|
27
27
|
static lengthBytes: number;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
keyIndex: number;
|
|
29
|
+
iv: Uint8Array;
|
|
30
30
|
constructor(keyIndex: number, iv: Uint8Array);
|
|
31
31
|
toBinaryLengthBytes(): number;
|
|
32
32
|
toBinaryInto(dataView: DataView): Throws<number, never>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
2
|
import { DataTrackHandle } from '../handle';
|
|
3
3
|
import { DataTrackTimestamp, U16_MAX_SIZE, WrapAroundUnsignedInt } from '../utils';
|
|
4
|
-
import
|
|
5
|
-
import { DataTrackSerializeError, DataTrackSerializeErrorReason } from './errors';
|
|
4
|
+
import { DataTrackDeserializeError, DataTrackSerializeError, DataTrackSerializeErrorReason } from './errors';
|
|
6
5
|
import { DataTrackExtensions } from './extensions';
|
|
7
6
|
import Serializable from './serializable';
|
|
8
7
|
/** A class for serializing / deserializing data track packet header sections. */
|
|
@@ -27,7 +26,7 @@ export declare class DataTrackPacketHeader extends Serializable {
|
|
|
27
26
|
static fromBinary<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): Throws<[
|
|
28
27
|
header: DataTrackPacketHeader,
|
|
29
28
|
byteLength: number
|
|
30
|
-
],
|
|
29
|
+
], DataTrackDeserializeError>;
|
|
31
30
|
toJSON(): {
|
|
32
31
|
marker: FrameMarker;
|
|
33
32
|
trackHandle: number;
|
|
@@ -66,11 +65,11 @@ export declare class DataTrackPacket extends Serializable {
|
|
|
66
65
|
payload: Uint8Array;
|
|
67
66
|
constructor(header: DataTrackPacketHeader, payload: Uint8Array);
|
|
68
67
|
toBinaryLengthBytes(): number;
|
|
69
|
-
toBinaryInto(dataView: DataView): Throws<number,
|
|
68
|
+
toBinaryInto(dataView: DataView): Throws<number, DataTrackSerializeError>;
|
|
70
69
|
static fromBinary<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): Throws<[
|
|
71
70
|
packet: DataTrackPacket,
|
|
72
71
|
byteLength: number
|
|
73
|
-
],
|
|
72
|
+
], DataTrackDeserializeError>;
|
|
74
73
|
toJSON(): {
|
|
75
74
|
header: {
|
|
76
75
|
marker: FrameMarker;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
2
|
-
import
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import { DataTrackSerializeError } from './errors';
|
|
3
3
|
/** An abstract class implementing common behavior related to data track binary serialization. */
|
|
4
4
|
export default abstract class Serializable {
|
|
5
5
|
/** Returns the expected length of the serialized output in bytes */
|
|
6
6
|
abstract toBinaryLengthBytes(): number;
|
|
7
7
|
/** Given a DataView, serialize the instance inside and return the number of bytes written. */
|
|
8
|
-
abstract toBinaryInto(dataView: DataView): Throws<number,
|
|
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,
|
|
10
|
+
toBinary(): Throws<Uint8Array, DataTrackSerializeError>;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=serializable.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
2
|
import { LivekitReasonedError } from '../errors';
|
|
3
|
-
import type {
|
|
3
|
+
import type { DataTrackFrameInternal } from './frame';
|
|
4
4
|
import { DataTrackHandle } from './handle';
|
|
5
5
|
import { DataTrackPacket, FrameMarker } from './packet';
|
|
6
6
|
import { DataTrackTimestamp } from './utils';
|
|
@@ -9,7 +9,7 @@ type PacketizeOptions = {
|
|
|
9
9
|
* defaults to the return value of {@link DataTrackClock#now}. */
|
|
10
10
|
now?: DataTrackTimestamp<90000>;
|
|
11
11
|
};
|
|
12
|
-
export declare class DataTrackPacketizerError<Reason extends DataTrackPacketizerReason> extends LivekitReasonedError<Reason> {
|
|
12
|
+
export declare class DataTrackPacketizerError<Reason extends DataTrackPacketizerReason = DataTrackPacketizerReason> extends LivekitReasonedError<Reason> {
|
|
13
13
|
readonly name = "DataTrackPacketizerError";
|
|
14
14
|
reason: Reason;
|
|
15
15
|
reasonName: string;
|
|
@@ -21,7 +21,7 @@ export declare class DataTrackPacketizerError<Reason extends DataTrackPacketizer
|
|
|
21
21
|
export declare enum DataTrackPacketizerReason {
|
|
22
22
|
MtuTooShort = 0
|
|
23
23
|
}
|
|
24
|
-
/** A packetizer takes a {@link
|
|
24
|
+
/** A packetizer takes a {@link DataTrackFrameInternal} as input and generates a series
|
|
25
25
|
* of {@link DataTrackPacket}s for transmission to other clients over webrtc. */
|
|
26
26
|
export default class DataTrackPacketizer {
|
|
27
27
|
private handle;
|
|
@@ -32,12 +32,12 @@ export default class DataTrackPacketizer {
|
|
|
32
32
|
constructor(trackHandle: DataTrackHandle, mtuSizeBytes: number);
|
|
33
33
|
/** @internal */
|
|
34
34
|
static computeFrameMarker(index: number, packetCount: number): FrameMarker;
|
|
35
|
-
/** Generates a series of packets for the specified {@link
|
|
35
|
+
/** Generates a series of packets for the specified {@link DataTrackFrameInternal}.
|
|
36
36
|
*
|
|
37
37
|
* NOTE: The return value of this function is a generator, so it can be lazily ran if desired,
|
|
38
38
|
* or converted to an array with {@link Array.from}.
|
|
39
39
|
*/
|
|
40
|
-
packetize(frame:
|
|
40
|
+
packetize(frame: DataTrackFrameInternal, options?: PacketizeOptions): Throws<Generator<DataTrackPacket>, DataTrackPacketizerError>;
|
|
41
41
|
}
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=packetizer.d.ts.map
|