livekit-client 2.17.2 → 2.18.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 +7 -5
- 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 +20 -14
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +295 -193
- 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/e2ee/E2eeManager.d.ts +2 -0
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/KeyProvider.d.ts +2 -0
- package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
- package/dist/src/e2ee/events.d.ts +1 -1
- package/dist/src/e2ee/events.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +1 -0
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +2 -2
- package/dist/src/e2ee/worker/ParticipantKeyHandler.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/room/PCTransport.d.ts +1 -4
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +3 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/StreamReader.d.ts +2 -4
- package/dist/src/room/data-stream/incoming/StreamReader.d.ts.map +1 -1
- package/dist/src/room/data-track/LocalDataTrack.d.ts +25 -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 +4 -4
- package/dist/src/room/data-track/depacketizer.d.ts.map +1 -1
- package/dist/src/room/data-track/e2ee.d.ts +12 -0
- package/dist/src/room/data-track/e2ee.d.ts.map +1 -0
- package/dist/src/room/data-track/handle.d.ts +7 -8
- package/dist/src/room/data-track/handle.d.ts.map +1 -1
- package/dist/src/room/data-track/incoming/IncomingDataTrackManager.d.ts +96 -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 +37 -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 +77 -0
- package/dist/src/room/data-track/outgoing/OutgoingDataTrackManager.d.ts.map +1 -0
- package/dist/src/room/data-track/outgoing/errors.d.ts +64 -0
- package/dist/src/room/data-track/outgoing/errors.d.ts.map +1 -0
- package/dist/src/room/data-track/outgoing/pipeline.d.ts +22 -0
- package/dist/src/room/data-track/outgoing/pipeline.d.ts.map +1 -0
- package/dist/src/room/data-track/outgoing/types.d.ts +30 -0
- package/dist/src/room/data-track/outgoing/types.d.ts.map +1 -0
- 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 +4 -4
- 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 +10 -0
- package/dist/src/room/data-track/types.d.ts.map +1 -0
- package/dist/src/room/debounce.d.ts +11 -0
- package/dist/src/room/debounce.d.ts.map +1 -0
- package/dist/src/room/events.d.ts +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +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/track/LocalAudioTrack.d.ts +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +1 -1
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/types.d.ts +0 -2
- package/dist/src/room/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +6 -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/subscribeToEvents.d.ts +15 -0
- package/dist/src/utils/subscribeToEvents.d.ts.map +1 -0
- package/dist/ts4.2/e2ee/E2eeManager.d.ts +2 -0
- package/dist/ts4.2/e2ee/KeyProvider.d.ts +2 -0
- package/dist/ts4.2/e2ee/events.d.ts +1 -1
- package/dist/ts4.2/e2ee/types.d.ts +1 -0
- package/dist/ts4.2/e2ee/worker/ParticipantKeyHandler.d.ts +2 -2
- package/dist/ts4.2/index.d.ts +2 -2
- package/dist/ts4.2/room/PCTransport.d.ts +1 -6
- package/dist/ts4.2/room/RTCEngine.d.ts +3 -1
- package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +2 -4
- package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +25 -0
- package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +46 -0
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +4 -4
- package/dist/ts4.2/room/data-track/e2ee.d.ts +12 -0
- package/dist/ts4.2/room/data-track/handle.d.ts +7 -8
- package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +99 -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 +37 -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 +77 -0
- package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +64 -0
- package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +22 -0
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +30 -0
- 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 +4 -4
- package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -0
- package/dist/ts4.2/room/data-track/types.d.ts +10 -0
- package/dist/ts4.2/room/debounce.d.ts +11 -0
- package/dist/ts4.2/room/events.d.ts +1 -1
- package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +1 -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/track/LocalAudioTrack.d.ts +1 -1
- package/dist/ts4.2/room/track/LocalTrack.d.ts +1 -1
- package/dist/ts4.2/room/types.d.ts +0 -2
- package/dist/ts4.2/room/utils.d.ts +6 -1
- package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -0
- package/dist/ts4.2/utils/subscribeToEvents.d.ts +15 -0
- package/package.json +7 -6
- package/src/e2ee/E2eeManager.ts +9 -5
- package/src/e2ee/KeyProvider.ts +10 -1
- package/src/e2ee/events.ts +1 -1
- package/src/e2ee/types.ts +1 -0
- package/src/e2ee/worker/ParticipantKeyHandler.ts +7 -4
- package/src/e2ee/worker/e2ee.worker.ts +20 -10
- package/src/index.ts +2 -2
- package/src/room/PCTransport.ts +1 -1
- package/src/room/RTCEngine.ts +8 -1
- package/src/room/Room.ts +13 -7
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +5 -25
- package/src/room/data-stream/incoming/StreamReader.ts +56 -73
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +2 -2
- package/src/room/data-track/LocalDataTrack.ts +53 -0
- package/src/room/data-track/RemoteDataTrack.ts +82 -0
- package/src/room/data-track/depacketizer.test.ts +1 -1
- package/src/room/data-track/depacketizer.ts +5 -17
- package/src/room/data-track/e2ee.ts +15 -0
- package/src/room/data-track/frame.ts +1 -1
- package/src/room/data-track/handle.test.ts +1 -1
- package/src/room/data-track/handle.ts +10 -21
- package/src/room/data-track/incoming/IncomingDataTrackManager.test.ts +570 -0
- package/src/room/data-track/incoming/IncomingDataTrackManager.ts +537 -0
- package/src/room/data-track/incoming/errors.ts +57 -0
- package/src/room/data-track/incoming/pipeline.ts +116 -0
- package/src/room/data-track/incoming/types.ts +22 -0
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.test.ts +412 -0
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.ts +308 -0
- package/src/room/data-track/outgoing/errors.ts +157 -0
- package/src/room/data-track/outgoing/pipeline.ts +72 -0
- package/src/room/data-track/outgoing/types.ts +36 -0
- package/src/room/data-track/packet/errors.ts +2 -14
- package/src/room/data-track/packet/extensions.ts +4 -4
- package/src/room/data-track/packet/index.ts +6 -8
- package/src/room/data-track/packet/serializable.ts +4 -4
- package/src/room/data-track/packetizer.test.ts +3 -3
- package/src/room/data-track/packetizer.ts +9 -8
- package/src/room/data-track/track-interfaces.ts +53 -0
- package/src/room/data-track/types.ts +11 -0
- package/src/room/debounce.ts +115 -0
- package/src/room/events.ts +1 -1
- package/src/room/participant/LocalParticipant.ts +2 -0
- package/src/room/participant/RemoteParticipant.ts +1 -1
- package/src/room/token-source/TokenSource.ts +8 -2
- package/src/room/token-source/types.ts +4 -0
- package/src/room/track/LocalAudioTrack.ts +6 -3
- package/src/room/track/LocalTrack.ts +10 -5
- package/src/room/track/LocalVideoTrack.ts +1 -1
- package/src/room/track/RemoteVideoTrack.ts +1 -1
- package/src/room/types.ts +0 -2
- package/src/room/utils.ts +7 -2
- package/src/utils/abort-signal-polyfill.ts +63 -0
- package/src/utils/subscribeToEvents.ts +80 -0
- package/dist/src/utils/throws.d.ts +0 -36
- package/dist/src/utils/throws.d.ts.map +0 -1
- package/dist/ts4.2/utils/throws.d.ts +0 -39
- package/src/utils/throws.ts +0 -42
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
2
|
import { LivekitReasonedError } from '../errors';
|
|
3
3
|
export declare enum DataTrackHandleErrorReason {
|
|
4
4
|
Reserved = 0,
|
|
@@ -13,15 +13,14 @@ export declare class DataTrackHandleError<Reason extends DataTrackHandleErrorRea
|
|
|
13
13
|
static tooLarge(): DataTrackHandleError<DataTrackHandleErrorReason.TooLarge>;
|
|
14
14
|
static reserved(value: number): DataTrackHandleError<DataTrackHandleErrorReason.Reserved>;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
16
|
+
export type DataTrackHandle = number;
|
|
17
|
+
export declare const DataTrackHandle: {
|
|
18
|
+
fromNumber(raw: number): Throws<DataTrackHandle, DataTrackHandleError>;
|
|
19
|
+
};
|
|
21
20
|
/** Manage allocating new handles which don't conflict over the lifetime of the client. */
|
|
22
21
|
export declare class DataTrackHandleAllocator {
|
|
23
|
-
|
|
22
|
+
value: number;
|
|
24
23
|
/** Returns a unique track handle for the next publication, if one can be obtained. */
|
|
25
|
-
|
|
24
|
+
get(): DataTrackHandle | null;
|
|
26
25
|
}
|
|
27
26
|
//# sourceMappingURL=handle.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import type TypedEmitter from 'typed-emitter';
|
|
3
|
+
import type Participant from '../../participant/Participant';
|
|
4
|
+
import type RemoteParticipant from '../../participant/RemoteParticipant';
|
|
5
|
+
import { DataTrackDepacketizerDropError } from '../depacketizer';
|
|
6
|
+
import type { DecryptionProvider } from '../e2ee';
|
|
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
|
+
trackAvailable: (event: EventTrackAvailable) => void;
|
|
18
|
+
/** A track has been unpublished by a remote participant and can no longer be subscribed to. */
|
|
19
|
+
trackUnavailable: (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
|
+
decryptionProvider: DecryptionProvider | null;
|
|
27
|
+
};
|
|
28
|
+
declare const IncomingDataTrackManager_base: new () => TypedEmitter<DataTrackIncomingManagerCallbacks>;
|
|
29
|
+
export default class IncomingDataTrackManager extends IncomingDataTrackManager_base {
|
|
30
|
+
private decryptionProvider;
|
|
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
|
+
/** Client requested to subscribe to a data track.
|
|
42
|
+
*
|
|
43
|
+
* This is sent when the user calls {@link RemoteDataTrack.subscribe}.
|
|
44
|
+
*
|
|
45
|
+
* Only the first request to subscribe to a given track incurs meaningful overhead; subsequent
|
|
46
|
+
* requests simply attach an additional receiver to the broadcast channel, allowing them to consume
|
|
47
|
+
* frames from the existing subscription pipeline.
|
|
48
|
+
*/
|
|
49
|
+
subscribeRequest(sid: DataTrackSid, signal?: AbortSignal, highWaterMark?: number): Promise<Throws<ReadableStream<DataTrackFrame>, DataTrackSubscribeError>>;
|
|
50
|
+
/** Allocates a ReadableStream which emits when a new {@link DataTrackFrame} is received from the
|
|
51
|
+
* SFU. */
|
|
52
|
+
private createReadableStream;
|
|
53
|
+
/**
|
|
54
|
+
* Get information about all currently subscribed tracks.
|
|
55
|
+
* @internal */
|
|
56
|
+
querySubscribed(): Promise<[
|
|
57
|
+
info: DataTrackInfo,
|
|
58
|
+
identity: string
|
|
59
|
+
][]>;
|
|
60
|
+
/** Client requested to unsubscribe from a data track. */
|
|
61
|
+
unSubscribeRequest(sid: DataTrackSid): void;
|
|
62
|
+
/** SFU notification that track publications have changed.
|
|
63
|
+
*
|
|
64
|
+
* This event is produced from both {@link JoinResponse} and {@link ParticipantUpdate}
|
|
65
|
+
* to provide a complete view of remote participants' track publications:
|
|
66
|
+
*
|
|
67
|
+
* - From a `JoinResponse`, it captures the initial set of tracks published when a participant joins.
|
|
68
|
+
* - From a `ParticipantUpdate`, it captures subsequent changes (i.e., new tracks being
|
|
69
|
+
* published and existing tracks unpublished).
|
|
70
|
+
*/
|
|
71
|
+
receiveSfuPublicationUpdates(updates: Map<Participant['identity'], Array<DataTrackInfo>>): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Get information about all currently remotely published tracks which could be subscribed to.
|
|
74
|
+
* @internal */
|
|
75
|
+
queryPublications(): Promise<DataTrackInfo[]>;
|
|
76
|
+
handleTrackPublished(publisherIdentity: Participant['identity'], info: DataTrackInfo): Promise<void>;
|
|
77
|
+
handleTrackUnpublished(sid: DataTrackSid): void;
|
|
78
|
+
/** SFU notification that handles have been assigned for requested subscriptions. */
|
|
79
|
+
receivedSfuSubscriberHandles(
|
|
80
|
+
/** Mapping between track handles attached to incoming packets to the
|
|
81
|
+
* track SIDs they belong to. */
|
|
82
|
+
mapping: Map<DataTrackHandle, DataTrackSid>): void;
|
|
83
|
+
private registerSubscriberHandle;
|
|
84
|
+
/** Packet has been received over the transport. */
|
|
85
|
+
packetReceived(bytes: Uint8Array): Throws<void, DataTrackDepacketizerDropError>;
|
|
86
|
+
/** Resend all subscription updates.
|
|
87
|
+
*
|
|
88
|
+
* This must be sent after a full reconnect to ensure the SFU knows which
|
|
89
|
+
* tracks are subscribed to locally.
|
|
90
|
+
*/
|
|
91
|
+
resendSubscriptionUpdates(): void;
|
|
92
|
+
/** Called when a remote participant is disconnected so that any pending data tracks can be
|
|
93
|
+
* cancelled. */
|
|
94
|
+
handleRemoteParticipantDisconnected(remoteParticipantIdentity: RemoteParticipant['identity']): void;
|
|
95
|
+
/** Shutdown the manager, ending any subscriptions. */
|
|
96
|
+
shutdown(): void;
|
|
97
|
+
}
|
|
98
|
+
export {};
|
|
99
|
+
//# 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,37 @@
|
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import { DataTrackDepacketizerDropError } from '../depacketizer';
|
|
3
|
+
import type { DecryptionProvider } from '../e2ee';
|
|
4
|
+
import type { DataTrackFrame } 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
|
+
decryptionProvider: DecryptionProvider | null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Pipeline for an individual data track subscription.
|
|
17
|
+
*/
|
|
18
|
+
export default class IncomingDataTrackPipeline {
|
|
19
|
+
private publisherIdentity;
|
|
20
|
+
private e2eeProvider;
|
|
21
|
+
private depacketizer;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new pipeline with the given options.
|
|
24
|
+
*/
|
|
25
|
+
constructor(options: Options);
|
|
26
|
+
processPacket(packet: DataTrackPacket): Throws<DataTrackFrame | null, DataTrackDepacketizerDropError>;
|
|
27
|
+
/**
|
|
28
|
+
* Depacketize the given frame, log if a drop occurs.
|
|
29
|
+
*/
|
|
30
|
+
private depacketize;
|
|
31
|
+
/**
|
|
32
|
+
* Decrypt the frame's payload if E2EE is enabled for this track.
|
|
33
|
+
*/
|
|
34
|
+
private decryptIfNeeded;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# 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
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import type TypedEmitter from 'typed-emitter';
|
|
3
|
+
import { Future } from '../../utils';
|
|
4
|
+
import LocalDataTrack from '../LocalDataTrack';
|
|
5
|
+
import type { EncryptionProvider } from '../e2ee';
|
|
6
|
+
import { DataTrackHandle } from '../handle';
|
|
7
|
+
import type { DataTrackInfo } from '../types';
|
|
8
|
+
import { DataTrackPublishError, DataTrackPublishErrorReason, DataTrackPushFrameError, DataTrackPushFrameErrorReason } from './errors';
|
|
9
|
+
import DataTrackOutgoingPipeline from './pipeline';
|
|
10
|
+
import type { DataTrackOptions, EventPacketsAvailable, EventSfuPublishRequest, EventSfuUnpublishRequest, SfuPublishResponseResult } from './types';
|
|
11
|
+
export type PendingDescriptor = {
|
|
12
|
+
type: 'pending';
|
|
13
|
+
completionFuture: Future<LocalDataTrack, DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.Timeout> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached> | DataTrackPublishError<DataTrackPublishErrorReason.Disconnected> | DataTrackPublishError<DataTrackPublishErrorReason.Cancelled>>;
|
|
14
|
+
};
|
|
15
|
+
export type ActiveDescriptor = {
|
|
16
|
+
type: 'active';
|
|
17
|
+
info: DataTrackInfo;
|
|
18
|
+
pipeline: DataTrackOutgoingPipeline;
|
|
19
|
+
/** Resolves when the descriptor is unpublished. */
|
|
20
|
+
unpublishingFuture: Future<void, never>;
|
|
21
|
+
};
|
|
22
|
+
export type Descriptor = PendingDescriptor | ActiveDescriptor;
|
|
23
|
+
export declare const Descriptor: {
|
|
24
|
+
pending(): PendingDescriptor;
|
|
25
|
+
active(info: DataTrackInfo, encryptionProvider: EncryptionProvider | null): ActiveDescriptor;
|
|
26
|
+
};
|
|
27
|
+
export type DataTrackOutgoingManagerCallbacks = {
|
|
28
|
+
/** Request sent to the SFU to publish a track. */
|
|
29
|
+
sfuPublishRequest: (event: EventSfuPublishRequest) => void;
|
|
30
|
+
/** Request sent to the SFU to unpublish a track. */
|
|
31
|
+
sfuUnpublishRequest: (event: EventSfuUnpublishRequest) => void;
|
|
32
|
+
/** Serialized packets are ready to be sent over the transport. */
|
|
33
|
+
packetsAvailable: (event: EventPacketsAvailable) => void;
|
|
34
|
+
};
|
|
35
|
+
type OutgoingDataTrackManagerOptions = {
|
|
36
|
+
/**
|
|
37
|
+
* Provider to use for encrypting outgoing frame payloads.
|
|
38
|
+
*
|
|
39
|
+
* If none, end-to-end encryption will be disabled for all published tracks.
|
|
40
|
+
*/
|
|
41
|
+
encryptionProvider?: EncryptionProvider;
|
|
42
|
+
};
|
|
43
|
+
declare const OutgoingDataTrackManager_base: new () => TypedEmitter<DataTrackOutgoingManagerCallbacks>;
|
|
44
|
+
export default class OutgoingDataTrackManager extends OutgoingDataTrackManager_base {
|
|
45
|
+
private encryptionProvider;
|
|
46
|
+
private handleAllocator;
|
|
47
|
+
private descriptors;
|
|
48
|
+
constructor(options?: OutgoingDataTrackManagerOptions);
|
|
49
|
+
static withDescriptors(descriptors: Map<DataTrackHandle, Descriptor>): OutgoingDataTrackManager;
|
|
50
|
+
/**
|
|
51
|
+
* Used by attached {@link LocalDataTrack} instances to query their associated descriptor info.
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
getDescriptor(handle: DataTrackHandle): Descriptor | null;
|
|
55
|
+
createLocalDataTrack(handle: DataTrackHandle): LocalDataTrack | null;
|
|
56
|
+
/** Used by attached {@link LocalDataTrack} instances to broadcast data track packets to other
|
|
57
|
+
* subscribers.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
tryProcessAndSend(handle: DataTrackHandle, payload: Uint8Array): Throws<void, DataTrackPushFrameError<DataTrackPushFrameErrorReason.Dropped> | DataTrackPushFrameError<DataTrackPushFrameErrorReason.TrackUnpublished>>;
|
|
61
|
+
/** Client requested to publish a track. */
|
|
62
|
+
publishRequest(options: DataTrackOptions, signal?: AbortSignal): Promise<LocalDataTrack & {
|
|
63
|
+
readonly __throws?: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.Timeout> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached> | DataTrackPublishError<DataTrackPublishErrorReason.Disconnected> | DataTrackPublishError<DataTrackPublishErrorReason.Cancelled> | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
/** Get information about all currently published tracks. */
|
|
66
|
+
queryPublished(): Promise<DataTrackInfo[]>;
|
|
67
|
+
/** Client request to unpublish a track. */
|
|
68
|
+
unpublishRequest(handle: DataTrackHandle): Promise<void>;
|
|
69
|
+
/** SFU responded to a request to publish a data track. */
|
|
70
|
+
receivedSfuPublishResponse(handle: DataTrackHandle, result: SfuPublishResponseResult): void;
|
|
71
|
+
/** SFU notification that a track has been unpublished. */
|
|
72
|
+
receivedSfuUnpublishResponse(handle: DataTrackHandle): void;
|
|
73
|
+
/** Shuts down the manager and all associated tracks. */
|
|
74
|
+
shutdown(): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=OutgoingDataTrackManager.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LivekitReasonedError } from '../../errors';
|
|
2
|
+
import { DataTrackPacketizerError } from '../packetizer';
|
|
3
|
+
export declare enum DataTrackPublishErrorReason {
|
|
4
|
+
/**
|
|
5
|
+
* Local participant does not have permission to publish data tracks.
|
|
6
|
+
*
|
|
7
|
+
* Ensure the participant's token contains the `canPublishData` grant.
|
|
8
|
+
*/
|
|
9
|
+
NotAllowed = 0,
|
|
10
|
+
/** A track with the same name is already published by the local participant. */
|
|
11
|
+
DuplicateName = 1,
|
|
12
|
+
/** Request to publish the track took long to complete. */
|
|
13
|
+
Timeout = 2,
|
|
14
|
+
/** No additional data tracks can be published by the local participant. */
|
|
15
|
+
LimitReached = 3,
|
|
16
|
+
/** Cannot publish data track when the room is disconnected. */
|
|
17
|
+
Disconnected = 4,
|
|
18
|
+
Cancelled = 5
|
|
19
|
+
}
|
|
20
|
+
export declare class DataTrackPublishError<Reason extends DataTrackPublishErrorReason> extends LivekitReasonedError<Reason> {
|
|
21
|
+
readonly name = "DataTrackPublishError";
|
|
22
|
+
reason: Reason;
|
|
23
|
+
reasonName: string;
|
|
24
|
+
constructor(message: string, reason: Reason, options?: {
|
|
25
|
+
cause?: unknown;
|
|
26
|
+
});
|
|
27
|
+
static notAllowed(): DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed>;
|
|
28
|
+
static duplicateName(): DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName>;
|
|
29
|
+
static timeout(): DataTrackPublishError<DataTrackPublishErrorReason.Timeout>;
|
|
30
|
+
static limitReached(): DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
31
|
+
static disconnected(): DataTrackPublishError<DataTrackPublishErrorReason.Disconnected>;
|
|
32
|
+
static cancelled(): DataTrackPublishError<DataTrackPublishErrorReason.Cancelled>;
|
|
33
|
+
}
|
|
34
|
+
export declare enum DataTrackPushFrameErrorReason {
|
|
35
|
+
/** Track is no longer published. */
|
|
36
|
+
TrackUnpublished = 0,
|
|
37
|
+
/** Frame was dropped. */
|
|
38
|
+
Dropped = 1
|
|
39
|
+
}
|
|
40
|
+
export declare class DataTrackPushFrameError<Reason extends DataTrackPushFrameErrorReason = DataTrackPushFrameErrorReason> extends LivekitReasonedError<Reason> {
|
|
41
|
+
readonly name = "DataTrackPushFrameError";
|
|
42
|
+
reason: Reason;
|
|
43
|
+
reasonName: string;
|
|
44
|
+
constructor(message: string, reason: Reason, options?: {
|
|
45
|
+
cause?: unknown;
|
|
46
|
+
});
|
|
47
|
+
static trackUnpublished(): DataTrackPushFrameError<DataTrackPushFrameErrorReason.TrackUnpublished>;
|
|
48
|
+
static dropped(cause: unknown): DataTrackPushFrameError<DataTrackPushFrameErrorReason.Dropped>;
|
|
49
|
+
}
|
|
50
|
+
export declare enum DataTrackOutgoingPipelineErrorReason {
|
|
51
|
+
Packetizer = 0,
|
|
52
|
+
Encryption = 1
|
|
53
|
+
}
|
|
54
|
+
export declare class DataTrackOutgoingPipelineError<Reason extends DataTrackOutgoingPipelineErrorReason = DataTrackOutgoingPipelineErrorReason> extends LivekitReasonedError<Reason> {
|
|
55
|
+
readonly name = "DataTrackOutgoingPipelineError";
|
|
56
|
+
reason: Reason;
|
|
57
|
+
reasonName: string;
|
|
58
|
+
constructor(message: string, reason: Reason, options?: {
|
|
59
|
+
cause?: unknown;
|
|
60
|
+
});
|
|
61
|
+
static packetizer(cause: DataTrackPacketizerError): DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Packetizer>;
|
|
62
|
+
static encryption(cause: unknown): DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
|
+
import type { EncryptionProvider } from '../e2ee';
|
|
3
|
+
import type { DataTrackFrame } from '../frame';
|
|
4
|
+
import { DataTrackPacket } from '../packet';
|
|
5
|
+
import type { DataTrackInfo } from '../types';
|
|
6
|
+
import { DataTrackOutgoingPipelineError, DataTrackOutgoingPipelineErrorReason } from './errors';
|
|
7
|
+
type Options = {
|
|
8
|
+
info: DataTrackInfo;
|
|
9
|
+
encryptionProvider: EncryptionProvider | null;
|
|
10
|
+
};
|
|
11
|
+
/** Processes outgoing frames into final packets for distribution to the SFU. */
|
|
12
|
+
export default class DataTrackOutgoingPipeline {
|
|
13
|
+
private encryptionProvider;
|
|
14
|
+
private packetizer;
|
|
15
|
+
/** Maximum transmission unit (MTU) of the transport. */
|
|
16
|
+
private static TRANSPORT_MTU_BYTES;
|
|
17
|
+
constructor(options: Options);
|
|
18
|
+
processFrame(frame: DataTrackFrame): Throws<Generator<DataTrackPacket>, DataTrackOutgoingPipelineError>;
|
|
19
|
+
encryptIfNeeded(frame: DataTrackFrame): Throws<DataTrackFrame, DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DataTrackHandle } from '../handle';
|
|
2
|
+
import type { DataTrackInfo } from '../types';
|
|
3
|
+
import type { DataTrackPublishError, DataTrackPublishErrorReason } from './errors';
|
|
4
|
+
/** Options for publishing a data track. */
|
|
5
|
+
export type DataTrackOptions = {
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
/** Encodes whether a data track publish request to the SFU has been successful or not. */
|
|
9
|
+
export type SfuPublishResponseResult = {
|
|
10
|
+
type: 'ok';
|
|
11
|
+
data: DataTrackInfo;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'error';
|
|
14
|
+
error: DataTrackPublishError<DataTrackPublishErrorReason.NotAllowed> | DataTrackPublishError<DataTrackPublishErrorReason.DuplicateName> | DataTrackPublishError<DataTrackPublishErrorReason.LimitReached>;
|
|
15
|
+
};
|
|
16
|
+
/** Request sent to the SFU to publish a track. */
|
|
17
|
+
export type EventSfuPublishRequest = {
|
|
18
|
+
handle: DataTrackHandle;
|
|
19
|
+
name: string;
|
|
20
|
+
usesE2ee: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** Request sent to the SFU to unpublish a track. */
|
|
23
|
+
export type EventSfuUnpublishRequest = {
|
|
24
|
+
handle: DataTrackHandle;
|
|
25
|
+
};
|
|
26
|
+
/** Serialized packets are ready to be sent over the transport. */
|
|
27
|
+
export type EventPacketsAvailable = {
|
|
28
|
+
bytes: Uint8Array;
|
|
29
|
+
};
|
|
30
|
+
//# 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,4 +1,4 @@
|
|
|
1
|
-
import type { Throws } from '
|
|
1
|
+
import type { Throws } from '@livekit/throws-transformer/throws';
|
|
2
2
|
import { LivekitReasonedError } from '../errors';
|
|
3
3
|
import type { DataTrackFrame } from './frame';
|
|
4
4
|
import { DataTrackHandle } from './handle';
|
|
@@ -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;
|
|
@@ -23,7 +23,7 @@ export declare enum DataTrackPacketizerReason {
|
|
|
23
23
|
}
|
|
24
24
|
/** A packetizer takes a {@link DataTrackFrame} as input and generates a series
|
|
25
25
|
* of {@link DataTrackPacket}s for transmission to other clients over webrtc. */
|
|
26
|
-
export
|
|
26
|
+
export default class DataTrackPacketizer {
|
|
27
27
|
private handle;
|
|
28
28
|
private mtuSizeBytes;
|
|
29
29
|
private sequence;
|
|
@@ -37,7 +37,7 @@ export declare class DataTrackPacketizer {
|
|
|
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: DataTrackFrame, options?: PacketizeOptions): Throws<Generator<DataTrackPacket>, DataTrackPacketizerError
|
|
40
|
+
packetize(frame: DataTrackFrame, options?: PacketizeOptions): Throws<Generator<DataTrackPacket>, DataTrackPacketizerError>;
|
|
41
41
|
}
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=packetizer.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DataTrackInfo } from './types';
|
|
2
|
+
export declare const TrackSymbol: symbol;
|
|
3
|
+
export interface ITrack {
|
|
4
|
+
readonly trackSymbol: typeof TrackSymbol;
|
|
5
|
+
}
|
|
6
|
+
/** An interface representing a track (of any type) which is local and sending data to the SFU. */
|
|
7
|
+
export interface ILocalTrack extends ITrack {
|
|
8
|
+
readonly isLocal: true;
|
|
9
|
+
isPublished(): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RemoteTrackSymbol: symbol;
|
|
12
|
+
/** An interface representing a track (of any type) which is remote and receiving data from the SFU. */
|
|
13
|
+
export interface IRemoteTrack extends ITrack {
|
|
14
|
+
readonly isLocal: false;
|
|
15
|
+
}
|
|
16
|
+
export declare const DataTrackSymbol: symbol;
|
|
17
|
+
/** An interface representing a data track, either local or remote. */
|
|
18
|
+
export interface IDataTrack extends ITrack {
|
|
19
|
+
readonly typeSymbol: typeof DataTrackSymbol;
|
|
20
|
+
readonly info: DataTrackInfo;
|
|
21
|
+
}
|
|
22
|
+
export declare function isDataTrack(subject: unknown): subject is IDataTrack;
|
|
23
|
+
//# sourceMappingURL=track-interfaces.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DataTrackHandle } from './handle';
|
|
2
|
+
export type DataTrackSid = string;
|
|
3
|
+
/** Information about a published data track. */
|
|
4
|
+
export type DataTrackInfo = {
|
|
5
|
+
sid: DataTrackSid;
|
|
6
|
+
pubHandle: DataTrackHandle;
|
|
7
|
+
name: String;
|
|
8
|
+
usesE2ee: boolean;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Options<Result> = {
|
|
2
|
+
isImmediate?: boolean;
|
|
3
|
+
maxWait?: number;
|
|
4
|
+
callback?: (data: Result) => void;
|
|
5
|
+
};
|
|
6
|
+
export interface DebouncedFunction<Args extends any[], F extends (...args: Args) => any> {
|
|
7
|
+
(this: ThisParameterType<F>, ...args: Args & Parameters<F>): Promise<ReturnType<F>>;
|
|
8
|
+
cancel: (reason?: any) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function debounce<Args extends any[], F extends (...args: Args) => any>(func: F, waitMilliseconds?: number, options?: Options<ReturnType<F>>): DebouncedFunction<Args, F>;
|
|
11
|
+
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -29,7 +29,7 @@ export declare enum RoomEvent {
|
|
|
29
29
|
Reconnected = "reconnected",
|
|
30
30
|
/**
|
|
31
31
|
* When disconnected from room. This fires when room.disconnect() is called or
|
|
32
|
-
* when an unrecoverable connection issue had
|
|
32
|
+
* when an unrecoverable connection issue had occurred.
|
|
33
33
|
*
|
|
34
34
|
* DisconnectReason can be used to determine why the participant was disconnected. Notable reasons are
|
|
35
35
|
* - DUPLICATE_IDENTITY: another client with the same identity has joined the room
|
|
@@ -17,7 +17,7 @@ export default class RemoteParticipant extends Participant {
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
static fromParticipantInfo(signalClient: SignalClient, pi: ParticipantInfo, loggerOptions: LoggerOptions): RemoteParticipant;
|
|
19
19
|
protected get logContext(): {
|
|
20
|
-
|
|
20
|
+
remoteParticipantID: string;
|
|
21
21
|
remoteParticipant: string;
|
|
22
22
|
};
|
|
23
23
|
/** @internal */
|
|
@@ -11,7 +11,7 @@ declare abstract class TokenSourceCached extends TokenSourceConfigurable {
|
|
|
11
11
|
private isSameAsCachedFetchOptions;
|
|
12
12
|
private shouldReturnCachedValueFromFetch;
|
|
13
13
|
getCachedResponseJwtPayload(): import("./types").TokenPayload | null;
|
|
14
|
-
fetch(options: TokenSourceFetchOptions): Promise<TokenSourceResponseObject>;
|
|
14
|
+
fetch(options: TokenSourceFetchOptions, force?: boolean): Promise<TokenSourceResponseObject>;
|
|
15
15
|
protected abstract update(options: TokenSourceFetchOptions): Promise<TokenSourceResponse>;
|
|
16
16
|
}
|
|
17
17
|
type LiteralOrFn = TokenSourceResponseObject | (() => TokenSourceResponseObject | Promise<TokenSourceResponseObject>);
|
|
@@ -62,6 +62,7 @@ export type TokenSourceFetchOptions = {
|
|
|
62
62
|
*/
|
|
63
63
|
export declare abstract class TokenSourceConfigurable {
|
|
64
64
|
abstract fetch(options: TokenSourceFetchOptions): Promise<TokenSourceResponseObject>;
|
|
65
|
+
abstract fetch(options: TokenSourceFetchOptions, force?: boolean): Promise<TokenSourceResponseObject>;
|
|
65
66
|
}
|
|
66
67
|
/** A TokenSource is a mechanism for fetching credentials required to connect to a LiveKit Room. */
|
|
67
68
|
export type TokenSourceBase = TokenSourceFixed | TokenSourceConfigurable;
|