livekit-client 2.17.1 → 2.17.3
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 +21 -14
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +2087 -1920
- 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 +7 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +2 -1
- package/dist/src/logger.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/PCTransportManager.d.ts.map +1 -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/depacketizer.d.ts +51 -0
- package/dist/src/room/data-track/depacketizer.d.ts.map +1 -0
- 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/frame.d.ts +7 -0
- package/dist/src/room/data-track/frame.d.ts.map +1 -0
- package/dist/src/room/data-track/handle.d.ts +6 -7
- package/dist/src/room/data-track/handle.d.ts.map +1 -1
- package/dist/src/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +76 -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 +31 -0
- package/dist/src/room/data-track/outgoing/types.d.ts.map +1 -0
- package/dist/src/room/data-track/packet/index.d.ts +3 -3
- package/dist/src/room/data-track/packet/index.d.ts.map +1 -1
- package/dist/src/room/data-track/packetizer.d.ts +43 -0
- package/dist/src/room/data-track/packetizer.d.ts.map +1 -0
- package/dist/src/room/data-track/track.d.ts +30 -0
- package/dist/src/room/data-track/track.d.ts.map +1 -0
- package/dist/src/room/data-track/utils.d.ts +34 -2
- package/dist/src/room/data-track/utils.d.ts.map +1 -1
- 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/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 +2 -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/subscribeToEvents.d.ts +12 -0
- package/dist/src/utils/subscribeToEvents.d.ts.map +1 -0
- package/dist/src/utils/throws.d.ts +4 -2
- package/dist/src/utils/throws.d.ts.map +1 -1
- 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 +7 -3
- package/dist/ts4.2/logger.d.ts +2 -1
- package/dist/ts4.2/room/PCTransport.d.ts +1 -6
- package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +2 -4
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +51 -0
- package/dist/ts4.2/room/data-track/e2ee.d.ts +12 -0
- package/dist/ts4.2/room/data-track/frame.d.ts +7 -0
- package/dist/ts4.2/room/data-track/handle.d.ts +6 -7
- 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 +31 -0
- package/dist/ts4.2/room/data-track/packet/index.d.ts +3 -3
- package/dist/ts4.2/room/data-track/packetizer.d.ts +43 -0
- package/dist/ts4.2/room/data-track/track.d.ts +30 -0
- package/dist/ts4.2/room/data-track/utils.d.ts +34 -2
- 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/track/LocalAudioTrack.d.ts +1 -1
- package/dist/ts4.2/room/track/LocalTrack.d.ts +2 -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/subscribeToEvents.d.ts +12 -0
- package/dist/ts4.2/utils/throws.d.ts +4 -2
- package/package.json +4 -5
- 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 +15 -5
- package/src/logger.ts +1 -0
- package/src/room/PCTransport.ts +2 -1
- package/src/room/PCTransportManager.ts +27 -9
- package/src/room/RTCEngine.ts +13 -2
- package/src/room/Room.ts +11 -5
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +5 -25
- package/src/room/data-stream/incoming/StreamReader.ts +56 -73
- package/src/room/data-track/depacketizer.test.ts +442 -0
- package/src/room/data-track/depacketizer.ts +298 -0
- package/src/room/data-track/e2ee.ts +14 -0
- package/src/room/data-track/frame.ts +8 -0
- package/src/room/data-track/handle.test.ts +1 -1
- package/src/room/data-track/handle.ts +9 -14
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.test.ts +392 -0
- package/src/room/data-track/outgoing/OutgoingDataTrackManager.ts +302 -0
- package/src/room/data-track/outgoing/errors.ts +157 -0
- package/src/room/data-track/outgoing/pipeline.ts +76 -0
- package/src/room/data-track/outgoing/types.ts +37 -0
- package/src/room/data-track/packet/index.test.ts +9 -9
- package/src/room/data-track/packet/index.ts +11 -9
- package/src/room/data-track/packet/serializable.ts +1 -1
- package/src/room/data-track/packetizer.test.ts +131 -0
- package/src/room/data-track/packetizer.ts +132 -0
- package/src/room/data-track/track.ts +50 -0
- package/src/room/data-track/utils.test.ts +27 -1
- package/src/room/data-track/utils.ts +125 -5
- 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/track/LocalAudioTrack.ts +10 -10
- package/src/room/track/LocalTrack.ts +14 -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/subscribeToEvents.ts +63 -0
- package/src/utils/throws.ts +3 -1
|
@@ -62,14 +62,14 @@ export declare class ParticipantKeyHandler extends ParticipantKeyHandler_base {
|
|
|
62
62
|
* together with the material
|
|
63
63
|
* also resets the valid key property and updates the currentKeyIndex
|
|
64
64
|
*/
|
|
65
|
-
setKey(material: CryptoKey, keyIndex?: number): Promise<void>;
|
|
65
|
+
setKey(material: CryptoKey, keyIndex?: number, updateCurrentKeyIndex?: boolean): Promise<void>;
|
|
66
66
|
/**
|
|
67
67
|
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
|
68
68
|
* and derives encryption keys from the material and sets it on the key ring buffers
|
|
69
69
|
* together with the material
|
|
70
70
|
* also updates the currentKeyIndex
|
|
71
71
|
*/
|
|
72
|
-
setKeyFromMaterial(material: CryptoKey, keyIndex: number, ratchetedResult?: RatchetResult | null): Promise<void>;
|
|
72
|
+
setKeyFromMaterial(material: CryptoKey, keyIndex: number, ratchetedResult?: RatchetResult | null, updateCurrentKeyIndex?: boolean): Promise<void>;
|
|
73
73
|
setKeySet(keySet: KeySet, keyIndex: number, ratchetedResult?: RatchetResult | null): void;
|
|
74
74
|
setCurrentKeyIndex(index: number): Promise<void>;
|
|
75
75
|
getCurrentKeyIndex(): number;
|
package/dist/ts4.2/index.d.ts
CHANGED
|
@@ -3,10 +3,13 @@ import { DataPacket_Kind, DisconnectReason, Encryption_Type, SubscriptionError,
|
|
|
3
3
|
import { LogLevel, LoggerNames, getLogger, setLogExtension, setLogLevel } from './logger';
|
|
4
4
|
import DefaultReconnectPolicy from './room/DefaultReconnectPolicy';
|
|
5
5
|
import type { ReconnectContext, ReconnectPolicy } from './room/ReconnectPolicy';
|
|
6
|
+
import type Room, { RoomEventCallbacks } from './room/Room';
|
|
6
7
|
import Room, { ConnectionState } from './room/Room';
|
|
7
|
-
import type { RoomEventCallbacks } from './room/Room';
|
|
8
8
|
import * as attributes from './room/attribute-typings';
|
|
9
|
+
import './room/data-track/depacketizer';
|
|
10
|
+
import './room/data-track/outgoing/OutgoingDataTrackManager';
|
|
9
11
|
import LocalParticipant from './room/participant/LocalParticipant';
|
|
12
|
+
import type Participant, { ParticipantEventCallbacks } from './room/participant/Participant';
|
|
10
13
|
import Participant, { ConnectionQuality, ParticipantKind } from './room/participant/Participant';
|
|
11
14
|
import type { ParticipantTrackPermission } from './room/participant/ParticipantTrackPermission';
|
|
12
15
|
import RemoteParticipant from './room/participant/RemoteParticipant';
|
|
@@ -21,8 +24,9 @@ import RemoteTrack from './room/track/RemoteTrack';
|
|
|
21
24
|
import RemoteTrackPublication from './room/track/RemoteTrackPublication';
|
|
22
25
|
import type { ElementInfo } from './room/track/RemoteVideoTrack';
|
|
23
26
|
import RemoteVideoTrack from './room/track/RemoteVideoTrack';
|
|
27
|
+
import type { PublicationEventCallbacks } from './room/track/TrackPublication';
|
|
24
28
|
import { TrackPublication } from './room/track/TrackPublication';
|
|
25
|
-
import type { LiveKitReactNativeInfo } from './room/types';
|
|
29
|
+
import type { LiveKitReactNativeInfo, TextStreamInfo } from './room/types';
|
|
26
30
|
import type { AudioAnalyserOptions } from './room/utils';
|
|
27
31
|
import { compareVersions, createAudioAnalyser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, isAudioCodec, isAudioTrack, isBrowserSupported, isLocalParticipant, isLocalTrack, isRemoteParticipant, isRemoteTrack, isVideoCodec, isVideoTrack, supportsAV1, supportsAdaptiveStream, supportsAudioOutputSelection, supportsDynacast, supportsVP9 } from './room/utils';
|
|
28
32
|
import { getBrowser } from './utils/browserParser';
|
|
@@ -50,7 +54,7 @@ export * from './version';
|
|
|
50
54
|
export {
|
|
51
55
|
/** @internal */
|
|
52
56
|
attributes, ConnectionQuality, ConnectionState, CriticalTimers, DataPacket_Kind, Encryption_Type, DefaultReconnectPolicy, DisconnectReason, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, LoggerNames, Participant, RemoteAudioTrack, RemoteParticipant, ParticipantKind, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, SubscriptionError, TrackPublication, TrackType, compareVersions, createAudioAnalyser, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, isBrowserSupported, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsAudioOutputSelection, supportsDynacast, supportsVP9, Mutex, isAudioCodec, isAudioTrack, isLocalTrack, isRemoteTrack, isVideoCodec, isVideoTrack, isLocalParticipant, isRemoteParticipant, };
|
|
53
|
-
export type { AudioAnalyserOptions, ElementInfo, LiveKitReactNativeInfo, ParticipantTrackPermission, AudioReceiverStats, AudioSenderStats, VideoReceiverStats, VideoSenderStats, ReconnectContext, ReconnectPolicy, RoomEventCallbacks, };
|
|
57
|
+
export type { AudioAnalyserOptions, ElementInfo, LiveKitReactNativeInfo, TextStreamInfo, ParticipantTrackPermission, AudioReceiverStats, AudioSenderStats, VideoReceiverStats, VideoSenderStats, ReconnectContext, ReconnectPolicy, RoomEventCallbacks, ParticipantEventCallbacks, PublicationEventCallbacks, };
|
|
54
58
|
export type { DataTrackPacketHeader } from './room/data-track/packet';
|
|
55
59
|
export { DataTrackPacket } from './room/data-track/packet';
|
|
56
60
|
export type { DataTrackExtensions, DataTrackUserTimestampExtension, DataTrackE2eeExtension } from './room/data-track/packet/extensions';
|
package/dist/ts4.2/logger.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export declare enum LoggerNames {
|
|
|
18
18
|
Signal = "livekit-signal",
|
|
19
19
|
PCManager = "livekit-pc-manager",
|
|
20
20
|
PCTransport = "livekit-pc-transport",
|
|
21
|
-
E2EE = "lk-e2ee"
|
|
21
|
+
E2EE = "lk-e2ee",
|
|
22
|
+
DataTracks = "livekit-data-tracks"
|
|
22
23
|
}
|
|
23
24
|
type LogLevelString = keyof typeof LogLevel;
|
|
24
25
|
export type StructuredLogger = log.Logger & {
|
|
@@ -42,12 +42,7 @@ export default class PCTransport extends EventEmitter {
|
|
|
42
42
|
get isICEConnected(): boolean;
|
|
43
43
|
addIceCandidate(candidate: RTCIceCandidateInit): Promise<void>;
|
|
44
44
|
setRemoteDescription(sd: RTCSessionDescriptionInit, offerId: number): Promise<boolean>;
|
|
45
|
-
negotiate:
|
|
46
|
-
(this: unknown, ...args: [
|
|
47
|
-
onError?: ((e: Error) => void) | undefined
|
|
48
|
-
] & any[]): Promise<Promise<void>>;
|
|
49
|
-
cancel: (reason?: any) => void;
|
|
50
|
-
};
|
|
45
|
+
negotiate: import("./debounce").DebouncedFunction<any[], (onError?: (e: Error) => void) => Promise<void>>;
|
|
51
46
|
createAndSendOffer(options?: RTCOfferOptions): Promise<void>;
|
|
52
47
|
createAndSetAnswer(): Promise<RTCSessionDescriptionInit>;
|
|
53
48
|
createDataChannel(label: string, dataChannelDict: RTCDataChannelInit): RTCDataChannel;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DataStream_Chunk } from '@livekit/protocol';
|
|
2
2
|
import type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from '../../types';
|
|
3
|
-
import { Future } from '../../utils';
|
|
4
3
|
export type BaseStreamReaderReadAllOpts = {
|
|
5
4
|
/** An AbortSignal can be used to terminate reads early. */
|
|
6
5
|
signal?: AbortSignal;
|
|
@@ -10,11 +9,10 @@ declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
|
10
9
|
protected totalByteSize?: number;
|
|
11
10
|
protected _info: T;
|
|
12
11
|
protected bytesReceived: number;
|
|
13
|
-
protected outOfBandFailureRejectingFuture?: Future<never, Error>;
|
|
14
12
|
get info(): T;
|
|
15
13
|
/** @internal */
|
|
16
14
|
protected validateBytesReceived(doneReceiving?: boolean): void;
|
|
17
|
-
constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number
|
|
15
|
+
constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number);
|
|
18
16
|
protected abstract handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
19
17
|
onProgress?: (progress: number | undefined) => void;
|
|
20
18
|
abstract readAll(opts?: BaseStreamReaderReadAllOpts): Promise<string | Array<Uint8Array>>;
|
|
@@ -47,7 +45,7 @@ export declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
|
47
45
|
* A TextStreamReader instance can be used as an AsyncIterator that returns the entire string
|
|
48
46
|
* that has been received up to the current point in time.
|
|
49
47
|
*/
|
|
50
|
-
constructor(info: TextStreamInfo, stream: ReadableStream<DataStream_Chunk>, totalChunkCount?: number
|
|
48
|
+
constructor(info: TextStreamInfo, stream: ReadableStream<DataStream_Chunk>, totalChunkCount?: number);
|
|
51
49
|
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
52
50
|
/**
|
|
53
51
|
* @param progress - progress of the stream between 0 and 1. Undefined for streams of unknown size
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Throws } from '../../utils/throws';
|
|
2
|
+
import { LivekitReasonedError } from '../errors';
|
|
3
|
+
import type { DataTrackFrame } from './frame';
|
|
4
|
+
import { DataTrackPacket } from './packet';
|
|
5
|
+
/** An error indicating a frame was dropped. */
|
|
6
|
+
export declare class DataTrackDepacketizerDropError<Reason extends DataTrackDepacketizerDropReason> extends LivekitReasonedError<Reason> {
|
|
7
|
+
readonly name = "DataTrackDepacketizerDropError";
|
|
8
|
+
reason: Reason;
|
|
9
|
+
reasonName: string;
|
|
10
|
+
frameNumber: number;
|
|
11
|
+
constructor(message: string, reason: Reason, frameNumber: number, options?: {
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
});
|
|
14
|
+
static interrupted(frameNumber: number): DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.Interrupted>;
|
|
15
|
+
static unknownFrame(frameNumber: number): DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.UnknownFrame>;
|
|
16
|
+
static bufferFull(frameNumber: number): DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.BufferFull>;
|
|
17
|
+
static incomplete(frameNumber: number, receivedPackets: number, expectedPackets: number): DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.Incomplete>;
|
|
18
|
+
}
|
|
19
|
+
/** Reason why a frame was dropped. */
|
|
20
|
+
export declare enum DataTrackDepacketizerDropReason {
|
|
21
|
+
Interrupted = 0,
|
|
22
|
+
UnknownFrame = 1,
|
|
23
|
+
BufferFull = 2,
|
|
24
|
+
Incomplete = 3
|
|
25
|
+
}
|
|
26
|
+
type PushOptions = {
|
|
27
|
+
/** If true, throws an error instead of logging a warning when a new frame is encountered half way
|
|
28
|
+
* through processing a pre-existing frame. */
|
|
29
|
+
errorOnPartialFrames: boolean;
|
|
30
|
+
};
|
|
31
|
+
export default class DataTrackDepacketizer {
|
|
32
|
+
/** Maximum number of packets to buffer per frame before dropping. */
|
|
33
|
+
static MAX_BUFFER_PACKETS: number;
|
|
34
|
+
private partial;
|
|
35
|
+
/** Should be repeatedly called with received {@link DataTrackPacket}s - intermediate calls
|
|
36
|
+
* aggregate the packet's state internally, and return null.
|
|
37
|
+
*
|
|
38
|
+
* Once this method is called with the final packet to form a frame, a new {@link DataTrackFrame}
|
|
39
|
+
* is returned.*/
|
|
40
|
+
push(packet: DataTrackPacket, options?: PushOptions): Throws<DataTrackFrame | null, DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.Interrupted> | DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.BufferFull> | DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.UnknownFrame> | DataTrackDepacketizerDropError<DataTrackDepacketizerDropReason.Incomplete>>;
|
|
41
|
+
reset(): void;
|
|
42
|
+
private frameFromSingle;
|
|
43
|
+
/** Begin assembling a new packet. */
|
|
44
|
+
private beginPartial;
|
|
45
|
+
/** Push to the existing partial frame. */
|
|
46
|
+
private pushToPartial;
|
|
47
|
+
/** Try to reassemble the complete frame. */
|
|
48
|
+
private finalize;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=depacketizer.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type EncryptedPayload = {
|
|
2
|
+
payload: Uint8Array;
|
|
3
|
+
iv: Uint8Array;
|
|
4
|
+
keyIndex: number;
|
|
5
|
+
};
|
|
6
|
+
export type EncryptionProvider = {
|
|
7
|
+
encrypt(payload: Uint8Array): EncryptedPayload;
|
|
8
|
+
};
|
|
9
|
+
export type DecryptionProvider = {
|
|
10
|
+
decrypt(payload: Uint8Array, senderIdentity: string): Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=e2ee.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataTrackExtensions } from './packet/extensions';
|
|
2
|
+
/** A pair of payload bytes and packet extensions which can be fed into a {@link DataTrackPacketizer}. */
|
|
3
|
+
export type DataTrackFrame = {
|
|
4
|
+
payload: Uint8Array;
|
|
5
|
+
extensions: DataTrackExtensions;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=frame.d.ts.map
|
|
@@ -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<DataTrackHandleErrorReason.TooLarge> | DataTrackHandleError<DataTrackHandleErrorReason.Reserved>>;
|
|
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,77 @@
|
|
|
1
|
+
import type TypedEmitter from 'typed-emitter';
|
|
2
|
+
import type { Throws } from '../../../utils/throws';
|
|
3
|
+
import { Future } from '../../utils';
|
|
4
|
+
import type { EncryptionProvider } from '../e2ee';
|
|
5
|
+
import { DataTrackHandle } from '../handle';
|
|
6
|
+
import type { DataTrackInfo } from '../track';
|
|
7
|
+
import { LocalDataTrack } from '../track';
|
|
8
|
+
import { DataTrackPublishError, DataTrackPublishErrorReason, DataTrackPushFrameError, DataTrackPushFrameErrorReason } from './errors';
|
|
9
|
+
import DataTrackOutgoingPipeline from './pipeline';
|
|
10
|
+
import type { DataTrackOptions, OutputEventPacketsAvailable, OutputEventSfuPublishRequest, OutputEventSfuUnpublishRequest, 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: OutputEventSfuPublishRequest) => void;
|
|
30
|
+
/** Request sent to the SFU to unpublish a track. */
|
|
31
|
+
sfuUnpublishRequest: (event: OutputEventSfuUnpublishRequest) => void;
|
|
32
|
+
/** Serialized packets are ready to be sent over the transport. */
|
|
33
|
+
packetsAvailable: (event: OutputEventPacketsAvailable) => void;
|
|
34
|
+
};
|
|
35
|
+
type DataTrackLocalManagerOptions = {
|
|
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?: DataTrackLocalManagerOptions);
|
|
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, DataTrackPacketizerReason } 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> 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> 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<DataTrackPacketizerReason.MtuTooShort>): 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 '../../../utils/throws';
|
|
2
|
+
import type { EncryptionProvider } from '../e2ee';
|
|
3
|
+
import type { DataTrackFrame } from '../frame';
|
|
4
|
+
import { DataTrackPacket } from '../packet';
|
|
5
|
+
import type { DataTrackInfo } from '../track';
|
|
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<DataTrackOutgoingPipelineErrorReason.Packetizer> | DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>>;
|
|
19
|
+
encryptIfNeeded(frame: DataTrackFrame): Throws<DataTrackFrame, DataTrackOutgoingPipelineError<DataTrackOutgoingPipelineErrorReason.Encryption>>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DataTrackHandle } from '../handle';
|
|
2
|
+
import type { DataTrackInfo } from '../track';
|
|
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 OutputEventSfuPublishRequest = {
|
|
18
|
+
handle: DataTrackHandle;
|
|
19
|
+
name: string;
|
|
20
|
+
usesE2ee: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** Request sent to the SFU to unpublish a track. */
|
|
23
|
+
export type OutputEventSfuUnpublishRequest = {
|
|
24
|
+
handle: DataTrackHandle;
|
|
25
|
+
};
|
|
26
|
+
/** Serialized packets are ready to be sent over the transport. */
|
|
27
|
+
export type OutputEventPacketsAvailable = {
|
|
28
|
+
bytes: Uint8Array;
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -63,8 +63,8 @@ export declare enum FrameMarker {
|
|
|
63
63
|
/** A class for serializing / deserializing data track packets. */
|
|
64
64
|
export declare class DataTrackPacket extends Serializable {
|
|
65
65
|
header: DataTrackPacketHeader;
|
|
66
|
-
payload:
|
|
67
|
-
constructor(header: DataTrackPacketHeader, payload:
|
|
66
|
+
payload: Uint8Array;
|
|
67
|
+
constructor(header: DataTrackPacketHeader, payload: Uint8Array);
|
|
68
68
|
toBinaryLengthBytes(): number;
|
|
69
69
|
toBinaryInto(dataView: DataView): Throws<number, DataTrackSerializeErrorAll>;
|
|
70
70
|
static fromBinary<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): Throws<[
|
|
@@ -92,7 +92,7 @@ export declare class DataTrackPacket extends Serializable {
|
|
|
92
92
|
} | null;
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
|
-
payload:
|
|
95
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Throws } from '../../utils/throws';
|
|
2
|
+
import { LivekitReasonedError } from '../errors';
|
|
3
|
+
import type { DataTrackFrame } from './frame';
|
|
4
|
+
import { DataTrackHandle } from './handle';
|
|
5
|
+
import { DataTrackPacket, FrameMarker } from './packet';
|
|
6
|
+
import { DataTrackTimestamp } from './utils';
|
|
7
|
+
type PacketizeOptions = {
|
|
8
|
+
/** "now" timestamp to use as a base when generating new packet timestamps. If not specified,
|
|
9
|
+
* defaults to the return value of {@link DataTrackClock#now}. */
|
|
10
|
+
now?: DataTrackTimestamp<90000>;
|
|
11
|
+
};
|
|
12
|
+
export declare class DataTrackPacketizerError<Reason extends DataTrackPacketizerReason> extends LivekitReasonedError<Reason> {
|
|
13
|
+
readonly name = "DataTrackPacketizerError";
|
|
14
|
+
reason: Reason;
|
|
15
|
+
reasonName: string;
|
|
16
|
+
constructor(message: string, reason: Reason, options?: {
|
|
17
|
+
cause?: unknown;
|
|
18
|
+
});
|
|
19
|
+
static mtuTooShort(): DataTrackPacketizerError<DataTrackPacketizerReason>;
|
|
20
|
+
}
|
|
21
|
+
export declare enum DataTrackPacketizerReason {
|
|
22
|
+
MtuTooShort = 0
|
|
23
|
+
}
|
|
24
|
+
/** A packetizer takes a {@link DataTrackFrame} as input and generates a series
|
|
25
|
+
* of {@link DataTrackPacket}s for transmission to other clients over webrtc. */
|
|
26
|
+
export default class DataTrackPacketizer {
|
|
27
|
+
private handle;
|
|
28
|
+
private mtuSizeBytes;
|
|
29
|
+
private sequence;
|
|
30
|
+
private frameNumber;
|
|
31
|
+
private clock;
|
|
32
|
+
constructor(trackHandle: DataTrackHandle, mtuSizeBytes: number);
|
|
33
|
+
/** @internal */
|
|
34
|
+
static computeFrameMarker(index: number, packetCount: number): FrameMarker;
|
|
35
|
+
/** Generates a series of packets for the specified {@link DataTrackPacketizerFrame}.
|
|
36
|
+
*
|
|
37
|
+
* NOTE: The return value of this function is a generator, so it can be lazily ran if desired,
|
|
38
|
+
* or converted to an array with {@link Array.from}.
|
|
39
|
+
*/
|
|
40
|
+
packetize(frame: DataTrackFrame, options?: PacketizeOptions): Throws<Generator<DataTrackPacket>, DataTrackPacketizerError<DataTrackPacketizerReason.MtuTooShort>>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=packetizer.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DataTrackFrame } from './frame';
|
|
2
|
+
import type { DataTrackHandle } from './handle';
|
|
3
|
+
import type OutgoingDataTrackManager from './outgoing/OutgoingDataTrackManager';
|
|
4
|
+
export type DataTrackSid = string;
|
|
5
|
+
/** Information about a published data track. */
|
|
6
|
+
export type DataTrackInfo = {
|
|
7
|
+
sid: DataTrackSid;
|
|
8
|
+
pubHandle: DataTrackHandle;
|
|
9
|
+
name: String;
|
|
10
|
+
usesE2ee: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare class LocalDataTrack {
|
|
13
|
+
info: DataTrackInfo;
|
|
14
|
+
protected manager: OutgoingDataTrackManager;
|
|
15
|
+
constructor(info: DataTrackInfo, manager: OutgoingDataTrackManager);
|
|
16
|
+
/** The raw descriptor from the manager containing the internal state for this local track. */
|
|
17
|
+
protected get descriptor(): import("./outgoing/OutgoingDataTrackManager").Descriptor | null;
|
|
18
|
+
isPublished(): boolean;
|
|
19
|
+
/** Try pushing a frame to subscribers of the track.
|
|
20
|
+
*
|
|
21
|
+
* Pushing a frame can fail for several reasons:
|
|
22
|
+
*
|
|
23
|
+
* - The track has been unpublished by the local participant or SFU
|
|
24
|
+
* - The room is no longer connected
|
|
25
|
+
*/
|
|
26
|
+
tryPush(payload: DataTrackFrame['payload']): void & {
|
|
27
|
+
readonly __throws?: import("./outgoing/errors").DataTrackPushFrameError<import("./outgoing/errors").DataTrackPushFrameErrorReason.Dropped> | import("./outgoing/errors").DataTrackPushFrameError<import("./outgoing/errors").DataTrackPushFrameErrorReason.TrackUnpublished> | undefined;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=track.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const U16_MAX_SIZE = 65535;
|
|
2
|
+
export declare const U32_MAX_SIZE = 4294967295;
|
|
2
3
|
/**
|
|
3
4
|
* A number of fields withing the data tracks packet specification assume wrap around behavior when
|
|
4
5
|
* an unsigned type is incremented beyond its max size (ie, the packet `sequence` field). This
|
|
@@ -9,20 +10,51 @@ export declare class WrapAroundUnsignedInt<MaxSize extends number> {
|
|
|
9
10
|
value: number;
|
|
10
11
|
private maxSize;
|
|
11
12
|
static u16(raw: number): WrapAroundUnsignedInt<65535>;
|
|
13
|
+
static u32(raw: number): WrapAroundUnsignedInt<4294967295>;
|
|
12
14
|
constructor(raw: number, maxSize: MaxSize);
|
|
13
15
|
/** Manually clamp the given containing value according to the wrap around max size bounds. Use
|
|
14
16
|
* this after out of bounds modification to the contained value by external code. */
|
|
15
17
|
clamp(): void;
|
|
18
|
+
clone(): WrapAroundUnsignedInt<MaxSize>;
|
|
16
19
|
/** When called, maps the containing value to a new containing value. After mapping, the wrap
|
|
17
|
-
* around external max size bounds are applied. */
|
|
20
|
+
* around external max size bounds are applied. Note that this is a mutative operation. */
|
|
18
21
|
update(updateFn: (value: number) => number): void;
|
|
22
|
+
/** Increments the given `n` to the inner value. Note that this is a mutative operation. */
|
|
23
|
+
increment(n?: number): void;
|
|
24
|
+
/** Decrements the given `n` from the inner value. Note that this is a mutative operation. */
|
|
25
|
+
decrement(n?: number): void;
|
|
26
|
+
getThenIncrement(): WrapAroundUnsignedInt<MaxSize>;
|
|
27
|
+
/** Returns true if {@link this} is before the passed other {@link WrapAroundUnsignedInt}. */
|
|
28
|
+
isBefore(other: WrapAroundUnsignedInt<MaxSize>): boolean;
|
|
19
29
|
}
|
|
20
30
|
export declare class DataTrackTimestamp<RateInHz extends number> {
|
|
21
31
|
rateInHz: RateInHz;
|
|
22
|
-
timestamp:
|
|
32
|
+
timestamp: WrapAroundUnsignedInt<typeof U32_MAX_SIZE>;
|
|
23
33
|
static fromRtpTicks(rtpTicks: number): DataTrackTimestamp<90000>;
|
|
34
|
+
/** Generates a timestamp initialized to a non cryptographically secure random value, so that
|
|
35
|
+
* different streams are more difficult to correlate in packet capture. */
|
|
36
|
+
static rtpRandom(): DataTrackTimestamp<90000>;
|
|
37
|
+
private constructor();
|
|
24
38
|
asTicks(): number;
|
|
39
|
+
clone(): DataTrackTimestamp<RateInHz>;
|
|
40
|
+
wrappingAdd(n: number): void;
|
|
41
|
+
/** Returns true if {@link this} is before the passed other {@link DataTrackTimestamp}. */
|
|
42
|
+
isBefore(other: DataTrackTimestamp<RateInHz>): boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare class DataTrackClock<RateInHz extends number> {
|
|
45
|
+
epoch: Date;
|
|
46
|
+
base: DataTrackTimestamp<RateInHz>;
|
|
47
|
+
previous: DataTrackTimestamp<RateInHz>;
|
|
48
|
+
rateInHz: RateInHz;
|
|
25
49
|
private constructor();
|
|
50
|
+
static startingNow<RateInHz extends number>(base: DataTrackTimestamp<RateInHz>, rateInHz: RateInHz): DataTrackClock<RateInHz>;
|
|
51
|
+
static startingAtTime<RateInHz extends number>(epoch: Date, base: DataTrackTimestamp<RateInHz>, rateInHz: RateInHz): DataTrackClock<RateInHz>;
|
|
52
|
+
static rtpStartingNow(base: DataTrackTimestamp<90000>): DataTrackClock<90000>;
|
|
53
|
+
static rtpStartingAtTime(epoch: Date, base: DataTrackTimestamp<90000>): DataTrackClock<90000>;
|
|
54
|
+
now(): DataTrackTimestamp<RateInHz>;
|
|
55
|
+
at(timestamp: Date): DataTrackTimestamp<RateInHz>;
|
|
56
|
+
/** Convert a duration since the epoch into clock ticks. */
|
|
57
|
+
static durationInMsToTicks(durationMilliseconds: number, rateInHz: number): number;
|
|
26
58
|
}
|
|
27
59
|
export declare function coerceToDataView<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): DataView;
|
|
28
60
|
//# sourceMappingURL=utils.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
|
|
@@ -24,7 +24,7 @@ export default class LocalAudioTrack extends LocalTrack<Track.Kind.Audio> {
|
|
|
24
24
|
mute(): Promise<typeof this>;
|
|
25
25
|
unmute(): Promise<typeof this>;
|
|
26
26
|
restartTrack(options?: AudioCaptureOptions): Promise<void>;
|
|
27
|
-
protected restart(constraints?: MediaTrackConstraints): Promise<typeof this>;
|
|
27
|
+
protected restart(constraints?: MediaTrackConstraints, isUnmuting?: boolean): Promise<typeof this>;
|
|
28
28
|
startMonitor(): void;
|
|
29
29
|
protected monitorSender: () => Promise<void>;
|
|
30
30
|
private handleKrispNoiseFilterEnable;
|
|
@@ -27,6 +27,7 @@ export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Ki
|
|
|
27
27
|
protected manuallyStopped: boolean;
|
|
28
28
|
protected localTrackRecorder: LocalTrackRecorder<typeof this> | undefined;
|
|
29
29
|
protected trackChangeLock: Mutex;
|
|
30
|
+
protected pendingDeviceChange: boolean;
|
|
30
31
|
/**
|
|
31
32
|
*
|
|
32
33
|
* @param mediaTrack
|
|
@@ -59,7 +60,7 @@ export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Ki
|
|
|
59
60
|
unmute(): Promise<this>;
|
|
60
61
|
replaceTrack(track: MediaStreamTrack, options?: ReplaceTrackOptions): Promise<typeof this>;
|
|
61
62
|
replaceTrack(track: MediaStreamTrack, userProvidedTrack?: boolean): Promise<typeof this>;
|
|
62
|
-
protected restart(constraints?: MediaTrackConstraints): Promise<this>;
|
|
63
|
+
protected restart(constraints?: MediaTrackConstraints, isUnmuting?: boolean): Promise<this>;
|
|
63
64
|
protected setTrackMuted(muted: boolean): void;
|
|
64
65
|
protected get needsReAcquisition(): boolean;
|
|
65
66
|
protected handleAppVisibilityChanged(): Promise<void>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DataStream_Chunk, Encryption_Type } from '@livekit/protocol';
|
|
2
|
-
import type { Future } from './utils';
|
|
3
2
|
export type SimulationOptions = {
|
|
4
3
|
publish?: {
|
|
5
4
|
audio?: boolean;
|
|
@@ -91,7 +90,6 @@ export interface StreamController<T extends DataStream_Chunk> {
|
|
|
91
90
|
startTime: number;
|
|
92
91
|
endTime?: number;
|
|
93
92
|
sendingParticipantIdentity: string;
|
|
94
|
-
outOfBandFailureRejectingFuture: Future<never, Error>;
|
|
95
93
|
}
|
|
96
94
|
export interface BaseStreamInfo {
|
|
97
95
|
id: string;
|