review: refactor convert params to object for generateRoomOption
This commit is contained in:
@@ -59,19 +59,19 @@ export class ECConnectionFactory implements ConnectionFactory {
|
|||||||
) {
|
) {
|
||||||
const defaultFactory = (): LivekitRoom =>
|
const defaultFactory = (): LivekitRoom =>
|
||||||
new LivekitRoom(
|
new LivekitRoom(
|
||||||
generateRoomOption(
|
generateRoomOption({
|
||||||
this.devices,
|
devices: this.devices,
|
||||||
this.processorState$.value,
|
processorState: this.processorState$.value,
|
||||||
livekitKeyProvider && {
|
e2eeLivekitOptions: livekitKeyProvider && {
|
||||||
keyProvider: livekitKeyProvider,
|
keyProvider: livekitKeyProvider,
|
||||||
// It's important that every room use a separate E2EE worker.
|
// It's important that every room use a separate E2EE worker.
|
||||||
// They get confused if given streams from multiple rooms.
|
// They get confused if given streams from multiple rooms.
|
||||||
worker: new E2EEWorker(),
|
worker: new E2EEWorker(),
|
||||||
},
|
},
|
||||||
this.controlledAudioDevices,
|
controlledAudioDevices: this.controlledAudioDevices,
|
||||||
echoCancellation,
|
echoCancellation,
|
||||||
noiseSuppression,
|
noiseSuppression,
|
||||||
),
|
}),
|
||||||
);
|
);
|
||||||
this.livekitRoomFactory = livekitRoomFactory ?? defaultFactory;
|
this.livekitRoomFactory = livekitRoomFactory ?? defaultFactory;
|
||||||
}
|
}
|
||||||
@@ -96,14 +96,24 @@ export class ECConnectionFactory implements ConnectionFactory {
|
|||||||
/**
|
/**
|
||||||
* Generate the initial LiveKit RoomOptions based on the current media devices and processor state.
|
* Generate the initial LiveKit RoomOptions based on the current media devices and processor state.
|
||||||
*/
|
*/
|
||||||
function generateRoomOption(
|
function generateRoomOption({
|
||||||
devices: MediaDevices,
|
devices,
|
||||||
processorState: ProcessorState,
|
processorState,
|
||||||
e2eeLivekitOptions: E2EEOptions | undefined,
|
e2eeLivekitOptions,
|
||||||
controlledAudioDevices: boolean,
|
controlledAudioDevices,
|
||||||
echoCancellation: boolean,
|
echoCancellation,
|
||||||
noiseSuppression: boolean,
|
noiseSuppression,
|
||||||
): RoomOptions {
|
}: {
|
||||||
|
devices: MediaDevices;
|
||||||
|
processorState: ProcessorState;
|
||||||
|
e2eeLivekitOptions:
|
||||||
|
| E2EEManagerOptions
|
||||||
|
| { e2eeManager: BaseE2EEManager }
|
||||||
|
| undefined;
|
||||||
|
controlledAudioDevices: boolean;
|
||||||
|
echoCancellation: boolean;
|
||||||
|
noiseSuppression: boolean;
|
||||||
|
}): RoomOptions {
|
||||||
return {
|
return {
|
||||||
...defaultLiveKitOptions,
|
...defaultLiveKitOptions,
|
||||||
videoCaptureDefaults: {
|
videoCaptureDefaults: {
|
||||||
|
|||||||
Reference in New Issue
Block a user