Files
element-call/src/livekit/options.ts
T

55 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-09-22 18:05:13 -04:00
/*
Copyright 2023, 2024 New Vector Ltd.
2023-09-22 18:05:13 -04:00
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
2023-09-22 18:05:13 -04:00
*/
import {
AudioPresets,
DefaultReconnectPolicy,
type RoomOptions,
ScreenSharePresets,
type TrackPublishDefaults,
type VideoPreset,
VideoPresets,
} from "livekit-client";
2023-06-16 18:07:13 +02:00
const defaultLiveKitPublishOptions: TrackPublishDefaults = {
audioPreset: AudioPresets.music,
dtx: true,
2023-08-30 17:17:45 +01:00
// disable red because the livekit server strips out red packets for clients
// that don't support it (firefox) but of course that doesn't work with e2ee.
red: false,
forceStereo: false,
simulcast: true,
2023-07-10 11:55:12 +02:00
videoSimulcastLayers: [VideoPresets.h180, VideoPresets.h360] as VideoPreset[],
2023-07-03 11:26:43 +01:00
screenShareEncoding: ScreenSharePresets.h1080fps30.encoding,
stopMicTrackOnMute: false,
videoCodec: "vp8",
2023-07-10 11:55:12 +02:00
videoEncoding: VideoPresets.h720.encoding,
backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
} as const;
2023-06-16 18:07:13 +02:00
export const defaultLiveKitOptions: RoomOptions = {
// automatically manage subscribed video quality
adaptiveStream: true,
// optimize publishing bandwidth and CPU for published tracks
dynacast: true,
// capture settings
videoCaptureDefaults: {
2023-07-10 11:55:12 +02:00
resolution: VideoPresets.h720.resolution,
},
// publish settings
2023-06-16 18:07:13 +02:00
publishDefaults: defaultLiveKitPublishOptions,
// default LiveKit options that seem to be sane
stopLocalTrackOnUnpublish: true,
reconnectPolicy: new DefaultReconnectPolicy(),
disconnectOnPageLeave: true,
2024-04-19 13:02:51 -04:00
webAudioMix: false,
};