Hack e2ee in

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2023-07-12 17:50:07 +02:00
parent 89c326f0bb
commit 8946af8f4e
No known key found for this signature in database
GPG Key ID: D1D45825D60C24D2
3 changed files with 16 additions and 1 deletions

View File

@ -6,7 +6,9 @@ import {
TrackPublishDefaults,
VideoPreset,
VideoPresets,
ExternalE2EEKeyProvider,
} from "livekit-client";
import E2EEWorker from "livekit-client/e2ee-worker?worker";
const defaultLiveKitPublishOptions: TrackPublishDefaults = {
audioPreset: AudioPresets.music,
@ -22,7 +24,16 @@ const defaultLiveKitPublishOptions: TrackPublishDefaults = {
backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
} as const;
const e2eeWorker = new E2EEWorker();
const e2eeKeyProvider = new ExternalE2EEKeyProvider();
e2eeKeyProvider.setKey("not secret password");
export const defaultLiveKitOptions: RoomOptions = {
e2ee: {
keyProvider: e2eeKeyProvider,
worker: e2eeWorker,
},
// automatically manage subscribed video quality
adaptiveStream: true,

View File

@ -32,12 +32,14 @@ export function useLiveKit(
return options;
}, [userChoices.video, userChoices.audio]);
const roomWithoutProps = useMemo(() => new Room(roomOptions), [roomOptions]);
const { room } = useLiveKitRoom({
token: sfuConfig?.jwt,
serverUrl: sfuConfig?.url,
audio: userChoices.audio?.enabled ?? false,
video: userChoices.video?.enabled ?? false,
options: roomOptions,
room: roomWithoutProps,
});
return room;

View File

@ -102,6 +102,8 @@ export function ActiveCall(props: ActiveCallProps) {
return null;
}
livekitRoom.setE2EEEnabled(true);
return (
<RoomContext.Provider value={livekitRoom}>
<InCallView {...props} livekitRoom={livekitRoom} />