livekit-client
Version:
JavaScript/TypeScript client SDK for LiveKit
91 lines • 3.63 kB
TypeScript
import { type Throws } from '@livekit/throws-transformer/throws';
import { DataTrackHandle } from '../handle';
import { DataTrackTimestamp, U16_MAX_SIZE, WrapAroundUnsignedInt } from '../utils';
import { DataTrackDeserializeError, DataTrackSerializeError, DataTrackSerializeErrorReason } from './errors';
import { DataTrackExtensions } from './extensions';
import Serializable from './serializable';
/** A class for serializing / deserializing data track packet header sections. */
export declare class DataTrackPacketHeader extends Serializable {
marker: FrameMarker;
trackHandle: DataTrackHandle;
sequence: WrapAroundUnsignedInt<typeof U16_MAX_SIZE>;
frameNumber: WrapAroundUnsignedInt<typeof U16_MAX_SIZE>;
timestamp: DataTrackTimestamp<90000>;
extensions: DataTrackExtensions;
constructor(opts: {
marker: FrameMarker;
trackHandle: DataTrackHandle;
sequence: WrapAroundUnsignedInt<typeof U16_MAX_SIZE>;
frameNumber: WrapAroundUnsignedInt<typeof U16_MAX_SIZE>;
timestamp: DataTrackTimestamp<90000>;
extensions?: DataTrackExtensions;
});
private extensionsMetrics;
toBinaryLengthBytes(): number;
toBinaryInto(dataView: DataView): Throws<number, DataTrackSerializeError<DataTrackSerializeErrorReason.TooSmallForHeader>>;
static fromBinary<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): Throws<[header: DataTrackPacketHeader, byteLength: number], DataTrackDeserializeError>;
toJSON(): {
marker: FrameMarker;
trackHandle: number;
sequence: number;
frameNumber: number;
timestamp: number;
extensions: {
userTimestamp: {
tag: number;
lengthBytes: number;
timestamp: bigint;
} | null;
e2ee: {
tag: number;
lengthBytes: number;
keyIndex: number;
iv: Uint8Array<ArrayBufferLike>;
} | null;
};
};
}
/** Marker indicating a packet's position in relation to a frame. */
export declare enum FrameMarker {
/** Packet is the first in a frame. */
Start = 0,
/** Packet is within a frame. */
Inter = 1,
/** Packet is the last in a frame. */
Final = 2,
/** Packet is the only one in a frame. */
Single = 3
}
/** A class for serializing / deserializing data track packets. */
export declare class DataTrackPacket extends Serializable {
header: DataTrackPacketHeader;
payload: Uint8Array;
constructor(header: DataTrackPacketHeader, payload: Uint8Array);
toBinaryLengthBytes(): number;
toBinaryInto(dataView: DataView): Throws<number, DataTrackSerializeError>;
static fromBinary<Input extends DataView | ArrayBuffer | Uint8Array>(input: Input): Throws<[packet: DataTrackPacket, byteLength: number], DataTrackDeserializeError>;
toJSON(): {
header: {
marker: FrameMarker;
trackHandle: number;
sequence: number;
frameNumber: number;
timestamp: number;
extensions: {
userTimestamp: {
tag: number;
lengthBytes: number;
timestamp: bigint;
} | null;
e2ee: {
tag: number;
lengthBytes: number;
keyIndex: number;
iv: Uint8Array<ArrayBufferLike>;
} | null;
};
};
payload: Uint8Array<ArrayBufferLike>;
};
}
//# sourceMappingURL=index.d.ts.map