mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-15 00:04:59 +08:00
Hack e2ee in
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
89c326f0bb
commit
8946af8f4e
@ -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,
|
||||
|
||||
|
@ -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;
|
||||
|
@ -102,6 +102,8 @@ export function ActiveCall(props: ActiveCallProps) {
|
||||
return null;
|
||||
}
|
||||
|
||||
livekitRoom.setE2EEEnabled(true);
|
||||
|
||||
return (
|
||||
<RoomContext.Provider value={livekitRoom}>
|
||||
<InCallView {...props} livekitRoom={livekitRoom} />
|
||||
|
Loading…
Reference in New Issue
Block a user