livekit-client
Advanced tools
Comparing version
@@ -5,3 +5,10 @@ import type TypedEventEmitter from 'typed-emitter'; | ||
import { type E2EEManagerCallbacks } from './events'; | ||
import type { E2EEOptions } from './types'; | ||
import type { E2EEManagerOptions } from './types'; | ||
export interface BaseE2EEManager { | ||
setup(room: Room): void; | ||
setupEngine(engine: RTCEngine): void; | ||
setParticipantCryptorEnabled(enabled: boolean, participantIdentity: string): void; | ||
setSifTrailer(trailer: Uint8Array): void; | ||
on<E extends keyof E2EEManagerCallbacks>(event: E, listener: E2EEManagerCallbacks[E]): this; | ||
} | ||
declare const E2EEManager_base: new () => TypedEventEmitter<E2EEManagerCallbacks>; | ||
@@ -11,3 +18,3 @@ /** | ||
*/ | ||
export declare class E2EEManager extends E2EEManager_base { | ||
export declare class E2EEManager extends E2EEManager_base implements BaseE2EEManager { | ||
protected worker: Worker; | ||
@@ -17,3 +24,3 @@ protected room?: Room; | ||
private keyProvider; | ||
constructor(options: E2EEOptions); | ||
constructor(options: E2EEManagerOptions); | ||
/** | ||
@@ -20,0 +27,0 @@ * @internal |
import type { LogLevel } from '../logger'; | ||
import type { VideoCodec } from '../room/track/options'; | ||
import type { BaseE2EEManager } from './E2eeManager'; | ||
import type { BaseKeyProvider } from './KeyProvider'; | ||
@@ -113,6 +114,10 @@ export interface BaseMessage { | ||
}; | ||
export type E2EEOptions = { | ||
export type E2EEManagerOptions = { | ||
keyProvider: BaseKeyProvider; | ||
worker: Worker; | ||
}; | ||
export type E2EEOptions = E2EEManagerOptions | { | ||
/** For react-native usage. */ | ||
e2eeManager: BaseE2EEManager; | ||
}; | ||
export type DecodeRatchetOptions = { | ||
@@ -119,0 +124,0 @@ /** attempts */ |
@@ -31,2 +31,3 @@ import { Mutex } from '@livekit/mutex'; | ||
export * from './e2ee'; | ||
export type { BaseE2EEManager } from './e2ee/E2eeManager'; | ||
export * from './options'; | ||
@@ -33,0 +34,0 @@ export * from './room/errors'; |
@@ -58,3 +58,3 @@ import { DataPacket_Kind, ParticipantInfo, ParticipantInfo_Kind as ParticipantKind, ParticipantPermission, ConnectionQuality as ProtoQuality, type SipDTMF, SubscriptionError } from '@livekit/protocol'; | ||
/** @internal */ | ||
constructor(sid: string, identity: string, name?: string, metadata?: string, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
constructor(sid: string, identity: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
getTrackPublications(): TrackPublication[]; | ||
@@ -61,0 +61,0 @@ /** |
@@ -24,3 +24,3 @@ import type { ParticipantInfo } from '@livekit/protocol'; | ||
/** @internal */ | ||
constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
protected addTrackPublication(publication: RemoteTrackPublication): void; | ||
@@ -27,0 +27,0 @@ getTrackPublication(source: Track.Source): RemoteTrackPublication | undefined; |
@@ -5,3 +5,10 @@ import type TypedEventEmitter from 'typed-emitter'; | ||
import type { E2EEManagerCallbacks } from './events'; | ||
import type { E2EEOptions } from './types'; | ||
import type { E2EEManagerOptions } from './types'; | ||
export interface BaseE2EEManager { | ||
setup(room: Room): void; | ||
setupEngine(engine: RTCEngine): void; | ||
setParticipantCryptorEnabled(enabled: boolean, participantIdentity: string): void; | ||
setSifTrailer(trailer: Uint8Array): void; | ||
on<E extends keyof E2EEManagerCallbacks>(event: E, listener: E2EEManagerCallbacks[E]): this; | ||
} | ||
declare const E2EEManager_base: new () => TypedEventEmitter<E2EEManagerCallbacks>; | ||
@@ -11,3 +18,3 @@ /** | ||
*/ | ||
export declare class E2EEManager extends E2EEManager_base { | ||
export declare class E2EEManager extends E2EEManager_base implements BaseE2EEManager { | ||
protected worker: Worker; | ||
@@ -17,3 +24,3 @@ protected room?: Room; | ||
private keyProvider; | ||
constructor(options: E2EEOptions); | ||
constructor(options: E2EEManagerOptions); | ||
/** | ||
@@ -20,0 +27,0 @@ * @internal |
import type { LogLevel } from '../logger'; | ||
import type { VideoCodec } from '../room/track/options'; | ||
import type { BaseE2EEManager } from './E2eeManager'; | ||
import type { BaseKeyProvider } from './KeyProvider'; | ||
@@ -113,6 +114,10 @@ export interface BaseMessage { | ||
}; | ||
export type E2EEOptions = { | ||
export type E2EEManagerOptions = { | ||
keyProvider: BaseKeyProvider; | ||
worker: Worker; | ||
}; | ||
export type E2EEOptions = E2EEManagerOptions | { | ||
/** For react-native usage. */ | ||
e2eeManager: BaseE2EEManager; | ||
}; | ||
export type DecodeRatchetOptions = { | ||
@@ -119,0 +124,0 @@ /** attempts */ |
@@ -32,2 +32,3 @@ import { Mutex } from '@livekit/mutex'; | ||
export * from './e2ee'; | ||
export type { BaseE2EEManager } from './e2ee/E2eeManager'; | ||
export * from './options'; | ||
@@ -34,0 +35,0 @@ export * from './room/errors'; |
@@ -59,3 +59,3 @@ import type { SipDTMF } from '@livekit/protocol'; | ||
/** @internal */ | ||
constructor(sid: string, identity: string, name?: string, metadata?: string, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
constructor(sid: string, identity: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
getTrackPublications(): TrackPublication[]; | ||
@@ -62,0 +62,0 @@ /** |
@@ -24,3 +24,3 @@ import type { ParticipantInfo } from '@livekit/protocol'; | ||
/** @internal */ | ||
constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, attributes?: Record<string, string>, loggerOptions?: LoggerOptions, kind?: ParticipantKind); | ||
protected addTrackPublication(publication: RemoteTrackPublication): void; | ||
@@ -27,0 +27,0 @@ getTrackPublication(source: Track.Source): RemoteTrackPublication | undefined; |
{ | ||
"name": "livekit-client", | ||
"version": "2.7.3", | ||
"version": "2.7.4", | ||
"description": "JavaScript/TypeScript client SDK for LiveKit", | ||
@@ -5,0 +5,0 @@ "main": "./dist/livekit-client.umd.js", |
@@ -19,3 +19,3 @@ import { Encryption_Type, TrackInfo } from '@livekit/protocol'; | ||
import type { | ||
E2EEOptions, | ||
E2EEManagerOptions, | ||
E2EEWorkerMessage, | ||
@@ -35,6 +35,17 @@ EnableMessage, | ||
export interface BaseE2EEManager { | ||
setup(room: Room): void; | ||
setupEngine(engine: RTCEngine): void; | ||
setParticipantCryptorEnabled(enabled: boolean, participantIdentity: string): void; | ||
setSifTrailer(trailer: Uint8Array): void; | ||
on<E extends keyof E2EEManagerCallbacks>(event: E, listener: E2EEManagerCallbacks[E]): this; | ||
} | ||
/** | ||
* @experimental | ||
*/ | ||
export class E2EEManager extends (EventEmitter as new () => TypedEventEmitter<E2EEManagerCallbacks>) { | ||
export class E2EEManager | ||
extends (EventEmitter as new () => TypedEventEmitter<E2EEManagerCallbacks>) | ||
implements BaseE2EEManager | ||
{ | ||
protected worker: Worker; | ||
@@ -48,3 +59,3 @@ | ||
constructor(options: E2EEOptions) { | ||
constructor(options: E2EEManagerOptions) { | ||
super(); | ||
@@ -51,0 +62,0 @@ this.keyProvider = options.keyProvider; |
import type { LogLevel } from '../logger'; | ||
import type { VideoCodec } from '../room/track/options'; | ||
import type { BaseE2EEManager } from './E2eeManager'; | ||
import type { BaseKeyProvider } from './KeyProvider'; | ||
@@ -140,6 +141,12 @@ | ||
export type E2EEOptions = { | ||
export type E2EEManagerOptions = { | ||
keyProvider: BaseKeyProvider; | ||
worker: Worker; | ||
}; | ||
export type E2EEOptions = | ||
| E2EEManagerOptions | ||
| { | ||
/** For react-native usage. */ | ||
e2eeManager: BaseE2EEManager; | ||
}; | ||
@@ -146,0 +153,0 @@ export type DecodeRatchetOptions = { |
@@ -48,2 +48,3 @@ import { Mutex } from '@livekit/mutex'; | ||
export * from './e2ee'; | ||
export type { BaseE2EEManager } from './e2ee/E2eeManager'; | ||
export * from './options'; | ||
@@ -50,0 +51,0 @@ export * from './room/errors'; |
@@ -50,2 +50,3 @@ import { DataPacket, DataPacket_Kind } from '@livekit/protocol'; | ||
undefined, | ||
undefined, | ||
ParticipantKind.STANDARD, | ||
@@ -96,2 +97,3 @@ ); | ||
undefined, | ||
undefined, | ||
ParticipantKind.STANDARD, | ||
@@ -139,2 +141,3 @@ ); | ||
undefined, | ||
undefined, | ||
ParticipantKind.STANDARD, | ||
@@ -202,2 +205,3 @@ ); | ||
undefined, | ||
undefined, | ||
ParticipantKind.STANDARD, | ||
@@ -204,0 +208,0 @@ ); |
@@ -129,2 +129,3 @@ import { | ||
metadata?: string, | ||
attributes?: Record<string, string>, | ||
loggerOptions?: LoggerOptions, | ||
@@ -147,3 +148,3 @@ kind: ParticipantKind = ParticipantKind.STANDARD, | ||
this._kind = kind; | ||
this._attributes = {}; | ||
this._attributes = attributes ?? {}; | ||
} | ||
@@ -150,0 +151,0 @@ |
@@ -47,2 +47,3 @@ import type { | ||
pi.metadata, | ||
pi.attributes, | ||
loggerOptions, | ||
@@ -68,6 +69,7 @@ pi.kind, | ||
metadata?: string, | ||
attributes?: Record<string, string>, | ||
loggerOptions?: LoggerOptions, | ||
kind: ParticipantKind = ParticipantKind.STANDARD, | ||
) { | ||
super(sid, identity || '', name, metadata, loggerOptions, kind); | ||
super(sid, identity || '', name, metadata, attributes, loggerOptions, kind); | ||
this.signalClient = signalClient; | ||
@@ -74,0 +76,0 @@ this.trackPublications = new Map(); |
@@ -271,2 +271,3 @@ import { EventEmitter } from 'events'; | ||
sdpParsed.media.forEach((media) => { | ||
ensureIPAddrMatchVersion(media); | ||
if (media.type === 'audio') { | ||
@@ -329,2 +330,3 @@ ensureAudioNackAndStereo(media, [], []); | ||
sdpParsed.media.forEach((media) => { | ||
ensureIPAddrMatchVersion(media); | ||
if (media.type === 'audio') { | ||
@@ -635,1 +637,15 @@ ensureAudioNackAndStereo(media, this.remoteStereoMids, this.remoteNackMids); | ||
} | ||
function ensureIPAddrMatchVersion(media: MediaDescription) { | ||
// Chrome could generate sdp with c = IN IP4 <ipv6 addr> | ||
// in edge case and return error when set sdp.This is not a | ||
// sdk error but correct it if the issue detected. | ||
if (media.connection) { | ||
const isV6 = media.connection.ip.indexOf(':') >= 0; | ||
if ((media.connection.version === 4 && isV6) || (media.connection.version === 6 && !isV6)) { | ||
// fallback to dummy address | ||
media.connection.ip = '0.0.0.0'; | ||
media.connection.version = 4; | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
6046628
0.17%54163
0.2%